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) {
|
||||
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
|
||||
data = SPORT_DATA_U8(packet);
|
||||
if (data == 0)
|
||||
|
||||
@@ -28,7 +28,7 @@ bool isFaiForbidden(source_t idx)
|
||||
if (idx < MIXSRC_FIRST_TELEM) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
TelemetrySensor * sensor = &g_model.telemetrySensors[(idx-MIXSRC_FIRST_TELEM)/3];
|
||||
|
||||
switch (telemetryProtocol) {
|
||||
@@ -479,6 +479,26 @@ int lastUsedTelemetryIndex()
|
||||
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)
|
||||
{
|
||||
bool available = false;
|
||||
|
||||
@@ -137,5 +137,6 @@ class TelemetryItem
|
||||
extern TelemetryItem telemetryItems[MAX_TELEMETRY_SENSORS];
|
||||
extern uint8_t allowNewSensors;
|
||||
bool isFaiForbidden(source_t idx);
|
||||
bool isValidIdAndInstance(uint16_t id, uint8_t instance);
|
||||
|
||||
#endif // _TELEMETRY_SENSORS_H_
|
||||
|
||||
Reference in New Issue
Block a user