diff --git a/radio/src/lcd.cpp b/radio/src/lcd.cpp index 651e28d3a..67ded9577 100644 --- a/radio/src/lcd.cpp +++ b/radio/src/lcd.cpp @@ -1218,19 +1218,29 @@ void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val, #if defined(FRSKY) case TELEM_MIN_A1-1: case TELEM_MIN_A2-1: +#if defined(CPUARM) + case TELEM_MIN_A3-1: + case TELEM_MIN_A4-1: +#endif channel -= TELEM_MIN_A1-TELEM_A1; // no break case TELEM_A1-1: case TELEM_A2-1: +#if defined(CPUARM) + case TELEM_A3-1: + case TELEM_A4-1: +#endif channel -= TELEM_A1-1; // A1 and A2 { lcdint_t converted_value = applyChannelRatio(channel, val); - if (g_model.frsky.channels[channel].type >= UNIT_RAW) { + if (ANA_CHANNEL_UNIT(channel) >= UNIT_RAW) { converted_value = div10_and_round(converted_value); } else { -#if !defined(PCBTARANIS) +#if LCD_W >= 212 + att |= PREC2; +#else if (abs(converted_value) < 1000) { att |= PREC2; } @@ -1238,8 +1248,6 @@ void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val, converted_value = div10_and_round(converted_value); att |= PREC1; } -#else - att |= PREC2; #endif } putsTelemetryValue(x, y, converted_value, g_model.frsky.channels[channel].type, att); diff --git a/radio/src/maths.cpp b/radio/src/maths.cpp index 2d07eb27c..25b2716ef 100644 --- a/radio/src/maths.cpp +++ b/radio/src/maths.cpp @@ -163,6 +163,11 @@ uint16_t getChannelRatio(uint8_t channel) lcdint_t applyChannelRatio(uint8_t channel, lcdint_t val) { +#if defined(CPUARM) + // A3 and A4 don't have ratio settings + if (channel > 1) + return val; +#endif return ((int32_t)val+g_model.frsky.channels[channel].offset) * getChannelRatio(channel) * 2 / 51; } #endif diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index cb9866428..685077a0c 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -1614,20 +1614,28 @@ PLAY_FUNCTION(playValue, uint8_t idx) break; case MIXSRC_FIRST_TELEM+TELEM_MIN_A1-1: case MIXSRC_FIRST_TELEM+TELEM_MIN_A2-1: +#if defined(CPUARM) + case MIXSRC_FIRST_TELEM+TELEM_MIN_A3-1: + case MIXSRC_FIRST_TELEM+TELEM_MIN_A4-1: +#endif idx -= TELEM_MIN_A1-TELEM_A1; // no break case MIXSRC_FIRST_TELEM+TELEM_A1-1: case MIXSRC_FIRST_TELEM+TELEM_A2-1: +#if defined(CPUARM) + 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 (g_model.frsky.channels[idx].type < UNIT_RAW) { + if (ANA_CHANNEL_UNIT(idx) < UNIT_RAW) { att = PREC1; } - PLAY_NUMBER(converted_value, 1+g_model.frsky.channels[idx].type, att); + PLAY_NUMBER(converted_value, 1+ANA_CHANNEL_UNIT(idx), att); } break; } diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 2611bd1b0..8be4c8068 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -1572,6 +1572,12 @@ getvalue_t convertLswTelemValue(LogicalSwitchData * cs); lcdint_t applyChannelRatio(uint8_t channel, lcdint_t val); #endif +#if defined(CPUARM) + #define ANA_CHANNEL_UNIT(channel) (channel > 1 ? UNIT_VOLTS : g_model.frsky.channels[channel].type) +#else + #define ANA_CHANNEL_UNIT(channel) g_model.frsky.channels[channel].type +#endif + getvalue_t div10_and_round(getvalue_t value); diff --git a/radio/src/telemetry/frsky_sport.cpp b/radio/src/telemetry/frsky_sport.cpp index d72efddd3..bdca730ba 100644 --- a/radio/src/telemetry/frsky_sport.cpp +++ b/radio/src/telemetry/frsky_sport.cpp @@ -463,6 +463,12 @@ void frskySportProcessPacket(uint8_t *packet) frskyData.hub.gpsFix = 0; } } + else if (appId >= A3_FIRST_ID && appId <= A3_LAST_ID) { + frskyData.analog[2].set(SPORT_DATA_U32(packet), 0); + } + else if (appId >= A4_FIRST_ID && appId <= A4_LAST_ID) { + frskyData.analog[3].set(SPORT_DATA_U32(packet), 0); + } else if (appId >= CELLS_FIRST_ID && appId <= CELLS_LAST_ID) { uint32_t cells = SPORT_DATA_U32(packet); uint8_t battnumber = cells & 0xF;