fix(radio): fix inverted source causing EM on PlayValue SF trigger (#5968)
This commit is contained in:
+11
-2
@@ -56,7 +56,7 @@ void testFunc()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PLAY_FUNCTION(playValue, source_t idx)
|
PLAY_FUNCTION(playValue, mixsrc_t idx)
|
||||||
{
|
{
|
||||||
if (IS_FAI_FORBIDDEN(idx))
|
if (IS_FAI_FORBIDDEN(idx))
|
||||||
return;
|
return;
|
||||||
@@ -65,10 +65,16 @@ PLAY_FUNCTION(playValue, source_t idx)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
getvalue_t val = getValue(idx);
|
getvalue_t val = getValue(idx);
|
||||||
|
idx = abs(idx); // Don't need negative form any longer
|
||||||
|
|
||||||
if (idx >= MIXSRC_FIRST_TELEM) {
|
if (idx >= MIXSRC_FIRST_TELEM) {
|
||||||
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[(idx-MIXSRC_FIRST_TELEM) / 3];
|
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[(idx-MIXSRC_FIRST_TELEM) / 3];
|
||||||
uint8_t attr = 0;
|
uint8_t attr = 0;
|
||||||
|
|
||||||
|
// Preserve the sign
|
||||||
|
int sign = (val >= 0) ? 1 : -1;
|
||||||
|
val = abs(val);
|
||||||
|
|
||||||
if (telemetrySensor.prec > 0) {
|
if (telemetrySensor.prec > 0) {
|
||||||
if (telemetrySensor.prec == 2) {
|
if (telemetrySensor.prec == 2) {
|
||||||
if (val >= 5000) {
|
if (val >= 5000) {
|
||||||
@@ -88,11 +94,14 @@ PLAY_FUNCTION(playValue, source_t idx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val *= sign; // Reapply sign if needed
|
||||||
|
|
||||||
PLAY_NUMBER(val, telemetrySensor.unit == UNIT_CELLS ? UNIT_VOLTS : telemetrySensor.unit, attr);
|
PLAY_NUMBER(val, telemetrySensor.unit == UNIT_CELLS ? UNIT_VOLTS : telemetrySensor.unit, attr);
|
||||||
}
|
}
|
||||||
else if (idx >= MIXSRC_FIRST_TIMER && idx <= MIXSRC_LAST_TIMER) {
|
else if (idx >= MIXSRC_FIRST_TIMER && idx <= MIXSRC_LAST_TIMER) {
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
if (val > LONG_TIMER_DURATION || -val > LONG_TIMER_DURATION) {
|
if (abs(val) > LONG_TIMER_DURATION) {
|
||||||
flag = PLAY_LONG_TIMER;
|
flag = PLAY_LONG_TIMER;
|
||||||
}
|
}
|
||||||
PLAY_DURATION(val, flag);
|
PLAY_DURATION(val, flag);
|
||||||
|
|||||||
Reference in New Issue
Block a user