2020-04-18 07:54:34 -03:00
|
|
|
/*
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2023-03-18 19:55:12 -03:00
|
|
|
#include "AP_RCTelemetry_config.h"
|
2020-10-18 14:59:39 -03:00
|
|
|
|
2020-04-18 07:54:34 -03:00
|
|
|
#if HAL_CRSF_TELEM_ENABLED
|
|
|
|
|
2023-03-18 19:55:12 -03:00
|
|
|
#include <AP_OSD/AP_OSD.h>
|
2020-04-18 07:54:34 -03:00
|
|
|
#include <AP_RCProtocol/AP_RCProtocol_CRSF.h>
|
|
|
|
#include "AP_RCTelemetry.h"
|
|
|
|
#include <AP_HAL/utility/sparse-endian.h>
|
|
|
|
|
2020-10-18 14:59:39 -03:00
|
|
|
class AP_OSD_ParamSetting;
|
|
|
|
|
2020-04-18 07:54:34 -03:00
|
|
|
class AP_CRSF_Telem : public AP_RCTelemetry {
|
|
|
|
public:
|
|
|
|
AP_CRSF_Telem();
|
|
|
|
~AP_CRSF_Telem() override;
|
|
|
|
|
|
|
|
/* Do not allow copies */
|
2022-09-30 06:50:43 -03:00
|
|
|
CLASS_NO_COPY(AP_CRSF_Telem);
|
2020-04-18 07:54:34 -03:00
|
|
|
|
|
|
|
// init - perform required initialisation
|
|
|
|
virtual bool init() override;
|
|
|
|
|
|
|
|
static AP_CRSF_Telem *get_singleton(void);
|
2020-12-10 05:28:20 -04:00
|
|
|
void queue_message(MAV_SEVERITY severity, const char *text) override;
|
|
|
|
|
|
|
|
static const uint8_t PASSTHROUGH_STATUS_TEXT_FRAME_MAX_SIZE = 50U;
|
|
|
|
static const uint8_t PASSTHROUGH_MULTI_PACKET_FRAME_MAX_SIZE = 9U;
|
|
|
|
static const uint8_t CRSF_RX_DEVICE_PING_MAX_RETRY = 50U;
|
2020-04-18 07:54:34 -03:00
|
|
|
|
|
|
|
// Broadcast frame definitions courtesy of TBS
|
2020-12-10 05:28:20 -04:00
|
|
|
struct PACKED GPSFrame { // curious fact, calling this GPS makes sizeof(GPS) return 1!
|
2020-04-18 07:54:34 -03:00
|
|
|
int32_t latitude; // ( degree / 10`000`000 )
|
|
|
|
int32_t longitude; // (degree / 10`000`000 )
|
|
|
|
uint16_t groundspeed; // ( km/h / 100 )
|
|
|
|
uint16_t gps_heading; // ( degree / 100 )
|
|
|
|
uint16_t altitude; // ( meter - 1000m offset )
|
|
|
|
uint8_t satellites; // in use ( counter )
|
2020-12-10 05:28:20 -04:00
|
|
|
};
|
2020-04-18 07:54:34 -03:00
|
|
|
|
|
|
|
struct HeartbeatFrame {
|
2022-01-15 11:27:36 -04:00
|
|
|
uint8_t origin; // Device address
|
2020-04-18 07:54:34 -03:00
|
|
|
};
|
|
|
|
|
2020-12-10 05:28:20 -04:00
|
|
|
struct PACKED BatteryFrame {
|
2020-04-18 07:54:34 -03:00
|
|
|
uint16_t voltage; // ( mV * 100 )
|
|
|
|
uint16_t current; // ( mA * 100 )
|
|
|
|
uint8_t capacity[3]; // ( mAh )
|
|
|
|
uint8_t remaining; // ( percent )
|
2020-12-10 05:28:20 -04:00
|
|
|
};
|
2020-04-18 07:54:34 -03:00
|
|
|
|
2024-04-24 12:52:13 -03:00
|
|
|
struct PACKED BaroVarioFrame {
|
|
|
|
uint16_t altitude_packed; // Altitude above start (calibration) point.
|
|
|
|
int8_t vertical_speed_packed; // vertical speed.
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PACKED VarioFrame {
|
|
|
|
int16_t v_speed; // vertical speed cm/s
|
|
|
|
};
|
|
|
|
|
2020-12-10 05:28:20 -04:00
|
|
|
struct PACKED VTXFrame {
|
2020-04-18 07:54:34 -03:00
|
|
|
#if __BYTE_ORDER != __LITTLE_ENDIAN
|
|
|
|
#error "Only supported on little-endian architectures"
|
|
|
|
#endif
|
|
|
|
uint8_t origin; // address
|
|
|
|
// status
|
|
|
|
uint8_t is_in_pitmode : 1;
|
|
|
|
uint8_t is_in_user_frequency_mode : 1;
|
|
|
|
uint8_t unused : 2;
|
|
|
|
uint8_t is_vtx_available : 1;
|
|
|
|
uint8_t smart_audio_ver : 3; // SmartAudio_V1 = 0, SmartAudio_V2 = 1
|
|
|
|
// band / channel
|
|
|
|
uint8_t channel : 3; // 1x-8x
|
|
|
|
uint8_t band : 5; // A, B, E, AirWave, Race
|
|
|
|
uint16_t user_frequency;
|
|
|
|
uint8_t power : 4; // 25mW = 0, 200mW = 1, 500mW = 2, 800mW = 3
|
|
|
|
uint8_t pitmode : 4; // off = 0, In_Band = 1, Out_Band = 2;
|
2020-12-10 05:28:20 -04:00
|
|
|
};
|
2020-04-18 07:54:34 -03:00
|
|
|
|
2020-12-10 05:28:20 -04:00
|
|
|
struct PACKED VTXTelemetryFrame {
|
2020-04-18 07:54:34 -03:00
|
|
|
uint8_t origin; // address
|
|
|
|
uint8_t power; // power in dBm
|
|
|
|
uint16_t frequency; // frequency in Mhz
|
2020-07-08 17:55:39 -03:00
|
|
|
uint8_t pitmode; // disable 0, enable 1
|
2020-12-10 05:28:20 -04:00
|
|
|
};
|
2020-04-18 07:54:34 -03:00
|
|
|
|
2020-12-10 05:28:20 -04:00
|
|
|
struct PACKED AttitudeFrame {
|
2020-07-15 16:26:54 -03:00
|
|
|
int16_t pitch_angle; // ( rad * 10000 )
|
|
|
|
int16_t roll_angle; // ( rad * 10000 )
|
|
|
|
int16_t yaw_angle; // ( rad * 10000 )
|
2020-12-10 05:28:20 -04:00
|
|
|
};
|
2020-04-18 07:54:34 -03:00
|
|
|
|
2020-12-10 05:28:20 -04:00
|
|
|
struct PACKED FlightModeFrame {
|
2020-04-18 07:54:34 -03:00
|
|
|
char flight_mode[16]; // ( Null-terminated string )
|
2020-12-10 05:28:20 -04:00
|
|
|
};
|
2020-04-18 07:54:34 -03:00
|
|
|
|
|
|
|
// CRSF_FRAMETYPE_COMMAND
|
2020-12-10 05:28:20 -04:00
|
|
|
struct PACKED CommandFrame {
|
2020-04-18 07:54:34 -03:00
|
|
|
uint8_t destination;
|
|
|
|
uint8_t origin;
|
|
|
|
uint8_t command_id;
|
|
|
|
uint8_t payload[9]; // 8 maximum for LED command + crc8
|
2020-12-10 05:28:20 -04:00
|
|
|
};
|
2020-04-18 07:54:34 -03:00
|
|
|
|
|
|
|
// CRSF_FRAMETYPE_PARAM_DEVICE_PING
|
2020-12-10 05:28:20 -04:00
|
|
|
struct PACKED ParameterPingFrame {
|
2020-04-18 07:54:34 -03:00
|
|
|
uint8_t destination;
|
|
|
|
uint8_t origin;
|
2020-12-10 05:28:20 -04:00
|
|
|
};
|
2020-04-18 07:54:34 -03:00
|
|
|
|
2020-10-18 14:59:39 -03:00
|
|
|
// CRSF_FRAMETYPE_PARAM_DEVICE_INFO
|
2020-12-10 05:28:20 -04:00
|
|
|
struct PACKED ParameterDeviceInfoFrame {
|
2020-10-18 14:59:39 -03:00
|
|
|
uint8_t destination;
|
|
|
|
uint8_t origin;
|
|
|
|
uint8_t payload[58]; // largest possible frame is 60
|
2020-12-10 05:28:20 -04:00
|
|
|
};
|
2020-10-18 14:59:39 -03:00
|
|
|
|
|
|
|
enum ParameterType : uint8_t
|
|
|
|
{
|
|
|
|
UINT8 = 0,
|
|
|
|
INT8 = 1,
|
|
|
|
UINT16 = 2,
|
|
|
|
INT16 = 3,
|
|
|
|
FLOAT = 8,
|
|
|
|
TEXT_SELECTION = 9,
|
|
|
|
STRING = 10,
|
|
|
|
FOLDER = 11,
|
|
|
|
INFO = 12,
|
|
|
|
COMMAND = 13,
|
|
|
|
OUT_OF_RANGE = 127
|
|
|
|
};
|
|
|
|
|
|
|
|
// CRSF_FRAMETYPE_PARAMETER_SETTINGS_ENTRY
|
2020-12-10 05:28:20 -04:00
|
|
|
struct PACKED ParameterSettingsEntryHeader {
|
2020-10-18 14:59:39 -03:00
|
|
|
uint8_t destination;
|
|
|
|
uint8_t origin;
|
|
|
|
uint8_t param_num;
|
|
|
|
uint8_t chunks_left;
|
2020-12-10 05:28:20 -04:00
|
|
|
};
|
2020-10-18 14:59:39 -03:00
|
|
|
|
|
|
|
// CRSF_FRAMETYPE_PARAMETER_SETTINGS_ENTRY
|
2020-12-10 05:28:20 -04:00
|
|
|
struct PACKED ParameterSettingsEntry {
|
2020-10-18 14:59:39 -03:00
|
|
|
ParameterSettingsEntryHeader header;
|
|
|
|
uint8_t payload[56]; // largest possible frame is 60
|
2020-12-10 05:28:20 -04:00
|
|
|
};
|
2020-10-18 14:59:39 -03:00
|
|
|
|
|
|
|
// CRSF_FRAMETYPE_PARAMETER_READ
|
2020-12-10 05:28:20 -04:00
|
|
|
struct PACKED ParameterSettingsReadFrame {
|
2020-10-18 14:59:39 -03:00
|
|
|
uint8_t destination;
|
|
|
|
uint8_t origin;
|
|
|
|
uint8_t param_num;
|
|
|
|
uint8_t param_chunk;
|
2020-12-10 05:28:20 -04:00
|
|
|
} _param_request;
|
2020-10-18 14:59:39 -03:00
|
|
|
|
|
|
|
// CRSF_FRAMETYPE_PARAMETER_WRITE
|
2020-12-10 05:28:20 -04:00
|
|
|
struct PACKED ParameterSettingsWriteFrame {
|
2020-10-18 14:59:39 -03:00
|
|
|
uint8_t destination;
|
|
|
|
uint8_t origin;
|
|
|
|
uint8_t param_num;
|
|
|
|
uint8_t payload[57]; // largest possible frame is 60
|
2020-12-10 05:28:20 -04:00
|
|
|
};
|
2020-10-18 14:59:39 -03:00
|
|
|
|
2020-12-10 05:28:20 -04:00
|
|
|
// Frame to hold passthrough telemetry
|
|
|
|
struct PACKED PassthroughSinglePacketFrame {
|
|
|
|
uint8_t sub_type;
|
|
|
|
uint16_t appid;
|
|
|
|
uint32_t data;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Frame to hold passthrough telemetry
|
|
|
|
struct PACKED PassthroughMultiPacketFrame {
|
|
|
|
uint8_t sub_type;
|
|
|
|
uint8_t size;
|
2021-11-01 14:13:21 -03:00
|
|
|
struct PACKED PassthroughTelemetryPacket {
|
2020-12-10 05:28:20 -04:00
|
|
|
uint16_t appid;
|
|
|
|
uint32_t data;
|
2021-11-01 14:13:21 -03:00
|
|
|
} packets[PASSTHROUGH_MULTI_PACKET_FRAME_MAX_SIZE];
|
2020-12-10 05:28:20 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
// Frame to hold status text message
|
|
|
|
struct PACKED StatusTextFrame {
|
|
|
|
uint8_t sub_type;
|
|
|
|
uint8_t severity;
|
|
|
|
char text[PASSTHROUGH_STATUS_TEXT_FRAME_MAX_SIZE]; // ( Null-terminated string )
|
|
|
|
};
|
|
|
|
|
|
|
|
// ardupilot frametype container
|
|
|
|
union PACKED APCustomTelemFrame {
|
|
|
|
PassthroughSinglePacketFrame single_packet_passthrough;
|
|
|
|
PassthroughMultiPacketFrame multi_packet_passthrough;
|
|
|
|
StatusTextFrame status_text;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
union PACKED BroadcastFrame {
|
2020-04-18 07:54:34 -03:00
|
|
|
GPSFrame gps;
|
|
|
|
HeartbeatFrame heartbeat;
|
2024-04-24 12:52:13 -03:00
|
|
|
BaroVarioFrame baro_vario;
|
|
|
|
VarioFrame vario;
|
2020-04-18 07:54:34 -03:00
|
|
|
BatteryFrame battery;
|
|
|
|
VTXFrame vtx;
|
|
|
|
AttitudeFrame attitude;
|
|
|
|
FlightModeFrame flightmode;
|
2020-12-10 05:28:20 -04:00
|
|
|
APCustomTelemFrame custom_telem;
|
|
|
|
};
|
2020-04-18 07:54:34 -03:00
|
|
|
|
2020-12-10 05:28:20 -04:00
|
|
|
union PACKED ExtendedFrame {
|
2020-04-18 07:54:34 -03:00
|
|
|
CommandFrame command;
|
|
|
|
ParameterPingFrame ping;
|
2020-10-18 14:59:39 -03:00
|
|
|
ParameterDeviceInfoFrame info;
|
|
|
|
ParameterSettingsEntry param_entry;
|
|
|
|
ParameterSettingsReadFrame param_read;
|
|
|
|
ParameterSettingsWriteFrame param_write;
|
2020-12-10 05:28:20 -04:00
|
|
|
};
|
2020-04-18 07:54:34 -03:00
|
|
|
|
2020-12-10 05:28:20 -04:00
|
|
|
union PACKED TelemetryPayload {
|
2020-04-18 07:54:34 -03:00
|
|
|
BroadcastFrame bcast;
|
|
|
|
ExtendedFrame ext;
|
2020-12-10 05:28:20 -04:00
|
|
|
};
|
2020-04-18 07:54:34 -03:00
|
|
|
|
2021-11-01 14:13:21 -03:00
|
|
|
// get the protocol string
|
2022-11-22 16:23:40 -04:00
|
|
|
const char* get_protocol_string() const { return AP::crsf()->get_protocol_string(_crsf_version.protocol); }
|
|
|
|
|
|
|
|
// is the current protocol ELRS?
|
|
|
|
bool is_elrs() const { return _crsf_version.protocol == AP_RCProtocol_CRSF::ProtocolType::PROTOCOL_ELRS; }
|
|
|
|
// is the current protocol Tracer?
|
|
|
|
bool is_tracer() const { return _crsf_version.protocol == AP_RCProtocol_CRSF::ProtocolType::PROTOCOL_TRACER; }
|
|
|
|
|
2020-04-18 07:54:34 -03:00
|
|
|
// Process a frame from the CRSF protocol decoder
|
|
|
|
static bool process_frame(AP_RCProtocol_CRSF::FrameType frame_type, void* data);
|
|
|
|
// process any changed settings and schedule for transmission
|
|
|
|
void update();
|
|
|
|
// get next telemetry data for external consumers of SPort data
|
2022-01-15 11:27:36 -04:00
|
|
|
static bool get_telem_data(AP_RCProtocol_CRSF::Frame* frame, bool is_tx_active);
|
2024-03-10 13:59:52 -03:00
|
|
|
// start bind request
|
|
|
|
void start_bind() { _bind_request_pending = true; }
|
2020-04-18 07:54:34 -03:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
enum SensorType {
|
|
|
|
HEARTBEAT,
|
|
|
|
PARAMETERS,
|
2024-04-24 12:52:13 -03:00
|
|
|
BARO_VARIO,
|
|
|
|
VARIO,
|
2020-10-18 14:59:39 -03:00
|
|
|
ATTITUDE,
|
|
|
|
VTX_PARAMETERS,
|
2020-04-18 07:54:34 -03:00
|
|
|
BATTERY,
|
|
|
|
GPS,
|
|
|
|
FLIGHT_MODE,
|
2020-12-10 05:28:20 -04:00
|
|
|
PASSTHROUGH,
|
|
|
|
STATUS_TEXT,
|
2021-07-12 18:07:16 -03:00
|
|
|
GENERAL_COMMAND,
|
2022-01-15 11:27:36 -04:00
|
|
|
VERSION_PING,
|
|
|
|
DEVICE_PING,
|
2020-04-18 07:54:34 -03:00
|
|
|
NUM_SENSORS
|
|
|
|
};
|
|
|
|
|
|
|
|
// passthrough WFQ scheduler
|
|
|
|
bool is_packet_ready(uint8_t idx, bool queue_empty) override;
|
|
|
|
void process_packet(uint8_t idx) override;
|
|
|
|
void adjust_packet_weight(bool queue_empty) override;
|
2020-12-10 05:28:20 -04:00
|
|
|
void setup_custom_telemetry();
|
2021-11-01 14:13:21 -03:00
|
|
|
void update_custom_telemetry_rates(const AP_RCProtocol_CRSF::RFMode rf_mode);
|
2020-04-18 07:54:34 -03:00
|
|
|
|
|
|
|
void calc_parameter_ping();
|
|
|
|
void calc_heartbeat();
|
|
|
|
void calc_battery();
|
2024-04-24 12:52:13 -03:00
|
|
|
uint16_t get_altitude_packed();
|
|
|
|
int8_t get_vertical_speed_packed();
|
|
|
|
void calc_baro_vario();
|
|
|
|
void calc_vario();
|
2020-04-18 07:54:34 -03:00
|
|
|
void calc_gps();
|
|
|
|
void calc_attitude();
|
|
|
|
void calc_flight_mode();
|
2020-10-18 14:59:39 -03:00
|
|
|
void calc_device_info();
|
2022-01-15 11:27:36 -04:00
|
|
|
void calc_device_ping(uint8_t destination);
|
2021-07-12 18:07:16 -03:00
|
|
|
void calc_command_response();
|
2024-03-10 13:59:52 -03:00
|
|
|
void calc_bind();
|
2020-10-18 14:59:39 -03:00
|
|
|
void calc_parameter();
|
|
|
|
#if HAL_CRSF_TELEM_TEXT_SELECTION_ENABLED
|
|
|
|
void calc_text_selection( AP_OSD_ParamSetting* param, uint8_t chunk);
|
|
|
|
#endif
|
2022-01-15 11:27:36 -04:00
|
|
|
void process_pending_requests();
|
2020-10-18 14:59:39 -03:00
|
|
|
void update_vtx_params();
|
2020-12-10 05:28:20 -04:00
|
|
|
void get_single_packet_passthrough_telem_data();
|
2021-11-01 14:13:21 -03:00
|
|
|
void get_multi_packet_passthrough_telem_data(uint8_t size = PASSTHROUGH_MULTI_PACKET_FRAME_MAX_SIZE);
|
2020-12-10 05:28:20 -04:00
|
|
|
void calc_status_text();
|
2022-01-15 11:27:36 -04:00
|
|
|
bool process_rf_mode_changes();
|
2020-12-10 05:28:20 -04:00
|
|
|
uint8_t get_custom_telem_frame_id() const;
|
|
|
|
AP_RCProtocol_CRSF::RFMode get_rf_mode() const;
|
2021-11-01 14:13:21 -03:00
|
|
|
uint16_t get_telemetry_rate() const;
|
2020-12-10 05:28:20 -04:00
|
|
|
bool is_high_speed_telemetry(const AP_RCProtocol_CRSF::RFMode rf_mode) const;
|
2020-04-18 07:54:34 -03:00
|
|
|
|
|
|
|
void process_vtx_frame(VTXFrame* vtx);
|
|
|
|
void process_vtx_telem_frame(VTXTelemetryFrame* vtx);
|
2020-10-18 14:59:39 -03:00
|
|
|
void process_ping_frame(ParameterPingFrame* ping);
|
|
|
|
void process_param_read_frame(ParameterSettingsReadFrame* read);
|
|
|
|
void process_param_write_frame(ParameterSettingsWriteFrame* write);
|
2020-12-10 05:28:20 -04:00
|
|
|
void process_device_info_frame(ParameterDeviceInfoFrame* info);
|
2021-07-12 18:07:16 -03:00
|
|
|
void process_command_frame(CommandFrame* command);
|
2020-04-18 07:54:34 -03:00
|
|
|
|
2020-12-10 05:28:20 -04:00
|
|
|
// setup ready for passthrough operation
|
2020-04-18 07:54:34 -03:00
|
|
|
void setup_wfq_scheduler(void) override;
|
|
|
|
|
2020-12-10 05:28:20 -04:00
|
|
|
// setup the scheduler for parameters download
|
|
|
|
void enter_scheduler_params_mode();
|
|
|
|
void exit_scheduler_params_mode();
|
2022-01-15 11:27:36 -04:00
|
|
|
void disable_tx_entries();
|
|
|
|
void enable_tx_entries();
|
2020-12-10 05:28:20 -04:00
|
|
|
|
|
|
|
// get next telemetry data for external consumers
|
2022-01-15 11:27:36 -04:00
|
|
|
bool _get_telem_data(AP_RCProtocol_CRSF::Frame* data, bool is_tx_active);
|
2020-04-18 07:54:34 -03:00
|
|
|
bool _process_frame(AP_RCProtocol_CRSF::FrameType frame_type, void* data);
|
|
|
|
|
|
|
|
TelemetryPayload _telem;
|
|
|
|
uint8_t _telem_size;
|
|
|
|
uint8_t _telem_type;
|
2020-12-10 05:28:20 -04:00
|
|
|
AP_RCProtocol_CRSF::RFMode _telem_rf_mode;
|
2020-12-21 14:14:18 -04:00
|
|
|
// reporting telemetry rate
|
|
|
|
uint32_t _telem_last_report_ms;
|
|
|
|
uint16_t _telem_last_avg_rate;
|
2022-01-15 11:27:36 -04:00
|
|
|
// do we need to report the initial state
|
|
|
|
bool _telem_bootstrap_msg_pending;
|
2020-04-18 07:54:34 -03:00
|
|
|
|
2021-11-01 14:13:21 -03:00
|
|
|
bool _telem_is_high_speed;
|
2020-04-18 07:54:34 -03:00
|
|
|
bool _telem_pending;
|
|
|
|
bool _enable_telemetry;
|
2022-01-15 11:27:36 -04:00
|
|
|
// used to limit telemetry when in a failsafe condition
|
|
|
|
bool _is_tx_active;
|
2020-12-10 05:28:20 -04:00
|
|
|
|
|
|
|
struct {
|
|
|
|
uint8_t destination = AP_RCProtocol_CRSF::CRSF_ADDRESS_BROADCAST;
|
|
|
|
uint8_t frame_type;
|
|
|
|
} _pending_request;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
uint8_t minor;
|
|
|
|
uint8_t major;
|
|
|
|
uint8_t retry_count;
|
|
|
|
bool use_rf_mode;
|
2022-11-22 16:23:40 -04:00
|
|
|
AP_RCProtocol_CRSF::ProtocolType protocol;
|
2020-12-10 05:28:20 -04:00
|
|
|
bool pending = true;
|
2023-11-08 13:42:46 -04:00
|
|
|
uint32_t last_request_info_ms;
|
2020-12-10 05:28:20 -04:00
|
|
|
} _crsf_version;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
bool init_done;
|
|
|
|
uint32_t params_mode_start_ms;
|
|
|
|
bool params_mode_active;
|
|
|
|
} _custom_telem;
|
2020-04-18 07:54:34 -03:00
|
|
|
|
2021-07-12 18:07:16 -03:00
|
|
|
struct {
|
|
|
|
bool pending;
|
|
|
|
bool valid;
|
|
|
|
uint8_t port_id;
|
|
|
|
} _baud_rate_request;
|
|
|
|
|
2024-03-10 13:59:52 -03:00
|
|
|
bool _bind_request_pending;
|
|
|
|
|
2020-04-18 07:54:34 -03:00
|
|
|
// vtx state
|
|
|
|
bool _vtx_freq_update; // update using the frequency method or not
|
|
|
|
bool _vtx_dbm_update; // update using the dbm method or not
|
|
|
|
bool _vtx_freq_change_pending; // a vtx command has been issued but not confirmed by a vtx broadcast frame
|
|
|
|
bool _vtx_power_change_pending;
|
|
|
|
bool _vtx_options_change_pending;
|
|
|
|
|
2021-12-19 10:35:22 -04:00
|
|
|
bool _noted_lq_as_rssi_active;
|
|
|
|
|
2020-04-18 07:54:34 -03:00
|
|
|
static AP_CRSF_Telem *singleton;
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace AP {
|
|
|
|
AP_CRSF_Telem *crsf_telem();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|