fix(telemetry): sensor processing with legacy polling disabled (#2653)

Fixes #2546
Fixes #2591
This commit is contained in:
Raphael Coeffic
2022-10-31 13:18:39 +10:00
committed by GitHub
parent 6763c97934
commit b61e2d8dda
+4 -1
View File
@@ -265,17 +265,19 @@ void telemetryWakeup()
if (int_drv) pollTelemetry(INTERNAL_MODULE, int_drv, getIntModuleCtx()); if (int_drv) pollTelemetry(INTERNAL_MODULE, int_drv, getIntModuleCtx());
#endif #endif
bool disable_legacy_polling = false;
#if defined(HARDWARE_EXTERNAL_MODULE) #if defined(HARDWARE_EXTERNAL_MODULE)
auto ext_drv = getExtModuleDriver(); auto ext_drv = getExtModuleDriver();
if (ext_drv) { if (ext_drv) {
if (pollTelemetry(EXTERNAL_MODULE, ext_drv, getExtModuleCtx())) { if (pollTelemetry(EXTERNAL_MODULE, ext_drv, getExtModuleCtx())) {
// skip legacy telemetry polling in case external module // skip legacy telemetry polling in case external module
// driver defines telemetry methods (getByte & processData) // driver defines telemetry methods (getByte & processData)
return; disable_legacy_polling = true;
} }
} }
#endif #endif
if (!disable_legacy_polling) {
// TODO: needs to be moved to protocol/module init // TODO: needs to be moved to protocol/module init
// as-is, it implies only ONE telemetry protocol // as-is, it implies only ONE telemetry protocol
// enabled at the same time // enabled at the same time
@@ -288,6 +290,7 @@ void telemetryWakeup()
// Poll external / S.PORT telemetry // Poll external / S.PORT telemetry
// TODO: how to switch this OFF ??? // TODO: how to switch this OFF ???
pollExtTelemetryLegacy(); pollExtTelemetryLegacy();
}
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) { for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
const TelemetrySensor & sensor = g_model.telemetrySensors[i]; const TelemetrySensor & sensor = g_model.telemetrySensors[i];