1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-13 03:19:53 +03:00

Rationalize

This commit is contained in:
3djc 2021-02-02 16:12:49 +01:00
parent 0652fa609b
commit 7a0a566238
2 changed files with 8 additions and 10 deletions

View file

@ -244,11 +244,14 @@ void telemetryInterrupt10ms()
if (sensor.type == TELEM_TYPE_CALCULATED) {
telemetryItems[i].per10ms(sensor);
}
if (tick160ms && telemetryItems[i].timeout > 0) {
telemetryItems[i].timeout--;
if (tick160ms) {
auto & timeout = telemetryItems[i].timeout;
if (!MODEL_TELEMETRY_STREAMING() && timeout < TELEMETRY_SENSOR_TIMEOUT_NO_MODEL_TELEM) {
timeout = TELEMETRY_SENSOR_TIMEOUT_OLD;
}
else if (timeout > 0) {
timeout--;
}
if (!MODEL_TELEMETRY_STREAMING() && tick160ms && telemetryItems[i].timeout < TELEMETRY_SENSOR_TIMEOUT_NO_MODEL_TELEM) {
telemetryItems[i].timeout = TELEMETRY_SENSOR_TIMEOUT_OLD;
}
}
telemetryStreaming--;

View file

@ -40,11 +40,6 @@
extern uint8_t telemetryStreaming; // >0 (true) == data is streaming in. 0 = no data detected for some time
extern uint8_t modelTelemetryStreaming; // allows to differentiate between module telem and model telem
inline bool TELEMETRY_STREAMING()
{
return telemetryStreaming > 0;
}
inline bool MODEL_TELEMETRY_STREAMING()
{
return modelTelemetryStreaming > 0;