0=>51 instead of 0=>63 for bar min and bar max

This commit is contained in:
bsongis
2012-02-08 23:10:26 +00:00
parent 3f496b5028
commit a9ac3f2015
2 changed files with 7 additions and 7 deletions
+3 -3
View File
@@ -372,7 +372,7 @@ void menuMainView(uint8_t event)
// The bars
uint8_t bars_height = 5;
for (int8_t i=3; i>=0; i--) {
if (g_model.frsky.bars[i].source && (63-g_model.frsky.bars[i].barMax) > g_model.frsky.bars[i].barMin) {
if (g_model.frsky.bars[i].source && (51-g_model.frsky.bars[i].barMax) > g_model.frsky.bars[i].barMin) {
lcd_putsnAtt(0, bars_height+bars_height+1+i*(bars_height+6), STR_VTELEMBARS+LEN_VTELEMBARS*g_model.frsky.bars[i].source, LEN_VTELEMBARS, 0);
lcd_rect(25, bars_height+6+i*(bars_height+6), 101, bars_height+2);
int16_t value = getValue(CHOUT_BASE+NUM_CHNOUT+MAX_TIMERS+g_model.frsky.bars[i].source-1);
@@ -382,11 +382,11 @@ void menuMainView(uint8_t event)
else
threshold = barsThresholds[g_model.frsky.bars[i].source-3];
if (threshold) {
thresholdX = (uint8_t)(int16_t)((int16_t)100 * (threshold - g_model.frsky.bars[i].barMin * 4) / ((63 - g_model.frsky.bars[i].barMax) * 4 - g_model.frsky.bars[i].barMin * 4));
thresholdX = (uint8_t)(int16_t)((int16_t)100 * (threshold - g_model.frsky.bars[i].barMin * 4) / ((51 - g_model.frsky.bars[i].barMax) * 5 - g_model.frsky.bars[i].barMin * 4));
if (thresholdX > 100)
thresholdX = 0;
}
uint8_t width = (uint8_t)limit((int16_t)0, (int16_t)((int16_t)100 * (value - g_model.frsky.bars[i].barMin * 4) / ((63 - g_model.frsky.bars[i].barMax) * 4 - g_model.frsky.bars[i].barMin * 4)), (int16_t)100);
uint8_t width = (uint8_t)limit((int16_t)0, (int16_t)((int16_t)100 * (value - g_model.frsky.bars[i].barMin * 5) / ((51 - g_model.frsky.bars[i].barMax) * 4 - g_model.frsky.bars[i].barMin * 4)), (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) lcd_vline(j, bars_height+6+1+i*(bars_height+6), bars_height);
+4 -4
View File
@@ -1935,8 +1935,8 @@ void menuProcTelemetry(uint8_t event)
putsStrIdx(0*FW, y, PSTR("Bar"), j+1); // TODO lang
lcd_putsnAtt(5*FW, y, STR_VTELEMBARS+LEN_VTELEMBARS*g_model.frsky.bars[j].source, LEN_VTELEMBARS, sub==subN && m_posHorz==0 ? blink : 0);
if (g_model.frsky.bars[j].source) {
putsTelemetryChannel(TELEM_COL2, y, g_model.frsky.bars[j].source-1, g_model.frsky.bars[j].barMin*4, (sub==subN && m_posHorz==1 ? blink : 0) | LEFT);
putsTelemetryChannel(16*FW-3, y, g_model.frsky.bars[j].source-1, (63-g_model.frsky.bars[j].barMax)*4, (sub==subN && m_posHorz==2 ? blink : 0) | LEFT);
putsTelemetryChannel(TELEM_COL2, y, g_model.frsky.bars[j].source-1, g_model.frsky.bars[j].barMin*5, (sub==subN && m_posHorz==1 ? blink : 0) | LEFT);
putsTelemetryChannel(16*FW-3, y, g_model.frsky.bars[j].source-1, (51-g_model.frsky.bars[j].barMax)*5, (sub==subN && m_posHorz==2 ? blink : 0) | LEFT);
}
else {
if (sub == subN) m_posHorz = 0;
@@ -1947,10 +1947,10 @@ void menuProcTelemetry(uint8_t event)
CHECK_INCDEC_MODELVAR(event, g_model.frsky.bars[j].source, 0, 9); // TODO enum
break;
case 1:
CHECK_INCDEC_MODELVAR(event, g_model.frsky.bars[j].barMin, 0, 62-g_model.frsky.bars[j].barMax);
CHECK_INCDEC_MODELVAR(event, g_model.frsky.bars[j].barMin, 0, 50-g_model.frsky.bars[j].barMax);
break;
case 2:
g_model.frsky.bars[j].barMax = 63 - checkIncDec(event, 63 - g_model.frsky.bars[j].barMax, g_model.frsky.bars[j].barMin+1, 63, EE_MODEL);
g_model.frsky.bars[j].barMax = 51 - checkIncDec(event, 51 - g_model.frsky.bars[j].barMax, g_model.frsky.bars[j].barMin+1, 51, EE_MODEL);
break;
}
}