Fix timer displays in telem view (#7146)
Fix timer displays in telem view
This commit is contained in:
@@ -177,45 +177,6 @@ void displayTrims(uint8_t phase)
|
||||
}
|
||||
}
|
||||
|
||||
void drawTimerWithMode(coord_t x, coord_t y, uint8_t index)
|
||||
{
|
||||
const TimerData & timer = g_model.timers[index];
|
||||
|
||||
if (timer.mode) {
|
||||
const TimerState & timerState = timersStates[index];
|
||||
const uint8_t negative = (timerState.val<0 ? BLINK | INVERS : 0);
|
||||
LcdFlags att = RIGHT | DBLSIZE;
|
||||
if (timerState.val < 60 * 60) { // display MM:SS
|
||||
div_t qr = div((int)abs(timerState.val), 60);
|
||||
lcdDrawNumber(x - 5, y, qr.rem, att | LEADING0 | negative, 2);
|
||||
lcdDrawText(lcdLastLeftPos, y, ":", att|BLINK | negative);
|
||||
lcdDrawNumber(lcdLastLeftPos, y, qr.quot, att | negative);
|
||||
if (negative)
|
||||
lcdDrawText(lcdLastLeftPos, y, "-", att | negative);
|
||||
}
|
||||
else if (timerState.val < (99 * 60 * 60) + (59 * 60)) { // display HHhMM
|
||||
div_t qr = div((int)(abs(timerState.val) / 60), 60);
|
||||
lcdDrawNumber(x - 5, y, qr.rem, att | LEADING0, 2);
|
||||
lcdDrawText(lcdLastLeftPos, y, "h", att);
|
||||
lcdDrawNumber(lcdLastLeftPos, y, qr.quot, att);
|
||||
if (negative)
|
||||
lcdDrawText(lcdLastLeftPos, y, "-", att);
|
||||
}
|
||||
else { //display HHHH for crazy large persistent timers
|
||||
lcdDrawText(x - 5, y, "h", att);
|
||||
lcdDrawNumber(lcdLastLeftPos, y, timerState.val / 3600, att);
|
||||
}
|
||||
uint8_t xLabel = (negative ? x-56 : x-49);
|
||||
uint8_t len = zlen(timer.name, LEN_TIMER_NAME);
|
||||
if (len > 0) {
|
||||
lcdDrawSizedText(xLabel, y+FH, timer.name, len, RIGHT | ZCHAR);
|
||||
}
|
||||
else {
|
||||
drawTimerMode(xLabel, y+FH, timer.mode, RIGHT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void displayBattVoltage()
|
||||
{
|
||||
#if defined(BATTGRAPH)
|
||||
@@ -461,7 +422,7 @@ void menuMainView(event_t event)
|
||||
displayVoltageOrAlarm();
|
||||
|
||||
// Timer 1
|
||||
drawTimerWithMode(125, 2*FH, 0);
|
||||
drawTimerWithMode(125, 2*FH, 0, RIGHT | DBLSIZE);
|
||||
|
||||
// Trims sliders
|
||||
displayTrims(mode);
|
||||
@@ -599,7 +560,7 @@ void menuMainView(event_t event)
|
||||
}
|
||||
else {
|
||||
// Timer2
|
||||
drawTimerWithMode(87, 5*FH, 1);
|
||||
drawTimerWithMode(87, 5*FH, 1, RIGHT | DBLSIZE);
|
||||
}
|
||||
|
||||
// And ! in case of unexpected shutdown
|
||||
|
||||
Reference in New Issue
Block a user