From 61f56ab915286355f2189290a666f70e91b9eed5 Mon Sep 17 00:00:00 2001 From: bsongis Date: Mon, 19 Mar 2012 20:47:31 +0000 Subject: [PATCH] Temperature threshold missing Time alignement for Bars --- src/frsky.cpp | 8 ++++++-- src/lcd.cpp | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/frsky.cpp b/src/frsky.cpp index 6dc721a44..81c1788bb 100644 --- a/src/frsky.cpp +++ b/src/frsky.cpp @@ -721,6 +721,10 @@ int16_t convertTelemValue(uint8_t channel, uint8_t value) { int16_t result; switch (channel) { + case TELEM_TM1: + case TELEM_TM2: + result = value * 3; + break; case TELEM_ALT: result = value * 4; break; @@ -964,11 +968,11 @@ void menuProcFrsky(uint8_t event) int16_t barMin = convertTelemValue(source, bmin); int16_t barMax = convertTelemValue(source, bmax); if (threshold) { - thresholdX = (uint8_t)(int16_t)((int16_t)100 * (threshold - barMin) / (barMax - barMin)); + thresholdX = (uint8_t)((int32_t)100 * (threshold - barMin) / (barMax - barMin)); if (thresholdX > 100) thresholdX = 0; } - uint8_t width = (uint8_t)limit((int16_t)0, (int16_t)(((int16_t)100 * (value - barMin)) / (barMax - barMin)), (int16_t)100); + uint8_t width = (uint8_t)limit((int16_t)0, (int16_t)(((int32_t)100 * (value - barMin)) / (barMax - barMin)), (int16_t)100); lcd_filled_rect(26, bars_height+6+1+i*(bars_height+6), width, bars_height, (threshold > value) ? DOTTED : SOLID); for (uint8_t j=50; j<125; j+=25) if (j>26+thresholdX || j>26+width) lcd_vline(j, bars_height+6+1+i*(bars_height+6), bars_height); diff --git a/src/lcd.cpp b/src/lcd.cpp index 080e5cde5..6ecb0dc94 100644 --- a/src/lcd.cpp +++ b/src/lcd.cpp @@ -432,7 +432,7 @@ void lcd_filled_rect(uint8_t x, int8_t y, uint8_t w, uint8_t h, uint8_t pat, uin void putsTime(uint8_t x,uint8_t y,int16_t tme,uint8_t att,uint8_t att2) { - if (att & LEFT) x+=2*FW; + if (att & LEFT) x+=3*FW; if (tme<0) { lcd_putcAtt(x - ((att & DBLSIZE) ? FW+1 : FWNUM), y, '-', att);