Mercurial > public > ostc4
comparison Discovery/Src/t7.c @ 1014:8c0134a287da GasConsumption
Add a log data event to the scrubber timer at the start of the dive and every time the timer (in minutes)
is decremented. The event contains a 12 bit signed integer for the remaining scrubber duration, and two
flags for scrubber warning (0x2000, <= 30 minutes remaining) and scrubber error (0x4000, <= 0 minutes remaining).
(mikeller)
| author | heinrichsweikamp |
|---|---|
| date | Sun, 11 May 2025 16:18:20 +0200 |
| parents | 23c405d5a766 |
| children | 6e11f7327efd |
comparison
equal
deleted
inserted
replaced
| 1013:fa1af49319e5 | 1014:8c0134a287da |
|---|---|
| 1833 | 1833 |
| 1834 i++; | 1834 i++; |
| 1835 } | 1835 } |
| 1836 | 1836 |
| 1837 bool showScrubberTime = false; | 1837 bool showScrubberTime = false; |
| 1838 if (settings->scrubTimerMode != SCRUB_TIMER_OFF) { | 1838 if (isScrubberTimerEnabled(settings)) { |
| 1839 numLines++; | 1839 numLines++; |
| 1840 showScrubberTime = true; | 1840 showScrubberTime = true; |
| 1841 } | 1841 } |
| 1842 | 1842 |
| 1843 bool showManualSetpoints = false; | 1843 bool showManualSetpoints = false; |
| 1980 heading[headingIndex++] = TXT_2BYTE; | 1980 heading[headingIndex++] = TXT_2BYTE; |
| 1981 heading[headingIndex++] = TXT2BYTE_Scrubber; | 1981 heading[headingIndex++] = TXT2BYTE_Scrubber; |
| 1982 | 1982 |
| 1983 data[dataIndex++] = '\n'; | 1983 data[dataIndex++] = '\n'; |
| 1984 data[dataIndex++] = '\r'; | 1984 data[dataIndex++] = '\r'; |
| 1985 data[dataIndex++] = '\002'; | 1985 data[dataIndex++] = '\t'; |
| 1986 if(settings->scubberActiveId == 3) /* switch to small font size to avoid bad alignment */ | 1986 dataIndex += printScrubberText(&data[dataIndex], 10, settings->scrubberData, settings, false); |
| 1987 { | |
| 1988 data[dataIndex++] = '\016'; | |
| 1989 data[dataIndex++] = '\016'; | |
| 1990 } | |
| 1991 dataIndex += printScrubberText(&data[dataIndex], 10, settings->scrubberData, settings); | |
| 1992 if(settings->scubberActiveId == 3) | |
| 1993 { | |
| 1994 data[dataIndex++] = ' '; | |
| 1995 data[dataIndex++] = ' '; | |
| 1996 } | |
| 1997 | |
| 1998 } | 1987 } |
| 1999 | 1988 |
| 2000 heading[headingIndex++] = '\017'; | 1989 heading[headingIndex++] = '\017'; |
| 2001 heading[headingIndex++] = 0; | 1990 heading[headingIndex++] = 0; |
| 2002 | 1991 |
| 3281 | 3270 |
| 3282 if((stateUsed->diveSettings.deco_type.ub.standard == VPM_MODE) && (selection_custom_field == LLC_GF)) /* no GF if in VPM mode */ | 3271 if((stateUsed->diveSettings.deco_type.ub.standard == VPM_MODE) && (selection_custom_field == LLC_GF)) /* no GF if in VPM mode */ |
| 3283 { | 3272 { |
| 3284 selection_custom_field++; | 3273 selection_custom_field++; |
| 3285 } | 3274 } |
| 3286 if((selection_custom_field == LLC_ScrubberTime) && ((settingsGetPointer()->scrubTimerMode == SCRUB_TIMER_OFF) || (!isLoopMode(settingsGetPointer()->dive_mode)))) | 3275 SSettings *settings = settingsGetPointer(); |
| 3287 { | 3276 if (selection_custom_field == LLC_ScrubberTime && !isScrubberTimerEnabled(settings)) { |
| 3288 selection_custom_field++; | 3277 selection_custom_field++; |
| 3289 } | 3278 } |
| 3290 #ifdef ENABLE_PSCR_MODE | 3279 #ifdef ENABLE_PSCR_MODE |
| 3291 if((selection_custom_field == LCC_SimPpo2) && (settingsGetPointer()->dive_mode != DIVEMODE_PSCR)) | 3280 if((selection_custom_field == LCC_SimPpo2) && (settings->dive_mode != DIVEMODE_PSCR)) |
| 3292 { | 3281 { |
| 3293 selection_custom_field++; | 3282 selection_custom_field++; |
| 3294 } | 3283 } |
| 3295 #endif | 3284 #endif |
| 3296 #ifdef ENABLE_CO2_SUPPORT | 3285 #ifdef ENABLE_CO2_SUPPORT |
| 3297 if((selection_custom_field == LCC_CO2) && (settingsGetPointer()->co2_sensor_active == 0)) | 3286 if((selection_custom_field == LCC_CO2) && (settings->co2_sensor_active == 0)) |
| 3298 { | 3287 { |
| 3299 selection_custom_field++; | 3288 selection_custom_field++; |
| 3300 } | 3289 } |
| 3301 | 3290 |
| 3302 #endif | 3291 #endif |
| 3313 if(!selection_custom_field) | 3302 if(!selection_custom_field) |
| 3314 return; | 3303 return; |
| 3315 | 3304 |
| 3316 char headerText[10]; | 3305 char headerText[10]; |
| 3317 char text[TEXTSIZE]; | 3306 char text[TEXTSIZE]; |
| 3318 char tmpString[TEXTSIZE]; | |
| 3319 uint8_t textpointer = 0; | 3307 uint8_t textpointer = 0; |
| 3320 uint8_t index = 0; | |
| 3321 _Bool tinyHeaderFont = 0; | 3308 _Bool tinyHeaderFont = 0; |
| 3322 uint8_t line = 0; | 3309 uint8_t line = 0; |
| 3323 #ifdef ENABLE_BOTTLE_SENSOR | 3310 #ifdef ENABLE_BOTTLE_SENSOR |
| 3324 uint16_t agedColor = 0; | 3311 uint16_t agedColor = 0; |
| 3325 #endif | 3312 #endif |
| 3431 | 3418 |
| 3432 case LLC_ScrubberTime: | 3419 case LLC_ScrubberTime: |
| 3433 tinyHeaderFont = 1; | 3420 tinyHeaderFont = 1; |
| 3434 headerText[2] = TXT_ScrubTime; | 3421 headerText[2] = TXT_ScrubTime; |
| 3435 | 3422 |
| 3436 textpointer = printScrubberText(text, TEXTSIZE, stateUsed->scrubberDataDive, pSettings); | 3423 bool useTwoLines = (pSettings->scrubberActiveId == 0x03); |
| 3437 if (pSettings->scubberActiveId == 3) /* both timer active */ | 3424 textpointer = printScrubberText(text, TEXTSIZE, stateUsed->scrubberDataDive, pSettings, useTwoLines); |
| 3438 { | |
| 3439 snprintf(tmpString,TEXTSIZE,"\016\016%s",text); | |
| 3440 for(index = 0; index < textpointer; index++) | |
| 3441 { | |
| 3442 if(tmpString[index] == '\017') /* remove switch to normal font */ | |
| 3443 { | |
| 3444 tmpString[index] = ' '; | |
| 3445 } | |
| 3446 if(tmpString[index] == '|') /* replace separator with new line */ | |
| 3447 { | |
| 3448 tmpString[index] = '\n'; | |
| 3449 tmpString[index+1] = '\r'; | |
| 3450 break; | |
| 3451 } | |
| 3452 } | |
| 3453 line = 1; | |
| 3454 strcpy(text,tmpString); | |
| 3455 } | |
| 3456 | 3425 |
| 3457 break; | 3426 break; |
| 3458 #ifdef ENABLE_PSCR_MODE | 3427 #ifdef ENABLE_PSCR_MODE |
| 3459 case LCC_SimPpo2: | 3428 case LCC_SimPpo2: |
| 3460 headerText[2] = TXT_SimPpo2; | 3429 headerText[2] = TXT_SimPpo2; |
| 4224 t7cY0free.WindowY1 = 400; | 4193 t7cY0free.WindowY1 = 400; |
| 4225 } | 4194 } |
| 4226 | 4195 |
| 4227 t7cY0free.WindowLineSpacing = 48; | 4196 t7cY0free.WindowLineSpacing = 48; |
| 4228 t7cY0free.WindowNumberOfTextLines = 6; | 4197 t7cY0free.WindowNumberOfTextLines = 6; |
| 4229 t7cY0free.WindowTab = 420; | 4198 t7cY0free.WindowTab = 380; |
| 4230 | 4199 |
| 4231 // header | 4200 // header |
| 4232 textpointer = 0; | 4201 textpointer = 0; |
| 4233 text[textpointer++] = '\032'; | 4202 text[textpointer++] = '\032'; |
| 4234 text[textpointer++] = '\016'; | 4203 text[textpointer++] = '\016'; |
| 4246 text[textpointer++] = '\n'; | 4215 text[textpointer++] = '\n'; |
| 4247 text[textpointer++] = '\r'; | 4216 text[textpointer++] = '\r'; |
| 4248 text[textpointer++] = TXT_FutureTTS; | 4217 text[textpointer++] = TXT_FutureTTS; |
| 4249 text[textpointer++] = '\n'; | 4218 text[textpointer++] = '\n'; |
| 4250 text[textpointer++] = '\r'; | 4219 text[textpointer++] = '\r'; |
| 4251 if((pSettings->scrubTimerMode != SCRUB_TIMER_OFF) && (isLoopMode(pSettings->dive_mode))) | 4220 if (isScrubberTimerEnabled(pSettings)) { |
| 4252 { | 4221 text[textpointer++] = TXT_2BYTE; |
| 4253 text[textpointer++] = TXT_ScrubTime; | 4222 text[textpointer++] = TXT2BYTE_Scrubber; |
| 4254 | |
| 4255 } | 4223 } |
| 4256 text[textpointer++] = '\017'; | 4224 text[textpointer++] = '\017'; |
| 4257 text[textpointer++] = 0; | 4225 text[textpointer++] = 0; |
| 4258 if(!pSettings->FlipDisplay) | 4226 if(!pSettings->FlipDisplay) |
| 4259 { | 4227 { |
| 4295 if (pDecoinfoFuture->output_time_to_surface_seconds < 1000 * 60) | 4263 if (pDecoinfoFuture->output_time_to_surface_seconds < 1000 * 60) |
| 4296 textpointer += snprintf(&text[textpointer],10,"\020%i'", (pDecoinfoFuture->output_time_to_surface_seconds + 59) / 60); | 4264 textpointer += snprintf(&text[textpointer],10,"\020%i'", (pDecoinfoFuture->output_time_to_surface_seconds + 59) / 60); |
| 4297 else | 4265 else |
| 4298 textpointer += snprintf(&text[textpointer],10,"\020%ih", (pDecoinfoFuture->output_time_to_surface_seconds + 59) / 3600); | 4266 textpointer += snprintf(&text[textpointer],10,"\020%ih", (pDecoinfoFuture->output_time_to_surface_seconds + 59) / 3600); |
| 4299 | 4267 |
| 4300 if((pSettings->scrubTimerMode != SCRUB_TIMER_OFF) && (isLoopMode(pSettings->dive_mode))) | 4268 if (isScrubberTimerEnabled(pSettings)) { |
| 4301 { | |
| 4302 text[textpointer++] = '\n'; | 4269 text[textpointer++] = '\n'; |
| 4303 text[textpointer++] = '\r'; | 4270 text[textpointer++] = '\r'; |
| 4304 text[textpointer++] = '\t'; | 4271 text[textpointer++] = '\t'; |
| 4305 | 4272 |
| 4306 textpointer += printScrubberText(&text[textpointer], 10, stateUsed->scrubberDataDive, pSettings); | 4273 textpointer += printScrubberText(&text[textpointer], 10, stateUsed->scrubberDataDive, pSettings, false); |
| 4307 } | 4274 } |
| 4308 text[textpointer++] = 0; | 4275 text[textpointer++] = 0; |
| 4309 Gfx_colorsscheme_mod(text, 0); | 4276 Gfx_colorsscheme_mod(text, 0); |
| 4310 GFX_write_string(&FontT42, &t7cY0free, text, 1); | 4277 GFX_write_string(&FontT42, &t7cY0free, text, 1); |
| 4311 } | 4278 } |
