Mercurial > public > ostc4
comparison Discovery/Src/tMenuEditXtra.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 | 5a690195b6b7 |
| children | 808153ba3fec |
comparison
equal
deleted
inserted
replaced
| 1013:fa1af49319e5 | 1014:8c0134a287da |
|---|---|
| 227 | 227 |
| 228 | 228 |
| 229 snprintf(&text[0], 32,"%c \002#%d",TXT_ScrubTime,scrubberMenuId); | 229 snprintf(&text[0], 32,"%c \002#%d",TXT_ScrubTime,scrubberMenuId); |
| 230 write_field_button(StMXTRA_ScrubTimer, 20, 780, ME_Y_LINE1, &FontT48, text); | 230 write_field_button(StMXTRA_ScrubTimer, 20, 780, ME_Y_LINE1, &FontT48, text); |
| 231 | 231 |
| 232 if(pSettings->scubberActiveId & (1 << scrubberMenuId)) | 232 if(pSettings->scrubberActiveId & (1 << scrubberMenuId)) |
| 233 { | 233 { |
| 234 snprintf(&text[0], 32,"%c %c \002\005", TXT_ScrubTime, TXT_Active); | 234 snprintf(&text[0], 32,"%c %c \002\005", TXT_ScrubTime, TXT_Active); |
| 235 } | 235 } |
| 236 else | 236 else |
| 237 { | 237 { |
| 253 printScrubberResetText(text, pSettings, scrubberMenuId); | 253 printScrubberResetText(text, pSettings, scrubberMenuId); |
| 254 write_field_button(StMXTRA_ScrubTimer_Reset, 20, 780, ME_Y_LINE4, &FontT48, text); | 254 write_field_button(StMXTRA_ScrubTimer_Reset, 20, 780, ME_Y_LINE4, &FontT48, text); |
| 255 | 255 |
| 256 if(pSettings->scrubberData[scrubberMenuId].lastDive.WeekDay != 0) | 256 if(pSettings->scrubberData[scrubberMenuId].lastDive.WeekDay != 0) |
| 257 { | 257 { |
| 258 snprintf(&text[0], 32,"%c%c\002 %02d.%02d.%02d", TXT_2BYTE, TXT2BYTE_SimDiveTime, pSettings->scrubberData[scrubberMenuId].lastDive.Date, | 258 snprintf(&text[0], 32, "%c%c\002 %02d.%02d.%02d", TXT_2BYTE, TXT2BYTE_SimDiveTime, pSettings->scrubberData[scrubberMenuId].lastDive.Date, pSettings->scrubberData[scrubberMenuId].lastDive.Month, pSettings->scrubberData[scrubberMenuId].lastDive.Year); |
| 259 pSettings->scrubberData[scrubberMenuId].lastDive.Month, | |
| 260 pSettings->scrubberData[scrubberMenuId].lastDive.Year); | |
| 261 } | 259 } |
| 262 else | 260 else |
| 263 { | 261 { |
| 264 snprintf(&text[0], 32,"%c%c\002 --.--.--", TXT_2BYTE, TXT2BYTE_SimDiveTime); | 262 snprintf(&text[0], 32,"%c%c\002 --.--.--", TXT_2BYTE, TXT2BYTE_SimDiveTime); |
| 265 } | 263 } |
| 266 write_label_var( 20, 780, ME_Y_LINE5, &FontT48, text); | 264 write_label_var( 20, 780, ME_Y_LINE5, &FontT48, text); |
| 267 | 265 |
| 268 switch(pSettings->scrubTimerMode) | 266 switch (pSettings->scrubTimerMode) { |
| 269 { | 267 case SCRUB_TIMER_MINUTES: |
| 270 case SCRUB_TIMER_OFF: | 268 default: |
| 271 default: snprintf(&text[0], 32,"%c\002%c%c",TXT_ScrubTimeMode, TXT_2BYTE, TXT2BYTE_MoCtrlNone ); | 269 snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Minutes ); |
| 272 break; | 270 |
| 273 case SCRUB_TIMER_MINUTES: snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Minutes ); | 271 break; |
| 274 break; | 272 case SCRUB_TIMER_PERCENT: |
| 275 case SCRUB_TIMER_PERCENT: snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Percent ); | 273 snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Percent ); |
| 276 break; | 274 |
| 277 } | 275 break; |
| 276 } | |
| 278 write_field_button(StMXTRA_ScrubTimer_OP_Mode, 20, 780, ME_Y_LINE6, &FontT48, text); | 277 write_field_button(StMXTRA_ScrubTimer_OP_Mode, 20, 780, ME_Y_LINE6, &FontT48, text); |
| 279 | 278 |
| 280 setEvent(StMXTRA_ScrubTimer, (uint32_t)OnAction_ScrubberTimerId); | 279 setEvent(StMXTRA_ScrubTimer, (uint32_t)OnAction_ScrubberTimerId); |
| 281 setEvent(StMXTRA_ScrubTimer_Active, (uint32_t)OnAction_ScrubberActive); | 280 setEvent(StMXTRA_ScrubTimer_Active, (uint32_t)OnAction_ScrubberActive); |
| 282 setEvent(StMXTRA_ScrubTimer_Max, (uint32_t)OnAction_ScrubberTimerMax); | 281 setEvent(StMXTRA_ScrubTimer_Max, (uint32_t)OnAction_ScrubberTimerMax); |
| 476 { | 475 { |
| 477 char text[32]; | 476 char text[32]; |
| 478 SSettings *pSettings; | 477 SSettings *pSettings; |
| 479 pSettings = settingsGetPointer(); | 478 pSettings = settingsGetPointer(); |
| 480 | 479 |
| 481 | |
| 482 if(scrubberMenuId == 0) | 480 if(scrubberMenuId == 0) |
| 483 { | 481 { |
| 484 scrubberMenuId = 1; | 482 scrubberMenuId = 1; |
| 485 } | 483 } |
| 486 else | 484 else |
| 496 | 494 |
| 497 tMenuEdit_newInput(StMXTRA_ScrubTimer_Max, pSettings->scrubberData[scrubberMenuId].TimerMax, 0, 0, 0); | 495 tMenuEdit_newInput(StMXTRA_ScrubTimer_Max, pSettings->scrubberData[scrubberMenuId].TimerMax, 0, 0, 0); |
| 498 | 496 |
| 499 if(pSettings->scrubberData[scrubberMenuId].lastDive.WeekDay != 0) | 497 if(pSettings->scrubberData[scrubberMenuId].lastDive.WeekDay != 0) |
| 500 { | 498 { |
| 501 snprintf(&text[0], 32,"%c%c\002 %02d.%02d.%02d", TXT_2BYTE, TXT2BYTE_SimDiveTime, pSettings->scrubberData[scrubberMenuId].lastDive.Date, | 499 snprintf(&text[0], 32, "%c%c\002 %02d.%02d.%02d", TXT_2BYTE, TXT2BYTE_SimDiveTime, pSettings->scrubberData[scrubberMenuId].lastDive.Date, pSettings->scrubberData[scrubberMenuId].lastDive.Month, pSettings->scrubberData[scrubberMenuId].lastDive.Year); |
| 502 pSettings->scrubberData[scrubberMenuId].lastDive.Month, | |
| 503 pSettings->scrubberData[scrubberMenuId].lastDive.Year); | |
| 504 } | 500 } |
| 505 else | 501 else |
| 506 { | 502 { |
| 507 snprintf(&text[0], 32,"%c%c\002 --.--.--", TXT_2BYTE, TXT2BYTE_SimDiveTime); | 503 snprintf(&text[0], 32,"%c%c\002 --.--.--", TXT_2BYTE, TXT2BYTE_SimDiveTime); |
| 508 } | 504 } |
| 509 clean_content( 20, 780, ME_Y_LINE5, &FontT48); | 505 clean_content( 20, 780, ME_Y_LINE5, &FontT48); |
| 510 write_label_var( 20, 780, ME_Y_LINE5, &FontT48, text); | 506 write_label_var( 20, 780, ME_Y_LINE5, &FontT48, text); |
| 511 | 507 |
| 512 if(pSettings->scubberActiveId & (1 << scrubberMenuId)) | 508 if(pSettings->scrubberActiveId & (1 << scrubberMenuId)) |
| 513 { | 509 { |
| 514 snprintf(&text[0], 32,"%c %c \002\005", TXT_ScrubTime, TXT_Active); | 510 snprintf(&text[0], 32,"%c %c \002\005", TXT_ScrubTime, TXT_Active); |
| 515 } | 511 } |
| 516 else | 512 else |
| 517 { | 513 { |
| 587 char text[32]; | 583 char text[32]; |
| 588 uint8_t newMode; | 584 uint8_t newMode; |
| 589 SSettings *pSettings; | 585 SSettings *pSettings; |
| 590 pSettings = settingsGetPointer(); | 586 pSettings = settingsGetPointer(); |
| 591 newMode = pSettings->scrubTimerMode + 1; | 587 newMode = pSettings->scrubTimerMode + 1; |
| 592 if(newMode >= SCRUB_TIMER_END) | 588 if (newMode >= SCRUB_TIMER_END) { |
| 593 { | 589 newMode = SCRUB_TIMER_MINUTES; |
| 594 newMode = SCRUB_TIMER_OFF; | |
| 595 } | 590 } |
| 596 pSettings->scrubTimerMode = newMode; | 591 pSettings->scrubTimerMode = newMode; |
| 597 | 592 |
| 598 switch(pSettings->scrubTimerMode) | 593 switch (pSettings->scrubTimerMode) { |
| 599 { | 594 case SCRUB_TIMER_MINUTES: |
| 600 case SCRUB_TIMER_OFF: | 595 default: |
| 601 default: snprintf(&text[0], 32,"%c\002%c%c",TXT_ScrubTimeMode, TXT_2BYTE, TXT2BYTE_MoCtrlNone ); | 596 snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Minutes ); |
| 602 break; | 597 |
| 603 case SCRUB_TIMER_MINUTES: snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Minutes ); | 598 break; |
| 604 break; | 599 case SCRUB_TIMER_PERCENT: |
| 605 case SCRUB_TIMER_PERCENT: snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Percent ); | 600 snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Percent ); |
| 606 break; | 601 |
| 607 } | 602 break; |
| 603 } | |
| 608 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_OP_Mode, text); | 604 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_OP_Mode, text); |
| 609 | 605 |
| 610 return UNSPECIFIC_RETURN; | 606 return UNSPECIFIC_RETURN; |
| 611 } | 607 } |
| 612 | 608 |
| 614 { | 610 { |
| 615 char text[32]; | 611 char text[32]; |
| 616 SSettings *pSettings; | 612 SSettings *pSettings; |
| 617 pSettings = settingsGetPointer(); | 613 pSettings = settingsGetPointer(); |
| 618 | 614 |
| 619 if(pSettings->scubberActiveId & (1 << scrubberMenuId)) | 615 if(pSettings->scrubberActiveId & (1 << scrubberMenuId)) |
| 620 { | 616 { |
| 621 pSettings->scubberActiveId &= ~(1 << scrubberMenuId); | 617 pSettings->scrubberActiveId &= ~(1 << scrubberMenuId); |
| 622 snprintf(&text[0], 32,"%c %c \002\006", TXT_ScrubTime, TXT_Active); | 618 snprintf(&text[0], 32,"%c %c \002\006", TXT_ScrubTime, TXT_Active); |
| 623 } | 619 } |
| 624 else | 620 else |
| 625 { | 621 { |
| 626 pSettings->scubberActiveId |= (1 << scrubberMenuId); | 622 pSettings->scrubberActiveId |= (1 << scrubberMenuId); |
| 627 snprintf(&text[0], 32,"%c %c \002\005", TXT_ScrubTime, TXT_Active); | 623 snprintf(&text[0], 32,"%c %c \002\005", TXT_ScrubTime, TXT_Active); |
| 628 } | 624 } |
| 629 | 625 |
| 630 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_Active, text); | 626 tMenuEdit_newButtonText(StMXTRA_ScrubTimer_Active, text); |
| 631 | 627 |
