feat: Allow the timer count direction to be selected (#2038)
* timer direction: ellapsed or left * Add AUDIO announcement support * Storage for showElapsed * Translations * Fix storage * BW implementation * Different BW implementation * Companion support * Color LCD implementation and rebase to lvgl * Fix problems found by raphaelcoeffic * chore: Regenerate the YAML files properly * fix: Remove unused `TR_SHOW` remnant * chore: Formatting and cleanup * fix: Timer dir choice was shown in wrong place Wrong newline used in ce23b50 * Fix cpn ui triggers, remove unnecessary code and some formatting * fix(colorlcd): Hide timer dir opt if zero value Co-authored-by: Peter Feerick <peter.feerick@gmail.com> Co-authored-by: elecpower <neilh713@tpg.com.au>
This commit is contained in:
co-authored by
Peter Feerick
elecpower
parent
415b566a79
commit
be7a6a51ab
@@ -925,18 +925,23 @@ void drawTimerWithMode(coord_t x, coord_t y, uint8_t index, LcdFlags att)
|
||||
const TimerData &timer = g_model.timers[index];
|
||||
|
||||
if (timer.mode) {
|
||||
const TimerData &timerData = g_model.timers[index];
|
||||
const TimerState &timerState = timersStates[index];
|
||||
const uint8_t negative = (timerState.val < 0 ? BLINK | INVERS : 0);
|
||||
if (timerState.val < 60 * 60) { // display MM:SS
|
||||
div_t qr = div((int) abs(timerState.val), 60);
|
||||
int val = timerState.val;
|
||||
if (timerData.start && timerData.showElapsed &&
|
||||
timerData.start != timerState.val)
|
||||
val = (int)timerData.start - (int)timerState.val;
|
||||
if (val < 60 * 60) { // display MM:SS
|
||||
div_t qr = div((int) abs(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);
|
||||
else if (val < (99 * 60 * 60) + (59 * 60)) { // display HHhMM
|
||||
div_t qr = div((int) (abs(val) / 60), 60);
|
||||
lcdDrawNumber(x - 5, y, qr.rem, att | LEADING0, 2);
|
||||
lcdDrawText(lcdLastLeftPos, y, "h", att);
|
||||
lcdDrawNumber(lcdLastLeftPos, y, qr.quot, att);
|
||||
@@ -945,7 +950,7 @@ void drawTimerWithMode(coord_t x, coord_t y, uint8_t index, LcdFlags att)
|
||||
}
|
||||
else { //display HHHH for crazy large persistent timers
|
||||
lcdDrawText(x - 5, y, "h", att);
|
||||
lcdDrawNumber(lcdLastLeftPos, y, timerState.val / 3600, att);
|
||||
lcdDrawNumber(lcdLastLeftPos, y, val / 3600, att);
|
||||
}
|
||||
uint8_t xLabel = (negative ? x - 56 : x - 49);
|
||||
uint8_t len = zlen(timer.name, LEN_TIMER_NAME);
|
||||
|
||||
Reference in New Issue
Block a user