diff --git a/src/gruvin9x.cpp b/src/gruvin9x.cpp index cf7d97f4c..fab7e7c33 100644 --- a/src/gruvin9x.cpp +++ b/src/gruvin9x.cpp @@ -56,7 +56,7 @@ bool warble = false; uint8_t heartbeat; -// TODO reduce this tab +// TODO reduce these tabs const prog_char APM modi12x3[]= "RUD ELE THR AIL " "RUD THR ELE AIL " @@ -81,20 +81,6 @@ const prog_uint8_t APM modn12x3[]= { 4, 2, 3, 1, 4, 3, 2, 1 }; -#ifdef TRANSLATIONS -int8_t char2idx(char c) -{ - if (c==' ') return 0; - if (c>='A' && c<='Z') return 1+c-'A'; - if (c>='a' && c<='z') return -1-c+'a'; - if (c>='0' && c<='9') return 27+c-'0'; - for (int8_t i=0;;i++) { - char cc = pgm_read_byte(s_charTab+i); - if(cc==c) return 37+i; - if(cc==0) return 0; - } -} -#endif char idx2char(int8_t idx) { @@ -711,7 +697,7 @@ uint8_t checkTrim(uint8_t event) if (k>=0 && k<8) { // && (event & _MSK_KEY_REPT)) //LH_DWN LH_UP LV_DWN LV_UP RV_DWN RV_UP RH_DWN RH_UP - uint8_t idx = k/2; + uint8_t idx = CONVERT_MODE(1+k/2) - 1; uint8_t phase = getTrimFlightPhase(idx, getFlightPhase()); int16_t before = getTrimValue(phase, idx); int8_t v = (s==0) ? min(32, abs(before)/4+1) : 1 << (s-1); // 1=>1 2=>2 3=>4 4=>8 @@ -984,7 +970,7 @@ FORCEINLINE void incTimers(int16_t val) if ( (s_timerVal_10ms[i] += 1 ) >= 100 ) { s_timerVal_10ms[i] -= 100 ; - if (timer->val) s_timerVal[0] = timer->val - s_timerVal[0]; + if (timer->val) s_timerVal[i] = timer->val - s_timerVal[i]; if (atm==TMRMODE_ABS) { s_timerVal[i]++; @@ -1025,7 +1011,7 @@ FORCEINLINE void incTimers(int16_t val) break; } - if (timer->val) s_timerVal[0] = timer->val - s_timerVal[0]; //if counting backwards - display backwards + if (timer->val) s_timerVal[i] = timer->val - s_timerVal[i]; //if counting backwards - display backwards } } diff --git a/src/lcd.cpp b/src/lcd.cpp index 0a99a09a0..3cbbb83da 100644 --- a/src/lcd.cpp +++ b/src/lcd.cpp @@ -497,10 +497,13 @@ void putsTmrMode(uint8_t x, uint8_t y, int8_t mode, uint8_t att) // TODO move this into frsky.cpp void putsTelemetryChannel(uint8_t x, uint8_t y, uint8_t channel, uint8_t val, uint8_t att) { - int16_t converted_value = ((int16_t)val+g_model.frsky.channels[channel].offset)*g_model.frsky.channels[channel].ratio / 255; - if (g_model.frsky.channels[channel].type == 0 && converted_value < 100) { + // TODO optimize this, avoid int32_t + int16_t converted_value = ((int32_t)val+g_model.frsky.channels[channel].offset) * g_model.frsky.channels[channel].ratio * 2 / 51; + if (g_model.frsky.channels[channel].type == 0 && converted_value < 1000) { att |= PREC2; - converted_value = ((int16_t)val+g_model.frsky.channels[channel].offset)*g_model.frsky.channels[channel].ratio*10 / 255; + } + else { + converted_value /= 10; } putsTelemetryValue(x, y, converted_value, g_model.frsky.channels[channel].type, att); } diff --git a/src/main_views.cpp b/src/main_views.cpp index 738d1fd51..3af8ec9cf 100644 --- a/src/main_views.cpp +++ b/src/main_views.cpp @@ -239,7 +239,7 @@ void menuMainView(uint8_t event) static uint8_t x[4] = {128*1/4+2, 4, 128-4, 128*3/4-2}; static uint8_t vert[4] = {0,1,1,0}; uint8_t xm, ym; - xm = x[i]; + xm = x[CONVERT_MODE(i+1)-1]; uint8_t att = 0; int16_t val = getTrimValue(getTrimFlightPhase(i, phase), i);