PX4 Firmware
PX4 Autopilot Software http://px4.io
|
High-level class that handles sending of CRSF telemetry data. More...
#include <crsf_telemetry.h>
Public Member Functions | |
CRSFTelemetry (int uart_fd) | |
~CRSFTelemetry ()=default | |
bool | update (const hrt_abstime &now) |
Send telemetry data. More... | |
Private Member Functions | |
bool | send_battery () |
bool | send_gps () |
bool | send_attitude () |
bool | send_flight_mode () |
Private Attributes | |
uORB::Subscription | _vehicle_gps_position_sub {ORB_ID(vehicle_gps_position)} |
uORB::Subscription | _battery_status_sub {ORB_ID(battery_status)} |
uORB::Subscription | _vehicle_attitude_sub {ORB_ID(vehicle_attitude)} |
uORB::Subscription | _vehicle_status_sub {ORB_ID(vehicle_status)} |
hrt_abstime | _last_update {0} |
int | _next_type {0} |
int | _uart_fd |
Static Private Attributes | |
static constexpr int | num_data_types {4} |
number of different telemetry data types More... | |
High-level class that handles sending of CRSF telemetry data.
Definition at line 57 of file crsf_telemetry.h.
CRSFTelemetry::CRSFTelemetry | ( | int | uart_fd | ) |
uart_fd | file descriptor for the UART to use. It is expected to be configured already. |
Definition at line 37 of file crsf_telemetry.cpp.
|
default |
|
private |
Definition at line 110 of file crsf_telemetry.cpp.
References _uart_fd, _vehicle_attitude_sub, attitude, crsf_send_telemetry_attitude(), vehicle_attitude_s::q, and uORB::Subscription::update().
Referenced by update().
|
private |
Definition at line 76 of file crsf_telemetry.cpp.
References _battery_status_sub, _uart_fd, crsf_send_telemetry_battery(), battery_status_s::current_filtered_a, battery_status_s::discharged_mah, battery_status_s::remaining, uORB::Subscription::update(), and battery_status_s::voltage_filtered_v.
Referenced by update().
|
private |
Definition at line 125 of file crsf_telemetry.cpp.
References _uart_fd, _vehicle_status_sub, crsf_send_telemetry_flight_mode(), flight_mode, vehicle_status_s::nav_state, and uORB::Subscription::update().
Referenced by update().
|
private |
Definition at line 91 of file crsf_telemetry.cpp.
References _uart_fd, _vehicle_gps_position_sub, vehicle_gps_position_s::alt, vehicle_gps_position_s::cog_rad, crsf_send_telemetry_gps(), math::degrees(), vehicle_gps_position_s::lat, vehicle_gps_position_s::lon, vehicle_gps_position_s::satellites_used, uORB::Subscription::update(), and vehicle_gps_position_s::vel_d_m_s.
Referenced by update().
bool CRSFTelemetry::update | ( | const hrt_abstime & | now | ) |
Send telemetry data.
Call this regularly (i.e. at 100Hz), it will automatically limit the sending rate.
Definition at line 42 of file crsf_telemetry.cpp.
References _last_update, _next_type, num_data_types, send_attitude(), send_battery(), send_flight_mode(), and send_gps().
Referenced by RCInput::cycle().
|
private |
Definition at line 82 of file crsf_telemetry.h.
Referenced by send_battery().
|
private |
Definition at line 86 of file crsf_telemetry.h.
Referenced by update().
|
private |
Definition at line 89 of file crsf_telemetry.h.
Referenced by update().
|
private |
Definition at line 91 of file crsf_telemetry.h.
Referenced by send_attitude(), send_battery(), send_flight_mode(), and send_gps().
|
private |
Definition at line 83 of file crsf_telemetry.h.
Referenced by send_attitude().
|
private |
Definition at line 81 of file crsf_telemetry.h.
Referenced by send_gps().
|
private |
Definition at line 84 of file crsf_telemetry.h.
Referenced by send_flight_mode().
|
staticprivate |
number of different telemetry data types
Definition at line 88 of file crsf_telemetry.h.
Referenced by update().