From 5ead4d85825e0c449dc648a6e68ff12e7abc2853 Mon Sep 17 00:00:00 2001 From: bsongis Date: Fri, 29 Aug 2014 15:54:28 +0200 Subject: [PATCH] Fixes #1655 --- radio/src/gui/menu_model.cpp | 6 ++++-- radio/src/mixer.cpp | 3 ++- radio/src/opentx.cpp | 23 +++++++++++++++++++++-- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/radio/src/gui/menu_model.cpp b/radio/src/gui/menu_model.cpp index 62f4c191b..d449acb9f 100644 --- a/radio/src/gui/menu_model.cpp +++ b/radio/src/gui/menu_model.cpp @@ -3167,12 +3167,13 @@ void menuModelExpoOne(uint8_t event) if (ed->srcRaw >= MIXSRC_FIRST_TELEM) { putsTelemetryChannel(LCD_W-8, 6*FH, ed->srcRaw - MIXSRC_FIRST_TELEM, x512, 0); if (ed->scale > 0) x512 = (x512 * 1024) / convertTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1, ed->scale); - x512 = limit(-1024, x512, 1024); } else { lcd_outdezAtt(LCD_W-8, 6*FH, calcRESXto1000(x512), PREC1); } + x512 = limit(-1024, x512, 1024); int y512 = expoFn(x512); + y512 = limit(-1024, y512, 1024); lcd_outdezAtt(LCD_W-8-6*FW, 1*FH, calcRESXto1000(y512), PREC1); #else int16_t x512 = calibratedStick[ed->chn]; @@ -3181,10 +3182,11 @@ void menuModelExpoOne(uint8_t event) lcd_outdezAtt(LCD_W-8-6*FW, 1*FH, calcRESXto100(y512), 0); #endif - x512 = X0+x512/(RESXu/WCHART); #if defined(CPUARM) + x512 = X0+x512/(RESX/WCHART); y512 = (LCD_H-1) - ((y512+RESX)/2) * (LCD_H-1) / RESX; #else + x512 = X0+x512/(RESXu/WCHART); y512 = (LCD_H-1) - (uint16_t)((y512+RESX)/2) * (LCD_H-1) / RESX; #endif diff --git a/radio/src/mixer.cpp b/radio/src/mixer.cpp index 627aff74a..82e075aab 100755 --- a/radio/src/mixer.cpp +++ b/radio/src/mixer.cpp @@ -106,8 +106,9 @@ void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS) else { v = getValue(ed->srcRaw); if (ed->srcRaw >= MIXSRC_FIRST_TELEM && ed->scale > 0) { - v = limit(-1024, int((v * 1024) / convertTelemValue(ed->srcRaw-MIXSRC_FIRST_TELEM+1, ed->scale)), 1024); + v = (v * 1024) / convertTelemValue(ed->srcRaw-MIXSRC_FIRST_TELEM+1, ed->scale); } + v = limit(-1024, v, 1024); } #else int16_t v = anas2[ed->chn]; diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 2daf22cbe..205b4472c 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -467,6 +467,23 @@ void modelDefault(uint8_t id) g_model.mavlink.pc_rssi_en = 1; #endif } + +#if defined(PCBTARANIS) +bool isInputRecursive(int index) +{ + ExpoData * line = expoAddress(0); + for (int i=0; ichn > index) + break; + else if (line->chn < index) + continue; + else if (line->srcRaw >= MIXSRC_FIRST_LOGICAL_SWITCH) + return true; + } + return false; +} +#endif + #if defined(AUTOSOURCE) int8_t getMovedSource(GET_MOVED_SOURCE_PARAMS) { @@ -478,8 +495,10 @@ int8_t getMovedSource(GET_MOVED_SOURCE_PARAMS) if (min <= MIXSRC_FIRST_INPUT) { for (uint8_t i=0; i 512) { - result = MIXSRC_FIRST_INPUT+i; - break; + if (!isInputRecursive(i)) { + result = MIXSRC_FIRST_INPUT+i; + break; + } } } }