Merge from 2.3
This commit is contained in:
@@ -88,10 +88,10 @@ enum
|
||||
AFHDS2A_ID_END = 0xFF,
|
||||
|
||||
// AC type telemetry with multiple values in one packet
|
||||
AFHDS2A_ID_GPS_FULL = 0xFD,
|
||||
AFHDS2A_ID_GPS_FULL = 0xFD,
|
||||
AFHDS2A_ID_VOLT_FULL = 0xF0,
|
||||
AFHDS2A_ID_ACC_FULL = 0xEF,
|
||||
TX_RSSI_ID = 0x200, // Pseudo id outside 1 byte range of FlySky sensors
|
||||
AFHDS2A_ID_TX_RSSI = 0x200, // Pseudo id outside 1 byte range of FlySky sensors
|
||||
};
|
||||
|
||||
const FlySkySensor flySkySensors[] = {
|
||||
@@ -133,7 +133,7 @@ const FlySkySensor flySkySensors[] = {
|
||||
{AFHDS2A_ID_RX_NOISE, ZSTR_RX_NOISE, UNIT_DB, 0}, // RX Noise
|
||||
{AFHDS2A_ID_RX_RSSI, ZSTR_RSSI, UNIT_DB, 0}, // RX RSSI (0xfc)
|
||||
{AFHDS2A_ID_RX_ERR_RATE, ZSTR_RX_QUALITY, UNIT_RAW, 0}, // RX error rate
|
||||
{TX_RSSI_ID, ZSTR_TX_RSSI, UNIT_RAW, 0}, // Pseudo sensor for TRSSI
|
||||
{AFHDS2A_ID_TX_RSSI, ZSTR_TX_RSSI, UNIT_RAW, 0}, // Pseudo sensor for TRSSI
|
||||
|
||||
{0x00, NULL, UNIT_RAW, 0}, // sentinel
|
||||
};
|
||||
@@ -227,7 +227,7 @@ static void processFlySkySensor(const uint8_t * packet, uint8_t type)
|
||||
void processFlySkyPacket(const uint8_t * packet)
|
||||
{
|
||||
// Set TX RSSI Value, reverse MULTIs scaling
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_FLYSKY_IBUS, TX_RSSI_ID, 0, 0, packet[0], UNIT_RAW, 0);
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_FLYSKY_IBUS, AFHDS2A_ID_TX_RSSI, 0, 0, packet[0], UNIT_RAW, 0);
|
||||
|
||||
const uint8_t * buffer = packet + 1;
|
||||
int sesnor = 0;
|
||||
@@ -241,7 +241,7 @@ void processFlySkyPacket(const uint8_t * packet)
|
||||
void processFlySkyPacketAC(const uint8_t * packet)
|
||||
{
|
||||
// Set TX RSSI Value, reverse MULTIs scaling
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_FLYSKY_IBUS, TX_RSSI_ID, 0, 0, packet[0], UNIT_RAW, 0);
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_FLYSKY_IBUS, AFHDS2A_ID_TX_RSSI, 0, 0, packet[0], UNIT_RAW, 0);
|
||||
const uint8_t * buffer = packet + 1;
|
||||
while (buffer - packet < 26) //28 + 1(multi TX rssi) - 3(ac header)
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@ bool pushFrskyTelemetryData(uint8_t data)
|
||||
break;
|
||||
|
||||
case STATE_DATA_IN_FRAME:
|
||||
if (data == BYTESTUFF) {
|
||||
if (data == BYTE_STUFF) {
|
||||
dataState = STATE_DATA_XOR; // XOR next byte
|
||||
}
|
||||
else if (data == START_STOP) {
|
||||
|
||||
+82
-75
@@ -95,99 +95,106 @@ enum FrSkyDataState {
|
||||
|
||||
// FrSky new DATA IDs (2 bytes)
|
||||
#define ALT_FIRST_ID 0x0100
|
||||
#define ALT_LAST_ID 0x010f
|
||||
#define ALT_LAST_ID 0x010F
|
||||
#define VARIO_FIRST_ID 0x0110
|
||||
#define VARIO_LAST_ID 0x011f
|
||||
#define VARIO_LAST_ID 0x011F
|
||||
#define CURR_FIRST_ID 0x0200
|
||||
#define CURR_LAST_ID 0x020f
|
||||
#define CURR_LAST_ID 0x020F
|
||||
#define VFAS_FIRST_ID 0x0210
|
||||
#define VFAS_LAST_ID 0x021f
|
||||
#define VFAS_LAST_ID 0x021F
|
||||
#define CELLS_FIRST_ID 0x0300
|
||||
#define CELLS_LAST_ID 0x030f
|
||||
#define CELLS_LAST_ID 0x030F
|
||||
#define T1_FIRST_ID 0x0400
|
||||
#define T1_LAST_ID 0x040f
|
||||
#define T1_LAST_ID 0x040F
|
||||
#define T2_FIRST_ID 0x0410
|
||||
#define T2_LAST_ID 0x041f
|
||||
#define T2_LAST_ID 0x041F
|
||||
#define RPM_FIRST_ID 0x0500
|
||||
#define RPM_LAST_ID 0x050f
|
||||
#define RPM_LAST_ID 0x050F
|
||||
#define FUEL_FIRST_ID 0x0600
|
||||
#define FUEL_LAST_ID 0x060f
|
||||
#define FUEL_LAST_ID 0x060F
|
||||
#define ACCX_FIRST_ID 0x0700
|
||||
#define ACCX_LAST_ID 0x070f
|
||||
#define ACCX_LAST_ID 0x070F
|
||||
#define ACCY_FIRST_ID 0x0710
|
||||
#define ACCY_LAST_ID 0x071f
|
||||
#define ACCY_LAST_ID 0x071F
|
||||
#define ACCZ_FIRST_ID 0x0720
|
||||
#define ACCZ_LAST_ID 0x072f
|
||||
#define ACCZ_LAST_ID 0x072F
|
||||
#define GPS_LONG_LATI_FIRST_ID 0x0800
|
||||
#define GPS_LONG_LATI_LAST_ID 0x080f
|
||||
#define GPS_LONG_LATI_LAST_ID 0x080F
|
||||
#define GPS_ALT_FIRST_ID 0x0820
|
||||
#define GPS_ALT_LAST_ID 0x082f
|
||||
#define GPS_ALT_LAST_ID 0x082F
|
||||
#define GPS_SPEED_FIRST_ID 0x0830
|
||||
#define GPS_SPEED_LAST_ID 0x083f
|
||||
#define GPS_SPEED_LAST_ID 0x083F
|
||||
#define GPS_COURS_FIRST_ID 0x0840
|
||||
#define GPS_COURS_LAST_ID 0x084f
|
||||
#define GPS_COURS_LAST_ID 0x084F
|
||||
#define GPS_TIME_DATE_FIRST_ID 0x0850
|
||||
#define GPS_TIME_DATE_LAST_ID 0x085f
|
||||
#define GPS_TIME_DATE_LAST_ID 0x085F
|
||||
#define A3_FIRST_ID 0x0900
|
||||
#define A3_LAST_ID 0x090f
|
||||
#define A3_LAST_ID 0x090F
|
||||
#define A4_FIRST_ID 0x0910
|
||||
#define A4_LAST_ID 0x091f
|
||||
#define AIR_SPEED_FIRST_ID 0x0a00
|
||||
#define AIR_SPEED_LAST_ID 0x0a0f
|
||||
#define RBOX_BATT1_FIRST_ID 0x0b00
|
||||
#define RBOX_BATT1_LAST_ID 0x0b0f
|
||||
#define RBOX_BATT2_FIRST_ID 0x0b10
|
||||
#define RBOX_BATT2_LAST_ID 0x0b1f
|
||||
#define RBOX_STATE_FIRST_ID 0x0b20
|
||||
#define RBOX_STATE_LAST_ID 0x0b2f
|
||||
#define RBOX_CNSP_FIRST_ID 0x0b30
|
||||
#define RBOX_CNSP_LAST_ID 0x0b3f
|
||||
#define SD1_FIRST_ID 0x0b40
|
||||
#define SD1_LAST_ID 0x0b4f
|
||||
#define ESC_POWER_FIRST_ID 0x0b50
|
||||
#define ESC_POWER_LAST_ID 0x0b5f
|
||||
#define ESC_RPM_CONS_FIRST_ID 0x0b60
|
||||
#define ESC_RPM_CONS_LAST_ID 0x0b6f
|
||||
#define ESC_TEMPERATURE_FIRST_ID 0x0b70
|
||||
#define ESC_TEMPERATURE_LAST_ID 0x0b7f
|
||||
#define A4_LAST_ID 0x091F
|
||||
#define AIR_SPEED_FIRST_ID 0x0A00
|
||||
#define AIR_SPEED_LAST_ID 0x0A0F
|
||||
#define RBOX_BATT1_FIRST_ID 0x0B00
|
||||
#define RBOX_BATT1_LAST_ID 0x0B0F
|
||||
#define RBOX_BATT2_FIRST_ID 0x0B10
|
||||
#define RBOX_BATT2_LAST_ID 0x0B1F
|
||||
#define RBOX_STATE_FIRST_ID 0x0B20
|
||||
#define RBOX_STATE_LAST_ID 0x0B2F
|
||||
#define RBOX_CNSP_FIRST_ID 0x0B30
|
||||
#define RBOX_CNSP_LAST_ID 0x0B3F
|
||||
#define SD1_FIRST_ID 0x0B40
|
||||
#define SD1_LAST_ID 0x0B4F
|
||||
#define ESC_POWER_FIRST_ID 0x0B50
|
||||
#define ESC_POWER_LAST_ID 0x0B5F
|
||||
#define ESC_RPM_CONS_FIRST_ID 0x0B60
|
||||
#define ESC_RPM_CONS_LAST_ID 0x0B6f
|
||||
#define ESC_TEMPERATURE_FIRST_ID 0x0B70
|
||||
#define ESC_TEMPERATURE_LAST_ID 0x0B7f
|
||||
#define X8R_FIRST_ID 0x0c20
|
||||
#define X8R_LAST_ID 0x0c2f
|
||||
#define X8R_LAST_ID 0x0c2F
|
||||
#define S6R_FIRST_ID 0x0c30
|
||||
#define S6R_LAST_ID 0x0c3f
|
||||
#define GASSUIT_TEMP1_FIRST_ID 0x0d00
|
||||
#define GASSUIT_TEMP1_LAST_ID 0x0d0f
|
||||
#define GASSUIT_TEMP2_FIRST_ID 0x0d10
|
||||
#define GASSUIT_TEMP2_LAST_ID 0x0d1f
|
||||
#define GASSUIT_SPEED_FIRST_ID 0x0d20
|
||||
#define GASSUIT_SPEED_LAST_ID 0x0d2f
|
||||
#define GASSUIT_RES_VOL_FIRST_ID 0x0d30
|
||||
#define GASSUIT_RES_VOL_LAST_ID 0x0d3f
|
||||
#define GASSUIT_RES_PERC_FIRST_ID 0x0d40
|
||||
#define GASSUIT_RES_PERC_LAST_ID 0x0d4f
|
||||
#define GASSUIT_FLOW_FIRST_ID 0x0d50
|
||||
#define GASSUIT_FLOW_LAST_ID 0x0d5f
|
||||
#define GASSUIT_MAX_FLOW_FIRST_ID 0x0d60
|
||||
#define GASSUIT_MAX_FLOW_LAST_ID 0x0d6f
|
||||
#define GASSUIT_AVG_FLOW_FIRST_ID 0x0d70
|
||||
#define GASSUIT_AVG_FLOW_LAST_ID 0x0d7f
|
||||
#define SBEC_POWER_FIRST_ID 0x0e50
|
||||
#define SBEC_POWER_LAST_ID 0x0e5f
|
||||
#define S6R_LAST_ID 0x0c3F
|
||||
#define GASSUIT_TEMP1_FIRST_ID 0x0D00
|
||||
#define GASSUIT_TEMP1_LAST_ID 0x0D0F
|
||||
#define GASSUIT_TEMP2_FIRST_ID 0x0D10
|
||||
#define GASSUIT_TEMP2_LAST_ID 0x0D1F
|
||||
#define GASSUIT_SPEED_FIRST_ID 0x0D20
|
||||
#define GASSUIT_SPEED_LAST_ID 0x0D2F
|
||||
#define GASSUIT_RES_VOL_FIRST_ID 0x0D30
|
||||
#define GASSUIT_RES_VOL_LAST_ID 0x0D3F
|
||||
#define GASSUIT_RES_PERC_FIRST_ID 0x0D40
|
||||
#define GASSUIT_RES_PERC_LAST_ID 0x0D4F
|
||||
#define GASSUIT_FLOW_FIRST_ID 0x0D50
|
||||
#define GASSUIT_FLOW_LAST_ID 0x0D5F
|
||||
#define GASSUIT_MAX_FLOW_FIRST_ID 0x0D60
|
||||
#define GASSUIT_MAX_FLOW_LAST_ID 0x0D6f
|
||||
#define GASSUIT_AVG_FLOW_FIRST_ID 0x0D70
|
||||
#define GASSUIT_AVG_FLOW_LAST_ID 0x0D7f
|
||||
#define SBEC_POWER_FIRST_ID 0x0E50
|
||||
#define SBEC_POWER_LAST_ID 0x0E5F
|
||||
#define DIY_FIRST_ID 0x5100
|
||||
#define DIY_LAST_ID 0x52ff
|
||||
#define DIY_LAST_ID 0x52FF
|
||||
#define DIY_STREAM_FIRST_ID 0x5000
|
||||
#define DIY_STREAM_LAST_ID 0x50ff
|
||||
#define FACT_TEST_ID 0xf000
|
||||
#define RSSI_ID 0xf101
|
||||
#define ADC1_ID 0xf102
|
||||
#define ADC2_ID 0xf103
|
||||
#define BATT_ID 0xf104
|
||||
#define RAS_ID 0xf105
|
||||
#define XJT_VERSION_ID 0xf106
|
||||
#define R9_PWR_ID 0xf107
|
||||
#define SP2UART_A_ID 0xfd00
|
||||
#define SP2UART_B_ID 0xfd01
|
||||
#define FUEL_QTY_FIRST_ID 0x0a10
|
||||
#define FUEL_QTY_LAST_ID 0x0a1f
|
||||
#define DIY_STREAM_LAST_ID 0x50FF
|
||||
#define FACT_TEST_ID 0xF000
|
||||
#define RSSI_ID 0xF101
|
||||
#define ADC1_ID 0xF102
|
||||
#define ADC2_ID 0xF103
|
||||
#define BATT_ID 0xF104
|
||||
#define RAS_ID 0xF105
|
||||
#define XJT_VERSION_ID 0xF106
|
||||
#define R9_PWR_ID 0xF107
|
||||
#define SP2UART_A_ID 0xFD00
|
||||
#define SP2UART_B_ID 0xFD01
|
||||
#define FUEL_QTY_FIRST_ID 0x0A10
|
||||
#define FUEL_QTY_LAST_ID 0x0A1F
|
||||
|
||||
#if defined(MULTIMODULE)
|
||||
// Virtual IDs, value can be changed to anything only used for display
|
||||
#define RX_LQI_ID 0xFFFC
|
||||
#define TX_LQI_ID 0xFFFD
|
||||
#define TX_RSSI_ID 0xFFFE
|
||||
#endif
|
||||
|
||||
// Default sensor data IDs (Physical IDs + CRC)
|
||||
#define DATA_ID_VARIO 0x00 // 0
|
||||
@@ -234,9 +241,9 @@ inline uint8_t TELEMETRY_RSSI()
|
||||
return telemetryData.rssi.value();
|
||||
}
|
||||
|
||||
#define START_STOP 0x7E
|
||||
#define BYTESTUFF 0x7D
|
||||
#define STUFF_MASK 0x20
|
||||
constexpr uint8_t START_STOP = 0x7E;
|
||||
constexpr uint8_t BYTE_STUFF = 0x7D;
|
||||
constexpr uint8_t STUFF_MASK = 0x20;
|
||||
|
||||
typedef enum {
|
||||
TS_IDLE = 0, // waiting for 0x5e frame marker
|
||||
@@ -283,7 +290,7 @@ inline bool isRasValueValid()
|
||||
#elif defined(PCBX9DP) || defined(PCBX9E)
|
||||
inline bool isRasValueValid()
|
||||
{
|
||||
return telemetryData.xjtVersion != 0x0000 && telemetryData.xjtVersion != 0x00ff;
|
||||
return telemetryData.xjtVersion != 0x0000 && telemetryData.xjtVersion != 0x00FF;
|
||||
}
|
||||
#else
|
||||
inline bool isRasValueValid()
|
||||
|
||||
@@ -71,6 +71,13 @@ void frskyDProcessPacket(const uint8_t *packet)
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_FRSKY_D, D_A1_ID, 0, 0, packet[1], UNIT_VOLTS, 0);
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_FRSKY_D, D_A2_ID, 0, 0, packet[2], UNIT_VOLTS, 0);
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_FRSKY_D, D_RSSI_ID, 0, 0, packet[3], UNIT_RAW, 0);
|
||||
#if defined(MULTIMODULE)
|
||||
if (telemetryProtocol == PROTOCOL_TELEMETRY_MULTIMODULE) {
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_FRSKY_D, TX_RSSI_ID, 0, 0, packet[4]>>1, UNIT_DB, 0);
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_FRSKY_D, RX_LQI_ID, 0, 0, packet[5] , UNIT_RAW, 0);
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_FRSKY_D, TX_LQI_ID , 0, 0, packet[6] , UNIT_RAW, 0);
|
||||
}
|
||||
#endif
|
||||
telemetryData.rssi.set(packet[3]);
|
||||
telemetryStreaming = TELEMETRY_TIMEOUT10ms; // reset counter only if valid packets are being detected
|
||||
break;
|
||||
@@ -263,42 +270,59 @@ void processHubPacket(uint8_t id, int16_t value)
|
||||
|
||||
void frskyDSetDefault(int index, uint16_t id)
|
||||
{
|
||||
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[index];
|
||||
TelemetrySensor &telemetrySensor = g_model.telemetrySensors[index];
|
||||
|
||||
telemetrySensor.id = id;
|
||||
telemetrySensor.instance = 0;
|
||||
|
||||
const FrSkyDSensor * sensor = getFrSkyDSensor(id);
|
||||
if (sensor) {
|
||||
TelemetryUnit unit = sensor->unit;
|
||||
uint8_t prec = min<uint8_t>(2, sensor->prec);
|
||||
telemetrySensor.init(sensor->name, unit, prec);
|
||||
if (id == D_RSSI_ID) {
|
||||
telemetrySensor.filter = 1;
|
||||
telemetrySensor.logs = true;
|
||||
}
|
||||
else if (id >= D_A1_ID && id <= D_A2_ID) {
|
||||
telemetrySensor.custom.ratio = 132;
|
||||
telemetrySensor.filter = 1;
|
||||
}
|
||||
else if (id == CURRENT_ID) {
|
||||
telemetrySensor.onlyPositive = 1;
|
||||
}
|
||||
else if (id == BARO_ALT_AP_ID) {
|
||||
telemetrySensor.autoOffset = 1;
|
||||
}
|
||||
if (unit == UNIT_RPMS) {
|
||||
telemetrySensor.custom.ratio = 1;
|
||||
telemetrySensor.custom.offset = 1;
|
||||
}
|
||||
else if (unit == UNIT_METERS) {
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
telemetrySensor.unit = UNIT_FEET;
|
||||
#if defined(MULTIMODULE)
|
||||
if (id == TX_RSSI_ID) {
|
||||
telemetrySensor.init(ZSTR_TX_RSSI, UNIT_DB, 0);
|
||||
telemetrySensor.filter = 1;
|
||||
}
|
||||
else if (id == TX_LQI_ID) {
|
||||
telemetrySensor.init(ZSTR_TX_QUALITY, UNIT_RAW, 0);
|
||||
telemetrySensor.filter = 1;
|
||||
}
|
||||
else if (id == RX_LQI_ID) {
|
||||
telemetrySensor.init(ZSTR_RX_QUALITY, UNIT_RAW, 0);
|
||||
telemetrySensor.filter = 1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
const FrSkyDSensor * sensor = getFrSkyDSensor(id);
|
||||
if (sensor) {
|
||||
TelemetryUnit unit = sensor->unit;
|
||||
uint8_t prec = min<uint8_t>(2, sensor->prec);
|
||||
telemetrySensor.init(sensor->name, unit, prec);
|
||||
if (id == D_RSSI_ID) {
|
||||
telemetrySensor.filter = 1;
|
||||
telemetrySensor.logs = true;
|
||||
}
|
||||
else if (id >= D_A1_ID && id <= D_A2_ID) {
|
||||
telemetrySensor.custom.ratio = 132;
|
||||
telemetrySensor.filter = 1;
|
||||
}
|
||||
else if (id == CURRENT_ID) {
|
||||
telemetrySensor.onlyPositive = 1;
|
||||
}
|
||||
else if (id == BARO_ALT_AP_ID) {
|
||||
telemetrySensor.autoOffset = 1;
|
||||
}
|
||||
if (unit == UNIT_RPMS) {
|
||||
telemetrySensor.custom.ratio = 1;
|
||||
telemetrySensor.custom.offset = 1;
|
||||
}
|
||||
else if (unit == UNIT_METERS) {
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
telemetrySensor.unit = UNIT_FEET;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
telemetrySensor.init(id);
|
||||
else {
|
||||
telemetrySensor.init(id);
|
||||
}
|
||||
}
|
||||
|
||||
storageDirty(EE_MODEL);
|
||||
|
||||
@@ -20,31 +20,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
class Pxx2Telemetry
|
||||
{
|
||||
protected:
|
||||
static void processGetHardwareInfoFrame(uint8_t module, uint8_t *frame);
|
||||
|
||||
static void processReceiverSettingsFrame(uint8_t module, uint8_t *frame);
|
||||
|
||||
static void processRegisterFrame(uint8_t module, uint8_t * frame);
|
||||
|
||||
static void processBindFrame(uint8_t module, uint8_t * frame);
|
||||
|
||||
static void processTelemetryFrame(uint8_t module, uint8_t * frame);
|
||||
|
||||
static void processSpectrumFrame(uint8_t module, uint8_t * frame);
|
||||
|
||||
static void processRadioFrame(uint8_t module, uint8_t * frame);
|
||||
|
||||
static void processPowerMeterFrame(uint8_t module, uint8_t * frame);
|
||||
|
||||
static void processAuthenticationFrame(uint8_t module, uint8_t * frame);
|
||||
|
||||
public:
|
||||
};
|
||||
|
||||
void processGetHardwareInfoFrame(uint8_t module, uint8_t * frame)
|
||||
void processGetHardwareInfoFrame(uint8_t module, const uint8_t * frame)
|
||||
{
|
||||
if (moduleState[module].mode != MODULE_MODE_GET_HARDWARE_INFO) {
|
||||
return;
|
||||
@@ -59,6 +35,11 @@ void processGetHardwareInfoFrame(uint8_t module, uint8_t * frame)
|
||||
memcpy(&destination->information, &frame[4], length);
|
||||
if (destination->information.capabilities & ~((1 << MODULE_CAPABILITY_COUNT) - 1))
|
||||
destination->information.capabilityNotSupported = true;
|
||||
if (!globalData.upgradeModulePopup && destination->information.modelID == PXX2_MODULE_ISRM_S_X10S &&
|
||||
destination->information.swVersion.major == 0 && destination->information.swVersion.minor == 1 && destination->information.swVersion.revision < 5) {
|
||||
globalData.upgradeModulePopup = 1;
|
||||
POPUP_WARNING(STR_MODULE_UPGRADE_ALERT);
|
||||
}
|
||||
}
|
||||
else if (index < PXX2_MAX_RECEIVERS_PER_MODULE && modelId < DIM(PXX2ReceiversNames)) {
|
||||
memcpy(&destination->receivers[index].information, &frame[4], length);
|
||||
@@ -68,7 +49,7 @@ void processGetHardwareInfoFrame(uint8_t module, uint8_t * frame)
|
||||
}
|
||||
}
|
||||
|
||||
void processModuleSettingsFrame(uint8_t module, uint8_t * frame)
|
||||
void processModuleSettingsFrame(uint8_t module, const uint8_t * frame)
|
||||
{
|
||||
if (moduleState[module].mode != MODULE_MODE_MODULE_SETTINGS) {
|
||||
return;
|
||||
@@ -88,7 +69,7 @@ void processModuleSettingsFrame(uint8_t module, uint8_t * frame)
|
||||
moduleState[module].mode = MODULE_MODE_NORMAL;
|
||||
}
|
||||
|
||||
void processReceiverSettingsFrame(uint8_t module, uint8_t * frame)
|
||||
void processReceiverSettingsFrame(uint8_t module, const uint8_t * frame)
|
||||
{
|
||||
if (moduleState[module].mode != MODULE_MODE_RECEIVER_SETTINGS) {
|
||||
return;
|
||||
@@ -116,7 +97,7 @@ void processReceiverSettingsFrame(uint8_t module, uint8_t * frame)
|
||||
moduleState[module].mode = MODULE_MODE_NORMAL;
|
||||
}
|
||||
|
||||
void processRegisterFrame(uint8_t module, uint8_t * frame)
|
||||
void processRegisterFrame(uint8_t module, const uint8_t * frame)
|
||||
{
|
||||
if (moduleState[module].mode != MODULE_MODE_REGISTER) {
|
||||
return;
|
||||
@@ -151,7 +132,7 @@ void processRegisterFrame(uint8_t module, uint8_t * frame)
|
||||
}
|
||||
}
|
||||
|
||||
void processBindFrame(uint8_t module, uint8_t * frame)
|
||||
void processBindFrame(uint8_t module, const uint8_t * frame)
|
||||
{
|
||||
if (moduleState[module].mode != MODULE_MODE_BIND) {
|
||||
return;
|
||||
@@ -202,7 +183,7 @@ void processBindFrame(uint8_t module, uint8_t * frame)
|
||||
}
|
||||
}
|
||||
|
||||
void processResetFrame(uint8_t module, uint8_t * frame)
|
||||
void processResetFrame(uint8_t module, const uint8_t * frame)
|
||||
{
|
||||
if (moduleState[module].mode != MODULE_MODE_RESET) {
|
||||
return;
|
||||
@@ -215,7 +196,7 @@ void processResetFrame(uint8_t module, uint8_t * frame)
|
||||
moduleState[module].mode = MODULE_MODE_NORMAL;
|
||||
}
|
||||
|
||||
void processTelemetryFrame(uint8_t module, uint8_t * frame)
|
||||
void processTelemetryFrame(uint8_t module, const uint8_t * frame)
|
||||
{
|
||||
uint8_t origin = (module << 2) + (frame[3] & 0x03);
|
||||
if (origin != TELEMETRY_ENDPOINT_SPORT) {
|
||||
@@ -224,13 +205,16 @@ void processTelemetryFrame(uint8_t module, uint8_t * frame)
|
||||
}
|
||||
|
||||
#if defined(ACCESS_LIB) && !defined(SIMU)
|
||||
void processAuthenticationFrame(uint8_t module, uint8_t * frame)
|
||||
void processAuthenticationFrame(uint8_t module, const uint8_t * frame)
|
||||
{
|
||||
uint8_t cryptoType = frame[3];
|
||||
uint8_t messageDigest[16] = {0};
|
||||
|
||||
if (frame[0] == 4 && PXX2_AUTH_REFUSED_FLAG == frame[4]) {
|
||||
POPUP_INFORMATION(STR_AUTH_FAILURE);
|
||||
if (!globalData.upgradeModulePopup) {
|
||||
globalData.upgradeModulePopup = 1;
|
||||
POPUP_INFORMATION(STR_AUTH_FAILURE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -241,12 +225,22 @@ void processAuthenticationFrame(uint8_t module, uint8_t * frame)
|
||||
intmoduleSendBuffer(pxx2.getData(), pxx2.getSize());
|
||||
// we remain in AUTHENTICATION mode to avoid a CHANNELS frame is sent at the end of the mixing process
|
||||
}
|
||||
|
||||
if (!globalData.upgradeModulePopup) {
|
||||
if (globalData.authenticationCount >= 2) {
|
||||
globalData.upgradeModulePopup = 1;
|
||||
POPUP_WARNING(STR_MODULE_UPGRADE_ALERT);
|
||||
}
|
||||
else {
|
||||
globalData.authenticationCount += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define processAuthenticationFrame(module, frame)
|
||||
#endif
|
||||
|
||||
void processSpectrumAnalyserFrame(uint8_t module, uint8_t * frame)
|
||||
void processSpectrumAnalyserFrame(uint8_t module, const uint8_t * frame)
|
||||
{
|
||||
if (moduleState[module].mode != MODULE_MODE_SPECTRUM_ANALYSER) {
|
||||
return;
|
||||
@@ -273,7 +267,7 @@ void processSpectrumAnalyserFrame(uint8_t module, uint8_t * frame)
|
||||
}
|
||||
}
|
||||
|
||||
void processPowerMeterFrame(uint8_t module, uint8_t * frame)
|
||||
void processPowerMeterFrame(uint8_t module, const uint8_t * frame)
|
||||
{
|
||||
if (moduleState[module].mode != MODULE_MODE_POWER_METER) {
|
||||
return;
|
||||
@@ -285,7 +279,7 @@ void processPowerMeterFrame(uint8_t module, uint8_t * frame)
|
||||
}
|
||||
}
|
||||
|
||||
void processOtaUpdateFrame(uint8_t module, uint8_t * frame)
|
||||
void processOtaUpdateFrame(uint8_t module, const uint8_t * frame)
|
||||
{
|
||||
if (moduleState[module].mode != MODULE_MODE_OTA_UPDATE) {
|
||||
return;
|
||||
@@ -311,7 +305,7 @@ void processOtaUpdateFrame(uint8_t module, uint8_t * frame)
|
||||
}
|
||||
}
|
||||
|
||||
void processModuleFrame(uint8_t module, uint8_t *frame)
|
||||
void processModuleFrame(uint8_t module, const uint8_t *frame)
|
||||
{
|
||||
switch (frame[2]) {
|
||||
case PXX2_TYPE_ID_HW_INFO:
|
||||
@@ -348,7 +342,7 @@ void processModuleFrame(uint8_t module, uint8_t *frame)
|
||||
}
|
||||
}
|
||||
|
||||
void processToolsFrame(uint8_t module, uint8_t * frame)
|
||||
void processToolsFrame(uint8_t module, const uint8_t * frame)
|
||||
{
|
||||
switch (frame[2]) {
|
||||
case PXX2_TYPE_ID_POWER_METER:
|
||||
@@ -361,8 +355,13 @@ void processToolsFrame(uint8_t module, uint8_t * frame)
|
||||
}
|
||||
}
|
||||
|
||||
void processPXX2Frame(uint8_t module, uint8_t *frame)
|
||||
void processPXX2Frame(uint8_t module, const uint8_t * frame)
|
||||
{
|
||||
LOG_TELEMETRY_WRITE_START();
|
||||
for (uint8_t i = 0; i < 1 + frame[0]; i++) {
|
||||
LOG_TELEMETRY_WRITE_BYTE(frame[i]);
|
||||
}
|
||||
|
||||
switch (frame[1]) {
|
||||
case PXX2_TYPE_C_MODULE:
|
||||
processModuleFrame(module, frame);
|
||||
|
||||
@@ -31,6 +31,10 @@ struct FrSkySportSensor {
|
||||
|
||||
const FrSkySportSensor sportSensors[] = {
|
||||
{ RSSI_ID, RSSI_ID, 0, ZSTR_RSSI, UNIT_DB, 0 },
|
||||
#if defined(MULTIMODULE)
|
||||
{ TX_RSSI_ID, TX_RSSI_ID, 0, ZSTR_TX_RSSI , UNIT_DB , 0 },
|
||||
{ TX_LQI_ID , TX_LQI_ID, 0, ZSTR_TX_QUALITY, UNIT_RAW, 0 },
|
||||
#endif
|
||||
{ ADC1_ID, ADC1_ID, 0, ZSTR_A1, UNIT_VOLTS, 1 },
|
||||
{ ADC2_ID, ADC2_ID, 0, ZSTR_A2, UNIT_VOLTS, 1 },
|
||||
{ A3_FIRST_ID, A3_LAST_ID, 0, ZSTR_A3, UNIT_VOLTS, 2 },
|
||||
@@ -192,6 +196,12 @@ void sportProcessTelemetryPacketWithoutCrc(uint8_t origin, const uint8_t * packe
|
||||
else {
|
||||
telemetryData.rssi.set(data);
|
||||
}
|
||||
#if defined(MULTIMODULE)
|
||||
if (telemetryProtocol == PROTOCOL_TELEMETRY_MULTIMODULE) {
|
||||
sportProcessTelemetryPacket(TX_RSSI_ID, 0, instance, packet[5] >> 1, UNIT_DB);
|
||||
sportProcessTelemetryPacket(TX_LQI_ID, 0, instance, packet[7], UNIT_RAW);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (dataId == R9_PWR_ID) {
|
||||
uint32_t r9pwr[] = {100, 200, 500, 1000};
|
||||
|
||||
@@ -150,8 +150,8 @@ enum
|
||||
HITEC_ID_AIR_SPEED = 0x1A02, // Air speed
|
||||
HITEC_ID_VARIO = 0x1B00, // Vario
|
||||
HITEC_ID_ALT = 0x1B02, // Vario
|
||||
TX_RSSI_ID = 0xFF00, // Pseudo id outside 1 byte range of Hitec sensors
|
||||
TX_LQI_ID = 0xFF01, // Pseudo id outside 1 byte range of Hitec sensors
|
||||
HITEC_ID_TX_RSSI = 0xFF00, // Pseudo id outside 1 byte range of Hitec sensors
|
||||
HITEC_ID_TX_LQI = 0xFF01, // Pseudo id outside 1 byte range of Hitec sensors
|
||||
};
|
||||
|
||||
const HitecSensor hitecSensors[] = {
|
||||
@@ -193,8 +193,8 @@ const HitecSensor hitecSensors[] = {
|
||||
{HITEC_ID_VARIO, ZSTR_VSPD, UNIT_METERS_PER_SECOND, 1}, // Vario
|
||||
{HITEC_ID_ALT, ZSTR_ALT, UNIT_METERS, 1}, // Altitude
|
||||
|
||||
{TX_RSSI_ID, ZSTR_TX_RSSI, UNIT_RAW, 0}, // Pseudo id outside 1 byte range of Hitec sensors
|
||||
{TX_LQI_ID, ZSTR_TX_QUALITY, UNIT_RAW, 0}, // Pseudo id outside 1 byte range of Hitec sensors// Pseudo sensor for TLQI
|
||||
{HITEC_ID_TX_RSSI, ZSTR_TX_RSSI, UNIT_RAW, 0}, // Pseudo id outside 1 byte range of Hitec sensors
|
||||
{HITEC_ID_TX_LQI, ZSTR_TX_QUALITY, UNIT_RAW, 0}, // Pseudo id outside 1 byte range of Hitec sensors// Pseudo sensor for TLQI
|
||||
{0x00, NULL, UNIT_RAW, 0}, // sentinel
|
||||
};
|
||||
|
||||
@@ -212,12 +212,12 @@ void processHitecPacket(const uint8_t * packet)
|
||||
static uint16_t rssi = 0, lqi = 0;
|
||||
// Set TX RSSI Value, reverse MULTIs scaling
|
||||
rssi = ((packet[0] * 10) + (rssi * 90)) / 100; // quick filtering
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_HITEC, TX_RSSI_ID, 0, 0, rssi >> 1, UNIT_RAW, 0);
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_HITEC, HITEC_ID_TX_RSSI, 0, 0, rssi >> 1, UNIT_RAW, 0);
|
||||
telemetryData.rssi.set(rssi >> 1);
|
||||
if (packet[0] > 0) telemetryStreaming = TELEMETRY_TIMEOUT10ms;
|
||||
// Set TX LQI Value, reverse MULTIs scaling
|
||||
lqi = ((packet[1] * 10) + (lqi * 90)) / 100; // quick filtering
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_HITEC, TX_LQI_ID, 0, 0, lqi, UNIT_RAW, 0);
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_HITEC, HITEC_ID_TX_LQI, 0, 0, lqi, UNIT_RAW, 0);
|
||||
|
||||
const HitecSensor * sensor;
|
||||
int32_t value, deg, min, sec, alt, amp;
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
/* Telemetry
|
||||
packet[0] = TX RSSI value
|
||||
packet[1] = TX LQI value
|
||||
packet[2] = frame number
|
||||
packet[3-12] telemetry data
|
||||
|
||||
The frame number takes the following values: 0x00, 0x01, 0x02, 0x03 and 0x04. The frames can be present or not, they also do not have to follow each others.
|
||||
Here is a description of the telemetry data for each frame number:
|
||||
- frame 0x00
|
||||
[3] = [12] = ??
|
||||
[4] = RX_Voltage*10 in V
|
||||
[5] = Temperature-20 in °C
|
||||
[6] = RX_RSSI
|
||||
[7] = RX_LQI ??
|
||||
[8] = RX_STR ??
|
||||
[9,10] = [10]*256+[9]=max lost packet time in ms, max value seems 2s=0x7D0
|
||||
[11] = 0x00 ??
|
||||
- frame 0x01 Unknown
|
||||
- frame 0x02 Unknown
|
||||
- frame 0x03 Unknown
|
||||
- frame 0x04 Unknown
|
||||
*/
|
||||
|
||||
struct HottSensor
|
||||
{
|
||||
const uint16_t id;
|
||||
const char * name;
|
||||
const TelemetryUnit unit;
|
||||
const uint8_t precision;
|
||||
};
|
||||
|
||||
// telemetry frames
|
||||
enum
|
||||
{
|
||||
HOTT_FRAME_00 = 0x00,
|
||||
HOTT_FRAME_01 = 0x01,
|
||||
HOTT_FRAME_02 = 0x02,
|
||||
HOTT_FRAME_03 = 0x03,
|
||||
HOTT_FRAME_04 = 0x04,
|
||||
};
|
||||
|
||||
#define HOTT_TELEM_NORMAL 0x00
|
||||
#define HOTT_TELEM_BIND 0x40
|
||||
#define HOTT_TELEM_MENU 0x80
|
||||
|
||||
// telemetry sensors ID
|
||||
enum
|
||||
{
|
||||
HOTT_ID_RX_VOLTAGE = 0x0004, // RX_Batt Voltage
|
||||
HOTT_ID_TEMP1 = 0x0005, // RX Temperature sensor
|
||||
HOTT_TX_RSSI_ID = 0xFF00, // Pseudo id outside 1 byte range of Hott sensors
|
||||
HOTT_TX_LQI_ID = 0xFF01, // Pseudo id outside 1 byte range of Hott sensors
|
||||
HOTT_RX_RSSI_ID = 0xFF02, // Pseudo id outside 1 byte range of Hott sensors
|
||||
HOTT_RX_LQI_ID = 0xFF03, // Pseudo id outside 1 byte range of Hott sensors
|
||||
};
|
||||
|
||||
const HottSensor hottSensors[] = {
|
||||
//frame 00
|
||||
{HOTT_ID_RX_VOLTAGE, ZSTR_BATT, UNIT_VOLTS, 1}, // RX_Batt Voltage
|
||||
{HOTT_ID_TEMP1, ZSTR_TEMP1, UNIT_CELSIUS, 0}, // RX Temperature sensor
|
||||
//frame 01
|
||||
//frame 02
|
||||
//frame 03
|
||||
//frame 04
|
||||
{HOTT_TX_RSSI_ID, ZSTR_TX_RSSI, UNIT_RAW, 0}, // Pseudo id outside 1 byte range of Hott sensors
|
||||
{HOTT_TX_LQI_ID, ZSTR_TX_QUALITY, UNIT_RAW, 0}, // Pseudo id outside 1 byte range of Hott sensors
|
||||
{HOTT_RX_RSSI_ID, ZSTR_RSSI, UNIT_DB, 0}, // RX RSSI
|
||||
{HOTT_RX_LQI_ID, ZSTR_RX_QUALITY, UNIT_RAW, 0}, // RX LQI
|
||||
{0x00, NULL, UNIT_RAW, 0}, // sentinel
|
||||
};
|
||||
|
||||
const HottSensor * getHottSensor(uint16_t id)
|
||||
{
|
||||
for (const HottSensor * sensor = hottSensors; sensor->id; sensor++) {
|
||||
if (id == sensor->id)
|
||||
return sensor;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void processHottPacket(const uint8_t * packet)
|
||||
{
|
||||
// Set TX RSSI Value
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_HOTT, HOTT_TX_RSSI_ID, 0, 0, packet[0]>>1, UNIT_RAW, 0);
|
||||
// Set TX LQI Value
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_HOTT, HOTT_TX_LQI_ID, 0, 0, packet[1], UNIT_RAW, 0);
|
||||
|
||||
#if defined(LUA)
|
||||
#define HOTT_MENU_NBR_PAGE 0x13
|
||||
// Config menu consists of the different telem pages put all together
|
||||
// [3] = config mennu page 0x00 to 0x12.
|
||||
// Page X [4] = seems like all the telem pages with the same value are going together to make the full config menu text. Seen so far 'a', 'b', 'c', 'd'
|
||||
// Page X [5..13] = 9 ascii chars to be displayed, char is highlighted when ascii|0x80
|
||||
// Screen display is 21 characters large which means that once the first 21 chars are filled go to the begining of the next line
|
||||
// Menu commands are sent through TX packets:
|
||||
// packet[28]= 0xXF=>no key press, 0xXD=>down, 0xXB=>up, 0xX9=>enter, 0xXE=>right, 0xX7=>left with X=0 or D
|
||||
// packet[29]= 0xX1/0xX9 with X=0 or X counting 0,1,1,2,2,..,9,9
|
||||
if (Multi_Buffer && memcmp(Multi_Buffer, "HoTT", 4) == 0) {
|
||||
// HoTT Lua script is running
|
||||
if (Multi_Buffer[4] == 0xFF) {
|
||||
// Init
|
||||
memset(&Multi_Buffer[6], ' ', HOTT_MENU_NBR_PAGE * 9); // Clear text buffer
|
||||
}
|
||||
|
||||
if (packet[3] < HOTT_MENU_NBR_PAGE && Multi_Buffer[5] >= 0xD7 && Multi_Buffer[5] <= 0xDF) {
|
||||
Multi_Buffer[4] = packet[4]; // Store current menu being received
|
||||
memcpy(&Multi_Buffer[6 + packet[3] * 9], &packet[5], 9); // Store the received page in the buffer
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
const HottSensor * sensor;
|
||||
int32_t value;
|
||||
|
||||
if (packet[2] == HOTT_TELEM_NORMAL) {
|
||||
switch (packet[3]) {
|
||||
case HOTT_FRAME_00:
|
||||
// RX_VOLT
|
||||
value = packet[5];
|
||||
sensor = getHottSensor(HOTT_ID_RX_VOLTAGE);
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_HOTT, HOTT_ID_RX_VOLTAGE, 0, 0, value, sensor->unit, sensor->precision);
|
||||
// RX_TEMP
|
||||
value = packet[6] - 20;
|
||||
sensor = getHottSensor(HOTT_ID_TEMP1);
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_HOTT, HOTT_ID_TEMP1, 0, 0, value, sensor->unit, sensor->precision);
|
||||
// RX_RSSI
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_HOTT, HOTT_RX_RSSI_ID, 0, 0, packet[7], UNIT_DB, 0);
|
||||
// RX_LQI
|
||||
telemetryData.rssi.set(packet[8]);
|
||||
if (packet[8] > 0)
|
||||
telemetryStreaming = TELEMETRY_TIMEOUT10ms;
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_HOTT, HOTT_RX_LQI_ID, 0, 0, packet[8], UNIT_RAW, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
// unknown
|
||||
value = (packet[7] << 24) | (packet[6] << 16) | (packet[5] << 8) | packet[4];
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_HOTT, 0xFE00 | packet[3], 0, 0, value, UNIT_RAW, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void hottSetDefault(int index, uint16_t id, uint8_t subId, uint8_t instance)
|
||||
{
|
||||
TelemetrySensor &telemetrySensor = g_model.telemetrySensors[index];
|
||||
telemetrySensor.id = id;
|
||||
telemetrySensor.subId = subId;
|
||||
telemetrySensor.instance = instance;
|
||||
|
||||
const HottSensor * sensor = getHottSensor(id);
|
||||
if (sensor) {
|
||||
TelemetryUnit unit = sensor->unit;
|
||||
uint8_t prec = min<uint8_t>(2, sensor->precision);
|
||||
telemetrySensor.init(sensor->name, unit, prec);
|
||||
if (unit == UNIT_RPMS) {
|
||||
telemetrySensor.custom.ratio = 1;
|
||||
telemetrySensor.custom.offset = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
telemetrySensor.init(id);
|
||||
}
|
||||
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _HOTT_H
|
||||
#define _HOTT_H
|
||||
|
||||
void hottSetDefault(int index, uint16_t id, uint8_t subId, uint8_t instance);
|
||||
|
||||
// Used by multi protocol
|
||||
void processHottPacket(const uint8_t * packet);
|
||||
|
||||
#endif
|
||||
+114
-67
@@ -39,7 +39,8 @@ enum MultiPacketTypes : uint8_t
|
||||
HitecTelemetry,
|
||||
SpectrumScannerPacket,
|
||||
FlyskyIBusTelemetryAC,
|
||||
MultiRxChannels
|
||||
MultiRxChannels,
|
||||
HottTelemetry,
|
||||
};
|
||||
|
||||
enum MultiBufferState : uint8_t
|
||||
@@ -65,6 +66,7 @@ static MultiModuleSyncStatus multiSyncStatus[NUM_MODULES] = {MultiModuleSyncStat
|
||||
static uint8_t multiBindStatus[NUM_MODULES] = {MULTI_NORMAL_OPERATION, MULTI_NORMAL_OPERATION};
|
||||
|
||||
static MultiBufferState multiTelemetryBufferState[NUM_MODULES];
|
||||
static uint16_t multiTelemetryLastRxTS[NUM_MODULES];
|
||||
|
||||
MultiModuleStatus &getMultiModuleStatus(uint8_t module)
|
||||
{
|
||||
@@ -96,6 +98,11 @@ void setMultiTelemetryBufferState(uint8_t module, MultiBufferState state)
|
||||
multiTelemetryBufferState[module] = state;
|
||||
}
|
||||
|
||||
static uint16_t& getMultiTelemetryLastRxTS(uint8_t module)
|
||||
{
|
||||
return multiTelemetryLastRxTS[module];
|
||||
}
|
||||
|
||||
// Use additional telemetry buffer
|
||||
uint8_t intTelemetryRxBuffer[TELEMETRY_RX_PACKET_SIZE];
|
||||
uint8_t intTelemetryRxBufferCount;
|
||||
@@ -107,6 +114,7 @@ static MultiModuleSyncStatus multiSyncStatus;
|
||||
static uint8_t multiBindStatus = MULTI_NORMAL_OPERATION;
|
||||
|
||||
static MultiBufferState multiTelemetryBufferState;
|
||||
static uint16_t multiTelemetryLastRxTS;
|
||||
|
||||
MultiModuleStatus& getMultiModuleStatus(uint8_t)
|
||||
{
|
||||
@@ -138,6 +146,11 @@ void setMultiTelemetryBufferState(uint8_t, MultiBufferState state)
|
||||
multiTelemetryBufferState = state;
|
||||
}
|
||||
|
||||
uint16_t& getMultiTelemetryLastRxTS(uint8_t module)
|
||||
{
|
||||
return multiTelemetryLastRxTS;
|
||||
}
|
||||
|
||||
#endif // INTERNAL_MODULE_MULTI
|
||||
|
||||
|
||||
@@ -150,9 +163,9 @@ static MultiBufferState guessProtocol(uint8_t module)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_model.moduleData[moduleIdx].getMultiProtocol(false) == MODULE_SUBTYPE_MULTI_DSM2)
|
||||
if (g_model.moduleData[moduleIdx].getMultiProtocol() == MODULE_SUBTYPE_MULTI_DSM2)
|
||||
return SpektrumTelemetryFallback;
|
||||
else if (g_model.moduleData[module].getMultiProtocol(false) == MODULE_SUBTYPE_MULTI_FS_AFHDS2A)
|
||||
else if (g_model.moduleData[module].getMultiProtocol() == MODULE_SUBTYPE_MULTI_FS_AFHDS2A)
|
||||
return FlyskyTelemetryFallback;
|
||||
else
|
||||
return FrskyTelemetryFallback;
|
||||
@@ -196,20 +209,38 @@ static void processMultiScannerPacket(const uint8_t *data)
|
||||
}
|
||||
}
|
||||
|
||||
static void processMultiStatusPacket(const uint8_t * data, uint8_t module)
|
||||
static void processMultiStatusPacket(const uint8_t * data, uint8_t module, uint8_t len)
|
||||
{
|
||||
MultiModuleStatus &status = getMultiModuleStatus(module);
|
||||
|
||||
// At least two status packets without bind flag
|
||||
bool wasBinding = status.isBinding();
|
||||
|
||||
status.lastUpdate = get_tmr10ms();
|
||||
status.flags = data[0];
|
||||
status.major = data[1];
|
||||
status.minor = data[2];
|
||||
status.revision = data[3];
|
||||
status.patch = data[4];
|
||||
status.lastUpdate = get_tmr10ms();
|
||||
|
||||
if (len < 6) {
|
||||
status.ch_order = 0xFF;
|
||||
}
|
||||
else {
|
||||
status.ch_order = data[5];
|
||||
if (len >= 24) {
|
||||
status.protocolNext = data[6];
|
||||
status.protocolPrev = data[7];
|
||||
memcpy(status.protocolName, &data[8], 7);
|
||||
status.protocolName[7] = 0;
|
||||
status.protocolSubNbr = data[15] & 0x0F;
|
||||
memcpy(status.protocolSubName, &data[16], 8);
|
||||
status.protocolSubName[8] = 0;
|
||||
status.optionDisp = data[15] >> 4;
|
||||
}
|
||||
else {
|
||||
status.protocolName[0] = 0;
|
||||
}
|
||||
}
|
||||
if (getMultiModuleStatus(module).requiresFailsafeCheck) {
|
||||
getMultiModuleStatus(module).requiresFailsafeCheck = false;
|
||||
if (getMultiModuleStatus(module).supportsFailsafe() && g_model.moduleData[module].failsafeMode == FAILSAFE_NOT_SET)
|
||||
@@ -289,7 +320,7 @@ static void processMultiTelemetryPaket(const uint8_t * packet, uint8_t module)
|
||||
switch (type) {
|
||||
case MultiStatus:
|
||||
if (len >= 5)
|
||||
processMultiStatusPacket(data, module);
|
||||
processMultiStatusPacket(data, module, len);
|
||||
break;
|
||||
|
||||
case DSMBindPacket:
|
||||
@@ -327,6 +358,13 @@ static void processMultiTelemetryPaket(const uint8_t * packet, uint8_t module)
|
||||
TRACE("[MP] Received Hitec telemetry len %d < 8", len);
|
||||
break;
|
||||
|
||||
case HottTelemetry:
|
||||
if (len >= 14)
|
||||
processHottPacket(data);
|
||||
else
|
||||
TRACE("[MP] Received HoTT telemetry len %d < 14", len);
|
||||
break;
|
||||
|
||||
case FrSkyHubTelemetry:
|
||||
if (len >= 4)
|
||||
frskyDProcessPacket(data);
|
||||
@@ -382,17 +420,7 @@ static void processMultiTelemetryPaket(const uint8_t * packet, uint8_t module)
|
||||
}
|
||||
}
|
||||
|
||||
// sprintf does not work AVR ARM
|
||||
// use a small helper function
|
||||
static void appendInt(char * buf, uint32_t val)
|
||||
{
|
||||
while (*buf)
|
||||
buf++;
|
||||
|
||||
strAppendUnsigned(buf, val);
|
||||
}
|
||||
|
||||
#define MIN_REFRESH_RATE 7000
|
||||
#define MIN_REFRESH_RATE 5500
|
||||
|
||||
void MultiModuleSyncStatus::calcAdjustedRefreshRate(uint16_t newRefreshRate, uint16_t newInputLag)
|
||||
{
|
||||
@@ -444,8 +472,8 @@ void MultiModuleSyncStatus::calcAdjustedRefreshRate(uint16_t newRefreshRate, uin
|
||||
adjustedRefreshRate = (adjustedRefreshRate + perframeps);
|
||||
|
||||
// Safeguards
|
||||
if (adjustedRefreshRate < 6 * 1000 * 1000)
|
||||
adjustedRefreshRate = 6 * 1000 * 1000;
|
||||
if (adjustedRefreshRate < MIN_REFRESH_RATE * 1000)
|
||||
adjustedRefreshRate = MIN_REFRESH_RATE * 1000;
|
||||
if (adjustedRefreshRate > 30 * 1000 * 1000)
|
||||
adjustedRefreshRate = 30 * 1000 * 1000;
|
||||
|
||||
@@ -454,12 +482,11 @@ void MultiModuleSyncStatus::calcAdjustedRefreshRate(uint16_t newRefreshRate, uin
|
||||
|
||||
static uint8_t counter;
|
||||
|
||||
uint16_t MultiModuleSyncStatus::getAdjustedRefreshRate()
|
||||
const uint16_t MultiModuleSyncStatus::getAdjustedRefreshRate()
|
||||
{
|
||||
if (!isValid() || refreshRate == 0)
|
||||
return 18000;
|
||||
|
||||
|
||||
counter = (uint8_t) (counter + 1 % 10);
|
||||
uint16_t rate = (uint16_t) ((adjustedRefreshRate + counter * 50) / 500);
|
||||
// Check how far off we are from our target, positive means we are too slow, negative we are too fast
|
||||
@@ -471,37 +498,27 @@ uint16_t MultiModuleSyncStatus::getAdjustedRefreshRate()
|
||||
return rate;
|
||||
}
|
||||
|
||||
|
||||
static void prependSpaces(char * buf, int val)
|
||||
{
|
||||
while (*buf)
|
||||
buf++;
|
||||
|
||||
int k = 10000;
|
||||
while (val / k == 0 && k > 0) {
|
||||
*buf = ' ';
|
||||
buf++;
|
||||
k /= 10;
|
||||
}
|
||||
*buf = '\0';
|
||||
}
|
||||
|
||||
void MultiModuleSyncStatus::getRefreshString(char * statusText)
|
||||
{
|
||||
if (!isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy(statusText, "L ");
|
||||
prependSpaces(statusText, inputLag);
|
||||
appendInt(statusText, inputLag);
|
||||
strcat(statusText, "ns R ");
|
||||
prependSpaces(statusText, adjustedRefreshRate / 1000);
|
||||
appendInt(statusText, (uint32_t) (adjustedRefreshRate / 1000));
|
||||
strcat(statusText, "ns");
|
||||
char * tmp = statusText;
|
||||
#if defined(DEBUG)
|
||||
*tmp++ = 'L';
|
||||
tmp = strAppendUnsigned(tmp, inputLag, 5);
|
||||
tmp = strAppend(tmp, "us R ");
|
||||
tmp = strAppendUnsigned(tmp, (uint32_t) (adjustedRefreshRate / 1000), 5);
|
||||
tmp = strAppend(tmp, "us");
|
||||
#else
|
||||
tmp = strAppend(tmp, "Sync at ");
|
||||
tmp = strAppendUnsigned(tmp, (uint32_t) (adjustedRefreshRate / 1000000));
|
||||
tmp = strAppend(tmp, " ms");
|
||||
#endif
|
||||
}
|
||||
|
||||
void MultiModuleStatus::getStatusString(char * statusText)
|
||||
void MultiModuleStatus::getStatusString(char * statusText) const
|
||||
{
|
||||
if (!isValid()) {
|
||||
#if defined(PCBFRSKY)
|
||||
@@ -531,19 +548,36 @@ void MultiModuleStatus::getStatusString(char * statusText)
|
||||
return;
|
||||
}
|
||||
|
||||
if (major == 1 && minor < 3 && SLOW_BLINK_ON_PHASE) {
|
||||
strcpy(statusText, STR_MODULE_UPGRADE);
|
||||
}
|
||||
else {
|
||||
char * tmp = statusText;
|
||||
*tmp++ = 'V';
|
||||
tmp = strAppendUnsigned(tmp, major);
|
||||
*tmp++ = '.';
|
||||
tmp = strAppendUnsigned(tmp, minor);
|
||||
*tmp++ = '.';
|
||||
tmp = strAppendUnsigned(tmp, revision);
|
||||
*tmp++ = '.';
|
||||
tmp = strAppendUnsigned(tmp, patch);
|
||||
|
||||
strcpy(statusText, "V");
|
||||
appendInt(statusText, major);
|
||||
strcat(statusText, ".");
|
||||
appendInt(statusText, minor);
|
||||
strcat(statusText, ".");
|
||||
appendInt(statusText, revision);
|
||||
strcat(statusText, ".");
|
||||
appendInt(statusText, patch);
|
||||
strcat(statusText, " ");
|
||||
|
||||
if (isBinding())
|
||||
strcat(statusText, STR_MODULE_BINDING);
|
||||
if (isBinding()) {
|
||||
strcpy(tmp, " " TR_MODULE_BINDING);
|
||||
}
|
||||
else if (ch_order != 0xFF) {
|
||||
uint8_t temp = ch_order;
|
||||
*tmp++ = ' ';
|
||||
*(tmp + (temp & 0x03)) = 'A';
|
||||
temp >>= 2;
|
||||
*(tmp + (temp & 0x03)) = 'E';
|
||||
temp >>= 2;
|
||||
*(tmp + (temp & 0x03)) = 'T';
|
||||
temp >>= 2;
|
||||
*(tmp + (temp & 0x03)) = 'R';
|
||||
*(tmp + 4) = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t * getRxBuffer(uint8_t moduleIdx)
|
||||
@@ -600,7 +634,14 @@ void processMultiTelemetryData(uint8_t data, uint8_t module)
|
||||
uint8_t * rxBuffer = getRxBuffer(module);
|
||||
uint8_t &rxBufferCount = getRxBufferCount(module);
|
||||
|
||||
//debugPrintf("State: %d, byte received %02X, buflen: %d\r\n", multiTelemetryBufferState, data, rxBufferCount);
|
||||
uint16_t &lastRxTS = getMultiTelemetryLastRxTS(module);
|
||||
uint16_t nowMs = (uint16_t)RTOS_GET_MS();
|
||||
if (nowMs - lastRxTS > 15)
|
||||
setMultiTelemetryBufferState(module, NoProtocolDetected);
|
||||
lastRxTS = nowMs;
|
||||
|
||||
// debugPrintf("State: %d, byte received %02X, buflen: %d\r\n", getMultiTelemetryBufferState(module), data, rxBufferCount);
|
||||
|
||||
switch (getMultiTelemetryBufferState(module)) {
|
||||
case NoProtocolDetected:
|
||||
if (data == 'M') {
|
||||
@@ -691,16 +732,22 @@ void processMultiTelemetryData(uint8_t data, uint8_t module)
|
||||
break;
|
||||
|
||||
case ReceivingMultiStatus:
|
||||
rxBuffer[rxBufferCount++] = data;
|
||||
if (rxBufferCount > 5 && rxBuffer[0] == rxBufferCount - 1) {
|
||||
processMultiStatusPacket(rxBuffer + 1, module);
|
||||
rxBufferCount = 0;
|
||||
setMultiTelemetryBufferState(module, NoProtocolDetected);
|
||||
if (rxBufferCount < TELEMETRY_RX_PACKET_SIZE) {
|
||||
rxBuffer[rxBufferCount++] = data;
|
||||
if (rxBufferCount > 5 && rxBuffer[0] == rxBufferCount - 1) {
|
||||
processMultiStatusPacket(rxBuffer + 1, module, rxBuffer[0]);
|
||||
rxBufferCount = 0;
|
||||
setMultiTelemetryBufferState(module, NoProtocolDetected);
|
||||
}
|
||||
if (rxBufferCount > 24) {
|
||||
// too long ignore
|
||||
TRACE("Overlong multi status packet detected ignoring, wanted %d", rxBuffer[0]);
|
||||
rxBufferCount = 0;
|
||||
setMultiTelemetryBufferState(module, NoProtocolDetected);
|
||||
}
|
||||
}
|
||||
if (rxBufferCount > 10) {
|
||||
// too long ignore
|
||||
TRACE("Overlong multi status packet detected ignoring, wanted %d", rxBuffer[0]);
|
||||
rxBufferCount = 0;
|
||||
else {
|
||||
TRACE("[MP] array size %d error", rxBufferCount);
|
||||
setMultiTelemetryBufferState(module, NoProtocolDetected);
|
||||
}
|
||||
break;
|
||||
|
||||
+22
-11
@@ -21,6 +21,9 @@
|
||||
#ifndef OPENTX_MULTI_H
|
||||
#define OPENTX_MULTI_H
|
||||
|
||||
#define MULTI_BUFFER_SIZE 177
|
||||
extern uint8_t * Multi_Buffer;
|
||||
|
||||
/*
|
||||
Multiprotocol telemetry definition
|
||||
|
||||
@@ -93,23 +96,21 @@ void processMultiTelemetryData(uint8_t data, uint8_t module);
|
||||
|
||||
// This should be put into the Module definition if other modules gain this functionality
|
||||
struct MultiModuleSyncStatus {
|
||||
uint32_t adjustedRefreshRate; // in ps
|
||||
uint32_t adjustedRefreshRate = 9000 * 1000; // in ps
|
||||
tmr10ms_t lastUpdate;
|
||||
uint16_t refreshRate;
|
||||
uint16_t inputLag;
|
||||
uint8_t interval;
|
||||
uint8_t target;
|
||||
|
||||
inline bool isValid() {return (get_tmr10ms() - lastUpdate < 100);}
|
||||
void getRefreshString(char* refreshText);
|
||||
uint16_t getAdjustedRefreshRate();
|
||||
void calcAdjustedRefreshRate(uint16_t newRefreshRate, uint16_t newInputLag);
|
||||
|
||||
MultiModuleSyncStatus() {
|
||||
// Initialise to a valid value
|
||||
adjustedRefreshRate=9000 * 1000;
|
||||
inline bool isValid() const
|
||||
{
|
||||
return (get_tmr10ms() - lastUpdate < 100);
|
||||
}
|
||||
|
||||
|
||||
void getRefreshString(char * refreshText);
|
||||
const uint16_t getAdjustedRefreshRate();
|
||||
void calcAdjustedRefreshRate(uint16_t newRefreshRate, uint16_t newInputLag);
|
||||
};
|
||||
|
||||
MultiModuleSyncStatus& getMultiSyncStatus(uint8_t module);
|
||||
@@ -121,14 +122,24 @@ struct MultiModuleStatus {
|
||||
uint8_t minor;
|
||||
uint8_t revision;
|
||||
uint8_t patch;
|
||||
uint8_t ch_order;
|
||||
|
||||
uint8_t flags;
|
||||
uint8_t requiresFailsafeCheck;
|
||||
tmr10ms_t lastUpdate;
|
||||
|
||||
void getStatusString(char* statusText);
|
||||
uint8_t protocolPrev = 0;
|
||||
uint8_t protocolNext = 0;
|
||||
char protocolName[8] = {0};
|
||||
uint8_t protocolSubNbr = 0;
|
||||
char protocolSubName[9] = {0};
|
||||
uint8_t optionDisp = 0;
|
||||
|
||||
void getStatusString(char * statusText) const;
|
||||
|
||||
inline bool isValid() const { return (bool)(get_tmr10ms() - lastUpdate < 200); }
|
||||
inline bool isBufferFull() const { return (bool) (flags & 0x80); }
|
||||
inline bool supportsDisableMapping() const { return (bool) (flags & 0x40); }
|
||||
inline bool supportsFailsafe() const { return (bool) (flags & 0x20); }
|
||||
inline bool isWaitingforBind() const { return (bool) (flags & 0x10); }
|
||||
inline bool isBinding() const { return (bool) (flags & 0x08); }
|
||||
|
||||
@@ -373,7 +373,7 @@ void processSpektrumPacket(const uint8_t *packet)
|
||||
void processDSMBindPacket(uint8_t module, const uint8_t *packet)
|
||||
{
|
||||
uint32_t debugval;
|
||||
if (g_model.moduleData[module].type == MODULE_TYPE_MULTIMODULE && g_model.moduleData[module].getMultiProtocol(true) == MODULE_SUBTYPE_MULTI_DSM2
|
||||
if (g_model.moduleData[module].type == MODULE_TYPE_MULTIMODULE && g_model.moduleData[module].getMultiProtocol() == MODULE_SUBTYPE_MULTI_DSM2
|
||||
&& g_model.moduleData[module].multi.autoBindMode) {
|
||||
|
||||
int channels = packet[5];
|
||||
@@ -399,7 +399,7 @@ void processDSMBindPacket(uint8_t module, const uint8_t *packet)
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_SPEKTRUM, (I2C_PSEUDO_TX << 8) + 4, 0, 0, debugval, UNIT_RAW, 0);
|
||||
|
||||
/* Finally stop binding as the rx just told us that it is bound */
|
||||
if (g_model.moduleData[module].type == MODULE_TYPE_MULTIMODULE && g_model.moduleData[module].getMultiProtocol(true) == MODULE_SUBTYPE_MULTI_DSM2 && moduleState[module].mode == MODULE_MODE_BIND) {
|
||||
if (g_model.moduleData[module].type == MODULE_TYPE_MULTIMODULE && g_model.moduleData[module].getMultiProtocol() == MODULE_SUBTYPE_MULTI_DSM2 && moduleState[module].mode == MODULE_MODE_BIND) {
|
||||
setMultiBindStatus(module, MULTI_BIND_FINISHED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ inline bool isBadAntennaDetected()
|
||||
void telemetryWakeup()
|
||||
{
|
||||
uint8_t requiredTelemetryProtocol = modelTelemetryProtocol();
|
||||
uint8_t data;
|
||||
|
||||
#if defined(REVX)
|
||||
uint8_t requiredSerialInversion = g_model.moduleData[EXTERNAL_MODULE].invertedSerial;
|
||||
@@ -100,6 +101,7 @@ void telemetryWakeup()
|
||||
processPXX2Frame(INTERNAL_MODULE, frame);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(EXTMODULE_USART)
|
||||
while (extmoduleFifo.getFrame(frame)) {
|
||||
processPXX2Frame(EXTERNAL_MODULE, frame);
|
||||
@@ -108,15 +110,16 @@ void telemetryWakeup()
|
||||
#endif
|
||||
|
||||
#if defined(INTERNAL_MODULE_MULTI)
|
||||
while(!intmoduleFifo.isEmpty()) {
|
||||
uint8_t b=0;
|
||||
intmoduleFifo.pop(b);
|
||||
processMultiTelemetryData(b, INTERNAL_MODULE);
|
||||
if (intmoduleFifo.pop(data)) {
|
||||
LOG_TELEMETRY_WRITE_START();
|
||||
do {
|
||||
processMultiTelemetryData(data, INTERNAL_MODULE);
|
||||
LOG_TELEMETRY_WRITE_BYTE(data);
|
||||
} while (intmoduleFifo.pop(data));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(STM32)
|
||||
uint8_t data;
|
||||
if (telemetryGetByte(&data)) {
|
||||
LOG_TELEMETRY_WRITE_START();
|
||||
do {
|
||||
@@ -126,7 +129,6 @@ void telemetryWakeup()
|
||||
}
|
||||
#elif defined(PCBSKY9X)
|
||||
if (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_D_SECONDARY) {
|
||||
uint8_t data;
|
||||
while (telemetrySecondPortReceive(data)) {
|
||||
processTelemetryData(data);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "spektrum.h"
|
||||
#include "flysky_ibus.h"
|
||||
#include "hitec.h"
|
||||
#include "hott.h"
|
||||
#include "multi.h"
|
||||
#endif
|
||||
#include "myeeprom.h"
|
||||
@@ -106,8 +107,13 @@ void frskyDSetDefault(int index, uint16_t id);
|
||||
extern uint8_t telemetryProtocol;
|
||||
|
||||
#if defined (MULTIMODULE)
|
||||
#define IS_D16_MULTI() ((g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false) == MODULE_SUBTYPE_MULTI_FRSKY) && (g_model.moduleData[EXTERNAL_MODULE].subType == MM_RF_FRSKY_SUBTYPE_D16 || g_model.moduleData[EXTERNAL_MODULE].subType == MM_RF_FRSKY_SUBTYPE_D16_8CH))
|
||||
#define IS_FRSKY_SPORT_PROTOCOL() (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT || (telemetryProtocol == PROTOCOL_TELEMETRY_MULTIMODULE && IS_D16_MULTI()))
|
||||
#define IS_D16_MULTI(module) ((g_model.moduleData[module].getMultiProtocol() == MODULE_SUBTYPE_MULTI_FRSKY) && (g_model.moduleData[module].subType == MM_RF_FRSKY_SUBTYPE_D16 || g_model.moduleData[module].subType == MM_RF_FRSKY_SUBTYPE_D16_8CH || g_model.moduleData[module].subType == MM_RF_FRSKY_SUBTYPE_D16_LBT || g_model.moduleData[module].subType == MM_RF_FRSKY_SUBTYPE_D16_LBT_8CH))
|
||||
#define IS_HOTT_MULTI(module) (g_model.moduleData[module].getMultiProtocol() == MODULE_SUBTYPE_MULTI_HOTT)
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
#define IS_FRSKY_SPORT_PROTOCOL() (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT || (telemetryProtocol == PROTOCOL_TELEMETRY_MULTIMODULE && (IS_D16_MULTI(INTERNAL_MODULE)||IS_D16_MULTI(EXTERNAL_MODULE))))
|
||||
#else
|
||||
#define IS_FRSKY_SPORT_PROTOCOL() (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT || (telemetryProtocol == PROTOCOL_TELEMETRY_MULTIMODULE && IS_D16_MULTI(EXTERNAL_MODULE)))
|
||||
#endif
|
||||
#else
|
||||
#define IS_FRSKY_SPORT_PROTOCOL() (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT)
|
||||
#endif
|
||||
@@ -246,6 +252,6 @@ extern OutputTelemetryBuffer outputTelemetryBuffer __DMA;
|
||||
extern Fifo<uint8_t, LUA_TELEMETRY_INPUT_FIFO_SIZE> * luaInputTelemetryFifo;
|
||||
#endif
|
||||
|
||||
void processPXX2Frame(uint8_t module, uint8_t *frame);
|
||||
void processPXX2Frame(uint8_t module, const uint8_t *frame);
|
||||
|
||||
#endif // _TELEMETRY_H_
|
||||
|
||||
@@ -530,6 +530,9 @@ int setTelemetryValue(TelemetryProtocol protocol, uint16_t id, uint8_t subId, ui
|
||||
case PROTOCOL_TELEMETRY_HITEC:
|
||||
hitecSetDefault(index, id, subId, instance);
|
||||
break;
|
||||
case PROTOCOL_TELEMETRY_HOTT:
|
||||
hottSetDefault(index, id, subId, instance);
|
||||
break;
|
||||
#endif
|
||||
#if defined(LUA)
|
||||
case PROTOCOL_TELEMETRY_LUA:
|
||||
|
||||
Reference in New Issue
Block a user