Mercurial > public > ostc4
diff Discovery/Src/t3.c @ 998:5a690195b6b7 GasConsumption
Added dual operation of scrubber timers:
In the previous version only one scrubber timer could be selected for operation. In the new version the activation of both timers is possible. In that case both timers will be displayed as well. To enable this a new activation item has been added to the scrubber menu.
| author | Ideenmodellierer |
|---|---|
| date | Wed, 23 Apr 2025 14:52:03 +0200 |
| parents | 8507a87f6401 |
| children | 8c0134a287da |
line wrap: on
line diff
--- a/Discovery/Src/t3.c Wed Apr 23 14:47:42 2025 +0200 +++ b/Discovery/Src/t3.c Wed Apr 23 14:52:03 2025 +0200 @@ -1998,19 +1998,40 @@ int printScrubberText(char *text, size_t size, const SScrubberData *scrubberData, SSettings *settings) { - int16_t currentTimerMinutes = scrubberData[settings->scubberActiveId].TimerCur; - char colour = '\020'; - if (currentTimerMinutes <= 0) { - colour = '\025'; - } else if (currentTimerMinutes <= 30) { - colour = '\024'; - } + uint8_t timerId = 0; + int16_t currentTimerMinutes = 0; + char colour = 0; + uint8_t textIndex = 0; - if (settings->scrubTimerMode == SCRUB_TIMER_MINUTES || currentTimerMinutes < 0) { - return snprintf(text, size, "%c%3i'", colour, currentTimerMinutes); - } else { - return snprintf(text, size, "%c%u\016\016%%\017", colour, currentTimerMinutes * 100 / settingsGetPointer()->scrubberData[settings->scubberActiveId].TimerMax); - } + for(timerId = 0; timerId < 2; timerId++) + { + if(settings->scubberActiveId & (1 << timerId)) + { + currentTimerMinutes = scrubberData[timerId].TimerCur; + colour = '\020'; + if (currentTimerMinutes <= 0) + { + colour = '\025'; + } + else if (currentTimerMinutes <= 30) + { + colour = '\024'; + } + if (settings->scrubTimerMode == SCRUB_TIMER_MINUTES || currentTimerMinutes < 0) + { + textIndex += snprintf(&text[textIndex], size, "%c%3i'", colour, currentTimerMinutes); + } + else + { + textIndex += snprintf(&text[textIndex], size, "%c%u\016\016%%\017", colour, currentTimerMinutes * 100 / settingsGetPointer()->scrubberData[timerId].TimerMax); + } + if((settings->scubberActiveId == 3) && (timerId == 0)) /* both timers are active => print separator */ + { + textIndex += snprintf(&text[textIndex], size, " | "); + } + } + } + return textIndex; } void t3_AF_updateBorderConditions()
