POC X7
This commit is contained in:
@@ -59,6 +59,11 @@ void processFrskyPXX2Data(uint8_t data)
|
||||
telemetryRxBuffer[telemetryRxBufferCount++] = data;
|
||||
if (telemetryRxBuffer[0] + 3 /* 1 byte for length, 2 bytes for CRC */ == telemetryRxBufferCount) {
|
||||
if (checkPXX2PacketCRC(telemetryRxBuffer)) {
|
||||
R9ModuleStreaming = TELEMETRY_TIMEOUT10ms; // reset counter only if valid packets are being detected
|
||||
uint8_t R9Region = (telemetryRxBuffer[3] & 0x30) >> 4;
|
||||
if (R9Region != 0x04) {
|
||||
BF_SET(g_model.moduleData[EXTERNAL_MODULE].subType, R9Region, 1, 2); // heading bit holds flex frequency
|
||||
}
|
||||
if (telemetryRxBuffer[2] & 0x80) {
|
||||
createFrSkyPXX2Sensor(RSSI_ID, telemetryRxBuffer[2] & 0x7f);
|
||||
}
|
||||
@@ -68,7 +73,11 @@ void processFrskyPXX2Data(uint8_t data)
|
||||
if((telemetryRxBuffer[3] & 0x04) == 0) {
|
||||
createFrSkyPXX2Sensor(R9_PWR_ID, (telemetryRxBuffer[3] & 0x03));
|
||||
}
|
||||
sportProcessTelemetryPacketWithoutCrc(telemetryRxBuffer + 6 /* LEN, TYPE, RSSI/BAT, TP/SS/FW_T, FW_VER, Data ID */);
|
||||
|
||||
if (telemetryRxBuffer[0] == 0x0c) {
|
||||
sportProcessTelemetryPacketWithoutCrc(telemetryRxBuffer + 5 /* LEN, TYPE, RSSI/BAT, TP/SS/FW_T, FW_VER, Data ID */);
|
||||
TRACE("Got TELEM data");
|
||||
}
|
||||
}
|
||||
telemetryRxBufferCount = 0;
|
||||
dataState = STATE_DATA_IDLE;
|
||||
|
||||
@@ -190,9 +190,10 @@ enum FrSkyDataState {
|
||||
#define BATT_ID 0xf104
|
||||
#define RAS_ID 0xf105
|
||||
#define XJT_VERSION_ID 0xf106
|
||||
#define R9_PWR_ID 0xf107
|
||||
#define FUEL_QTY_FIRST_ID 0x0a10
|
||||
#define FUEL_QTY_LAST_ID 0x0a1f
|
||||
#define R9_PWR_ID 0xf107 // TODO: *CRITICAL* agree on ID with FrSky, this value is just a placeholder
|
||||
|
||||
|
||||
|
||||
// Default sensor data IDs (Physical IDs + CRC)
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "opentx.h"
|
||||
|
||||
uint8_t telemetryStreaming = 0;
|
||||
uint8_t R9ModuleStreaming = 0;
|
||||
uint8_t telemetryRxBuffer[TELEMETRY_RX_PACKET_SIZE]; // Receive buffer. 9 bytes (full packet), worst case 18 bytes with byte-stuffing (+1)
|
||||
uint8_t telemetryRxBufferCount = 0;
|
||||
|
||||
@@ -120,7 +121,7 @@ void telemetryWakeup()
|
||||
varioWakeup();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#define FRSKY_BAD_ANTENNA() (IS_RAS_VALUE_VALID() && telemetryData.swr.value > 0x33)
|
||||
|
||||
static tmr10ms_t alarmsCheckTime = 0;
|
||||
@@ -202,7 +203,9 @@ void telemetryInterrupt10ms()
|
||||
wshhStreaming--;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (R9ModuleStreaming > 0) {
|
||||
R9ModuleStreaming--;
|
||||
}
|
||||
if (telemetryStreaming > 0) {
|
||||
telemetryStreaming--;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#endif
|
||||
|
||||
extern uint8_t telemetryStreaming; // >0 (true) == data is streaming in. 0 = no data detected for some time
|
||||
extern uint8_t R9ModuleStreaming; // >0 (true) == R9 module is connected and sending data 0 = no data detected for some time
|
||||
|
||||
#if defined(WS_HOW_HIGH)
|
||||
extern uint8_t wshhStreaming;
|
||||
@@ -130,7 +131,7 @@ inline uint8_t modelTelemetryProtocol()
|
||||
if (!IS_INTERNAL_MODULE_ENABLED() && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_R9M) {
|
||||
return PROTOCOL_TELEMETRY_PXX2;
|
||||
}
|
||||
|
||||
|
||||
#if defined(MULTIMODULE)
|
||||
if (!IS_INTERNAL_MODULE_ENABLED() && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_MULTIMODULE) {
|
||||
return PROTOCOL_TELEMETRY_MULTIMODULE;
|
||||
|
||||
Reference in New Issue
Block a user