From 136cd666f7e53a9fd01642fa6db5f89d3ae5bbd8 Mon Sep 17 00:00:00 2001 From: bsongis Date: Fri, 23 May 2014 15:38:50 +0200 Subject: [PATCH] RxBatt should now be displayed and played correctly --- radio/src/lcd.cpp | 16 ++++++++++++++++ radio/src/opentx.cpp | 25 +++++++++++++------------ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/radio/src/lcd.cpp b/radio/src/lcd.cpp index 67ded9577..6024fda7f 100644 --- a/radio/src/lcd.cpp +++ b/radio/src/lcd.cpp @@ -1215,6 +1215,22 @@ void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val, att &= ~NO_UNIT; putsTimer(x, y, val, att, att); break; +#if defined(CPUARM) + case TELEM_RX_VOLTAGE-1: +#if LCD_W >= 212 + att |= PREC2; +#else + if (abs(val) < 1000) { + att |= PREC2; + } + else { + val = div10_and_round(val); + att |= PREC1; + } +#endif + putsTelemetryValue(x, y, val, UNIT_VOLTS, att); + break; +#endif #if defined(FRSKY) case TELEM_MIN_A1-1: case TELEM_MIN_A2-1: diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 685077a0c..b63bb50a6 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -1606,6 +1606,11 @@ PLAY_FUNCTION(playValue, uint8_t idx) case MIXSRC_FIRST_TELEM+TELEM_SWR-1: PLAY_NUMBER(val, 0, 0); break; + case MIXSRC_FIRST_TELEM+TELEM_RX_VOLTAGE-1: + if (TELEMETRY_STREAMING()) { + PLAY_NUMBER(div10_and_round(val), 1+UNIT_VOLTS, PREC1); + } + break; #endif #if defined(FRSKY) case MIXSRC_FIRST_TELEM+TELEM_RSSI_TX-1: @@ -1626,20 +1631,16 @@ PLAY_FUNCTION(playValue, uint8_t idx) case MIXSRC_FIRST_TELEM+TELEM_A3-1: case MIXSRC_FIRST_TELEM+TELEM_A4-1: #endif - // A1 and A2 - idx -= (MIXSRC_FIRST_TELEM+TELEM_A1-1); - { - if (TELEMETRY_STREAMING()) { - uint8_t att = 0; - int16_t converted_value = div10_and_round(applyChannelRatio(idx, val));; - if (ANA_CHANNEL_UNIT(idx) < UNIT_RAW) { - att = PREC1; - } - PLAY_NUMBER(converted_value, 1+ANA_CHANNEL_UNIT(idx), att); + if (TELEMETRY_STREAMING()) { + idx -= (MIXSRC_FIRST_TELEM+TELEM_A1-1); + uint8_t att = 0; + int16_t converted_value = div10_and_round(applyChannelRatio(idx, val));; + if (ANA_CHANNEL_UNIT(idx) < UNIT_RAW) { + att = PREC1; } - break; + PLAY_NUMBER(converted_value, 1+ANA_CHANNEL_UNIT(idx), att); } - + break; case MIXSRC_FIRST_TELEM+TELEM_CELL-1: case MIXSRC_FIRST_TELEM+TELEM_MIN_CELL-1: PLAY_NUMBER(div10_and_round(val), 1+UNIT_VOLTS, PREC1);