Mercurial > public > ostc4
comparison Discovery/Src/t3.c @ 758:b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
- Display negative values when time is up and diving continues;
- count down remaining scrubber time only when the dive computer is not set to bailout - after all, there is not much point in counting down time if the diver is not breathing through the scrubber.
author | heinrichsweikamp |
---|---|
date | Wed, 15 Mar 2023 09:18:07 +0100 |
parents | 92bf7bf9fb8a |
children | 4abfb8a2a435 |
comparison
equal
deleted
inserted
replaced
757:39ff186b6f98 | 758:b6d8a6fbf4fd |
---|---|
25 /// You should have received a copy of the GNU General Public License | 25 /// You should have received a copy of the GNU General Public License |
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | 26 /// along with this program. If not, see <http://www.gnu.org/licenses/>. |
27 ////////////////////////////////////////////////////////////////////////////// | 27 ////////////////////////////////////////////////////////////////////////////// |
28 | 28 |
29 /* Includes ------------------------------------------------------------------*/ | 29 /* Includes ------------------------------------------------------------------*/ |
30 #include <stdbool.h> | |
31 | |
30 #include "t3.h" | 32 #include "t3.h" |
31 | 33 |
32 #include "data_exchange_main.h" | 34 #include "data_exchange_main.h" |
33 #include "decom.h" | 35 #include "decom.h" |
34 #include "gfx_fonts.h" | 36 #include "gfx_fonts.h" |
1310 if((pSettings->scrubTimerMode != SCRUB_TIMER_OFF) && isLoopMode(pSettings->dive_mode)) | 1312 if((pSettings->scrubTimerMode != SCRUB_TIMER_OFF) && isLoopMode(pSettings->dive_mode)) |
1311 { | 1313 { |
1312 snprintf(text,TEXTSIZE,"\032\002\f%c",TXT_ScrubTime); | 1314 snprintf(text,TEXTSIZE,"\032\002\f%c",TXT_ScrubTime); |
1313 GFX_write_string(&FontT42,tXc1,text,0); | 1315 GFX_write_string(&FontT42,tXc1,text,0); |
1314 | 1316 |
1315 textpointer = 0; | 1317 textpointer = 0; |
1316 if(settingsGetPointer()->scrubTimerMode == SCRUB_TIMER_MINUTES) | 1318 text[textpointer++] = '\002'; |
1317 { | 1319 textpointer += printScrubberText(&text[textpointer], 10, pSettings); |
1318 textpointer += snprintf(&text[textpointer],10,"\020\002%3u'", pSettings->scrubberData[pSettings->scubberActiveId].TimerCur); | |
1319 } | |
1320 else | |
1321 { | |
1322 textpointer += snprintf(&text[textpointer],20,"\020\002%u\016\016%%\017", (uint16_t)(pSettings->scrubberData[pSettings->scubberActiveId].TimerCur * 100 / pSettings->scrubberData[pSettings->scubberActiveId].TimerMax)); | |
1323 } | |
1324 GFX_write_string(&FontT105,tXc1,text,1); | 1320 GFX_write_string(&FontT105,tXc1,text,1); |
1325 } | 1321 } |
1326 } | 1322 } |
1327 break; | 1323 break; |
1328 | 1324 |
1970 | 1966 |
1971 uint8_t t3_getCustomView(void) | 1967 uint8_t t3_getCustomView(void) |
1972 { | 1968 { |
1973 return t3_selection_customview; | 1969 return t3_selection_customview; |
1974 } | 1970 } |
1971 | |
1972 int printScrubberText(char *text, size_t size, SSettings *settings) | |
1973 { | |
1974 int16_t currentTimerMinutes = settings->scrubberData[settings->scubberActiveId].TimerCur; | |
1975 char colour = '\020'; | |
1976 if (currentTimerMinutes <= 0) { | |
1977 colour = '\025'; | |
1978 } else if (currentTimerMinutes <= 30) { | |
1979 colour = '\024'; | |
1980 } | |
1981 | |
1982 if (settings->scrubTimerMode == SCRUB_TIMER_MINUTES || currentTimerMinutes < 0) { | |
1983 return snprintf(text, size, "%c%3i'", colour, currentTimerMinutes); | |
1984 } else { | |
1985 return snprintf(text, size, "%c%u\016\016%%\017", colour, currentTimerMinutes * 100 / settingsGetPointer()->scrubberData[settings->scubberActiveId].TimerMax); | |
1986 } | |
1987 } |