diff --git a/radio/src/datastructs.h b/radio/src/datastructs.h index 899190096..9ff05975a 100644 --- a/radio/src/datastructs.h +++ b/radio/src/datastructs.h @@ -381,25 +381,7 @@ PACK(struct TelemetrySensor { bool isPrecConfigurable() const; int32_t getPrecMultiplier() const; int32_t getPrecDivisor() const; - bool isSameInstance(TelemetryProtocol protocol, uint8_t instance) - { - if (this->instance == instance) - return true; - - if (protocol == PROTOCOL_TELEMETRY_FRSKY_SPORT) { -#if defined(SIMU) - if (((this->instance ^ instance) & 0x1F) == 0) - return true; -#else - if (((this->instance ^ instance) & 0x9F) == 0 && (this->instance >> 5) != TELEMETRY_ENDPOINT_SPORT && (instance >> 5) != TELEMETRY_ENDPOINT_SPORT) { - this->instance = instance; // update the instance in case we had telemetry switching - return true; - } -#endif - } - - return false; - } + bool isSameInstance(TelemetryProtocol protocol, uint8_t instance); ); }); diff --git a/radio/src/telemetry/telemetry_sensors.cpp b/radio/src/telemetry/telemetry_sensors.cpp index 449879c5a..0896e1424 100644 --- a/radio/src/telemetry/telemetry_sensors.cpp +++ b/radio/src/telemetry/telemetry_sensors.cpp @@ -720,3 +720,23 @@ int32_t TelemetrySensor::getPrecDivisor() const if (prec == 1) return 10; return 1; } + +bool TelemetrySensor::isSameInstance(TelemetryProtocol protocol, uint8_t instance) +{ + if (this->instance == instance) + return true; + + if (protocol == PROTOCOL_TELEMETRY_FRSKY_SPORT) { +#if defined(SIMU) + if (((this->instance ^ instance) & 0x1F) == 0) + return true; +#else + if (((this->instance ^ instance) & 0x9F) == 0 && (this->instance >> 5) != TELEMETRY_ENDPOINT_SPORT && (instance >> 5) != TELEMETRY_ENDPOINT_SPORT) { + this->instance = instance; // update the instance in case we had telemetry switching + return true; + } +#endif + } + + return false; +}