@@ -178,10 +178,9 @@ void processCrossfireTelemetryFrame()
|
||||
case FLIGHT_MODE_ID:
|
||||
{
|
||||
const CrossfireSensor & sensor = crossfireSensors[FLIGHT_MODE_INDEX];
|
||||
for (int i=0; i<min<int>(16, telemetryRxBuffer[1]-2); i+=4) {
|
||||
uint32_t value = *((uint32_t *)&telemetryRxBuffer[3+i]);
|
||||
setTelemetryValue(PROTOCOL_TELEMETRY_CROSSFIRE, sensor.id, 0, sensor.subId, value, sensor.unit, i);
|
||||
}
|
||||
auto textLength = min<int>(16, telemetryRxBuffer[1] - 1);
|
||||
telemetryRxBuffer[textLength] = '\0';
|
||||
setTelemetryText(PROTOCOL_TELEMETRY_CROSSFIRE, sensor.id, 0, sensor.subId, (const char *)telemetryRxBuffer + 3);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -204,6 +204,7 @@ void TelemetryItem::setValue(const TelemetrySensor & sensor, int32_t val, uint32
|
||||
}
|
||||
}
|
||||
else if (unit == UNIT_TEXT) {
|
||||
// Should be handled at telemetry protocol level
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
constexpr int8_t TELEMETRY_SENSOR_TIMEOUT_UNAVAILABLE = -2;
|
||||
constexpr int8_t TELEMETRY_SENSOR_TIMEOUT_OLD = -1;
|
||||
constexpr int8_t TELEMETRY_SENSOR_TIMEOUT_START = 125; // * 160ms = 20s
|
||||
constexpr uint8_t TELEMETRY_SENSOR_TEXT_LENGTH = 16;
|
||||
|
||||
class TelemetryItem
|
||||
{
|
||||
@@ -74,7 +75,7 @@ class TelemetryItem
|
||||
// pilot latitude is stored in max
|
||||
// distFromEarthAxis is stored in value
|
||||
} gps;
|
||||
char text[16];
|
||||
char text[TELEMETRY_SENSOR_TEXT_LENGTH];
|
||||
};
|
||||
|
||||
TelemetryItem()
|
||||
|
||||
Reference in New Issue
Block a user