This commit is contained in:
committed by
Bertrand Songis
parent
2f91eba85d
commit
1b3897a425
@@ -148,7 +148,7 @@ void sportProcessTelemetryPacket(const uint8_t * packet)
|
|||||||
|
|
||||||
if (primId == DATA_FRAME) {
|
if (primId == DATA_FRAME) {
|
||||||
uint8_t instance = physicalId + 1;
|
uint8_t instance = physicalId + 1;
|
||||||
if (id == RSSI_ID) {
|
if (id == RSSI_ID && isValidIdAndInstance(RSSI_ID, instance)) {
|
||||||
telemetryStreaming = TELEMETRY_TIMEOUT10ms; // reset counter only if valid packets are being detected
|
telemetryStreaming = TELEMETRY_TIMEOUT10ms; // reset counter only if valid packets are being detected
|
||||||
data = SPORT_DATA_U8(packet);
|
data = SPORT_DATA_U8(packet);
|
||||||
if (data == 0)
|
if (data == 0)
|
||||||
|
|||||||
@@ -479,6 +479,26 @@ int lastUsedTelemetryIndex()
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isValidIdAndInstance(uint16_t id, uint8_t instance)
|
||||||
|
{
|
||||||
|
bool sensorFound = false;
|
||||||
|
|
||||||
|
for (int index=0; index<MAX_TELEMETRY_SENSORS; index++) {
|
||||||
|
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[index];
|
||||||
|
if (telemetrySensor.type == TELEM_TYPE_CUSTOM && telemetrySensor.id == id)
|
||||||
|
{
|
||||||
|
sensorFound = true;
|
||||||
|
if (telemetrySensor.instance == instance || g_model.ignoreSensorIds)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sensorFound)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int setTelemetryValue(TelemetryProtocol protocol, uint16_t id, uint8_t subId, uint8_t instance, int32_t value, uint32_t unit, uint32_t prec)
|
int setTelemetryValue(TelemetryProtocol protocol, uint16_t id, uint8_t subId, uint8_t instance, int32_t value, uint32_t unit, uint32_t prec)
|
||||||
{
|
{
|
||||||
bool available = false;
|
bool available = false;
|
||||||
|
|||||||
@@ -137,5 +137,6 @@ class TelemetryItem
|
|||||||
extern TelemetryItem telemetryItems[MAX_TELEMETRY_SENSORS];
|
extern TelemetryItem telemetryItems[MAX_TELEMETRY_SENSORS];
|
||||||
extern uint8_t allowNewSensors;
|
extern uint8_t allowNewSensors;
|
||||||
bool isFaiForbidden(source_t idx);
|
bool isFaiForbidden(source_t idx);
|
||||||
|
bool isValidIdAndInstance(uint16_t id, uint8_t instance);
|
||||||
|
|
||||||
#endif // _TELEMETRY_SENSORS_H_
|
#endif // _TELEMETRY_SENSORS_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user