Mercurial > public > ostc4
comparison Discovery/Src/t7.c @ 662:1b995079c045 Betatest
PSCR Mode
author | heinrichs weikamp |
---|---|
date | Tue, 14 Dec 2021 15:36:10 +0100 |
parents | 87bee7cc77b3 |
children | 16833cd3a2f5 |
comparison
equal
deleted
inserted
replaced
661:87bee7cc77b3 | 662:1b995079c045 |
---|---|
33 #include "data_exchange_main.h" | 33 #include "data_exchange_main.h" |
34 #include "decom.h" | 34 #include "decom.h" |
35 #include "gfx_fonts.h" | 35 #include "gfx_fonts.h" |
36 #include "logbook_miniLive.h" | 36 #include "logbook_miniLive.h" |
37 #include "math.h" | 37 #include "math.h" |
38 #include "tComm.h" | |
38 #include "tHome.h" | 39 #include "tHome.h" |
39 #include "simulation.h" | 40 #include "simulation.h" |
40 #include "timer.h" | 41 #include "timer.h" |
41 #include "unit.h" | 42 #include "unit.h" |
42 #include "motion.h" | 43 #include "motion.h" |
741 sprintf(text,"Settings: %u",errorsInSettings); | 742 sprintf(text,"Settings: %u",errorsInSettings); |
742 GFX_write_string_color(&FontT42,&t7surfaceR,text,4,CLUT_WarningRed); | 743 GFX_write_string_color(&FontT42,&t7surfaceR,text,4,CLUT_WarningRed); |
743 } | 744 } |
744 else | 745 else |
745 */ | 746 */ |
746 if(DataEX_was_power_on()) | 747 if(DataEX_was_power_on()) { |
747 GFX_write_string_color(&FontT42,&t7surfaceR,"cold start",4,CLUT_WarningRed); | 748 GFX_write_string_color(&FontT42,&t7surfaceR,"cold start",4,CLUT_WarningRed); |
749 // Reset the bluetooth interface after a cold start | |
750 tComm_Set_Bluetooth_Name(1); | |
751 } | |
748 | 752 |
749 /* time and date */ | 753 /* time and date */ |
750 translateDate(stateUsed->lifeData.dateBinaryFormat, &Sdate); | 754 translateDate(stateUsed->lifeData.dateBinaryFormat, &Sdate); |
751 translateTime(stateUsed->lifeData.timeBinaryFormat, &Stime); | 755 translateTime(stateUsed->lifeData.timeBinaryFormat, &Stime); |
752 | 756 |
1013 GFX_write_string(&FontT48,&t7surfaceL,text,6); | 1017 GFX_write_string(&FontT48,&t7surfaceL,text,6); |
1014 } | 1018 } |
1015 else | 1019 else |
1016 { | 1020 { |
1017 textIdx = 0; | 1021 textIdx = 0; |
1018 if(stateUsed->diveSettings.diveMode == DIVEMODE_CCR) | 1022 if(isLoopMode(stateUsed->diveSettings.diveMode)) |
1019 gasOffset = NUM_OFFSET_DILUENT; | 1023 gasOffset = NUM_OFFSET_DILUENT; |
1020 else | 1024 else |
1021 gasOffset = 0; | 1025 gasOffset = 0; |
1022 | 1026 |
1023 /* Display gas setup */ | 1027 /* Display gas setup */ |
1087 | 1091 |
1088 /* dive mode */ | 1092 /* dive mode */ |
1089 switch (stateUsed->diveSettings.diveMode) { | 1093 switch (stateUsed->diveSettings.diveMode) { |
1090 case DIVEMODE_CCR: | 1094 case DIVEMODE_CCR: |
1091 GFX_write_string(&FontT24, &t7c1, "\f\002" "CCR", 0); | 1095 GFX_write_string(&FontT24, &t7c1, "\f\002" "CCR", 0); |
1096 break; | |
1097 case DIVEMODE_PSCR: | |
1098 GFX_write_string(&FontT24, &t7c1, "\f\002" "PSCR", 0); | |
1092 break; | 1099 break; |
1093 case DIVEMODE_OC: | 1100 case DIVEMODE_OC: |
1094 GFX_write_string(&FontT24, &t7c1, "\f\002" "OC", 0); | 1101 GFX_write_string(&FontT24, &t7c1, "\f\002" "OC", 0); |
1095 break; | 1102 break; |
1096 case DIVEMODE_Gauge: | 1103 case DIVEMODE_Gauge: |
1608 } | 1615 } |
1609 | 1616 |
1610 uint8_t t7_change_customview(uint8_t action) | 1617 uint8_t t7_change_customview(uint8_t action) |
1611 { | 1618 { |
1612 uint8_t *pViews; | 1619 uint8_t *pViews; |
1613 uint8_t *pStartView,*pCurView, *pLastView; | 1620 uint8_t *pStartView,*pLastView; |
1621 uint8_t *pCurView = NULL; | |
1614 _Bool cv_disabled = 0; | 1622 _Bool cv_disabled = 0; |
1615 | 1623 |
1616 if(stateUsed->mode == MODE_DIVE) | 1624 if(stateUsed->mode == MODE_DIVE) |
1617 pViews = (uint8_t*)customviewsDive; | 1625 pViews = (uint8_t*)customviewsDive; |
1618 else | 1626 else |
1692 static uint8_t last_customview = CVIEW_END; | 1700 static uint8_t last_customview = CVIEW_END; |
1693 | 1701 |
1694 char text[256]; | 1702 char text[256]; |
1695 char timeSuffix; | 1703 char timeSuffix; |
1696 uint8_t hoursToDisplay; | 1704 uint8_t hoursToDisplay; |
1705 #ifdef ENABLE_PSCR_MODE | |
1706 uint8_t showSimPPO2 = 1; | |
1707 #endif | |
1697 uint16_t textpointer = 0; | 1708 uint16_t textpointer = 0; |
1698 uint16_t heading = 0; | 1709 uint16_t heading = 0; |
1699 int16_t start; | 1710 int16_t start; |
1700 uint8_t lineCountCustomtext = 0; | 1711 uint8_t lineCountCustomtext = 0; |
1701 int16_t shiftWindowY0; | 1712 int16_t shiftWindowY0; |
1788 GFX_write_string_color(&FontT42,&t7cC,text,1, CLUT_WarningRed); | 1799 GFX_write_string_color(&FontT42,&t7cC,text,1, CLUT_WarningRed); |
1789 t7cC.WindowY0 += shiftWindowY0; | 1800 t7cC.WindowY0 += shiftWindowY0; |
1790 } | 1801 } |
1791 t7cC.WindowNumberOfTextLines = 3; | 1802 t7cC.WindowNumberOfTextLines = 3; |
1792 } | 1803 } |
1804 else if(isSettingsWarning()) | |
1805 { | |
1806 if(warning_count_high_time) | |
1807 { | |
1808 shiftWindowY0 += 20; | |
1809 t7cC.WindowY0 -= shiftWindowY0; | |
1810 textpointer = 0; | |
1811 text[textpointer++] = '\001'; | |
1812 text[textpointer++] = TXT_2BYTE; | |
1813 text[textpointer++] = TXT2BYTE_CheckSettings; | |
1814 text[textpointer++] = '\n'; | |
1815 text[textpointer++] = '\r'; | |
1816 text[textpointer++] = 0; | |
1817 GFX_write_string_color(&FontT42,&t7cC,text,1, CLUT_WarningRed); | |
1818 t7cC.WindowY0 += shiftWindowY0; | |
1819 } | |
1820 t7cC.WindowNumberOfTextLines = 1; | |
1821 } | |
1793 else // customtext | 1822 else // customtext |
1794 { | 1823 { |
1795 lineCountCustomtext = t7_customtextPrepare(text); | 1824 lineCountCustomtext = t7_customtextPrepare(text); |
1796 if(lineCountCustomtext <= 2) | 1825 if(lineCountCustomtext <= 2) |
1797 shiftWindowY0 += 20+26; // nach unten | 1826 shiftWindowY0 += 20+26; // nach unten |
1991 text[textpointer++] = '\030'; // main color | 2020 text[textpointer++] = '\030'; // main color |
1992 for(int i=0;i<3;i++) | 2021 for(int i=0;i<3;i++) |
1993 { | 2022 { |
1994 if((stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) || (stateUsed->lifeData.ppO2Sensor_bar[i] == 0.0)) | 2023 if((stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) || (stateUsed->lifeData.ppO2Sensor_bar[i] == 0.0)) |
1995 { | 2024 { |
1996 text[textpointer++] = '\031'; // labelcolor | 2025 #ifdef ENABLE_PSCR_MODE |
1997 text[textpointer++] = '\001'; | 2026 if((stateUsed->diveSettings.diveMode == DIVEMODE_PSCR) && (showSimPPO2) && (stateUsed->mode == MODE_DIVE)) /* display ppo2 sim in blue letters in case a slot is not used in the ppo2 custom view */ |
1998 text[textpointer++] = '-'; | 2027 { |
1999 text[textpointer++] = '\n'; | 2028 text[textpointer++] = '\023'; |
2000 text[textpointer++] = '\r'; | 2029 textpointer += snprintf(&text[textpointer],100,"\001%01.2f\n\r\030",stateUsed->lifeData.ppo2Simulated_bar); |
2001 text[textpointer++] = '\030'; // main color | 2030 showSimPPO2 = 0; |
2002 text[textpointer] = 0; | 2031 } |
2032 else | |
2033 #endif | |
2034 { | |
2035 text[textpointer++] = '\031'; // labelcolor | |
2036 text[textpointer++] = '\001'; | |
2037 text[textpointer++] = '-'; | |
2038 text[textpointer++] = '\n'; | |
2039 text[textpointer++] = '\r'; | |
2040 text[textpointer++] = '\030'; // main color | |
2041 text[textpointer] = 0; | |
2042 } | |
2003 } | 2043 } |
2004 else | 2044 else |
2005 { | 2045 { |
2006 if(stateUsed->warnings.sensorOutOfBounds[i]) | 2046 if(stateUsed->warnings.sensorOutOfBounds[i]) |
2007 text[textpointer++] = '\025'; // Warning Red | 2047 text[textpointer++] = '\025'; // Warning Red |
2513 GFX_write_string(&FontT48,&t7c2,TextC2,0); // T54 has only numbers | 2553 GFX_write_string(&FontT48,&t7c2,TextC2,0); // T54 has only numbers |
2514 } | 2554 } |
2515 | 2555 |
2516 if(stateUsed->diveSettings.ccrOption) | 2556 if(stateUsed->diveSettings.ccrOption) |
2517 { | 2557 { |
2518 if(stateUsed->diveSettings.diveMode == DIVEMODE_CCR) | 2558 if(isLoopMode(stateUsed->diveSettings.diveMode)) |
2519 { | 2559 { |
2520 snprintf(TextC2,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2); | 2560 snprintf(TextC2,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2); |
2561 | |
2521 if(stateUsed->warnings.betterSetpoint && warning_count_high_time && (stateUsed->diveSettings.diveMode == DIVEMODE_CCR)) | 2562 if(stateUsed->warnings.betterSetpoint && warning_count_high_time && (stateUsed->diveSettings.diveMode == DIVEMODE_CCR)) |
2522 { | 2563 { |
2523 TextC2[0] = '\a'; // inverse instead of color \020 | 2564 TextC2[0] = '\a'; // inverse instead of color \020 |
2524 GFX_write_string_color(&FontT48,&t7c2,TextC2,0,CLUT_WarningYellow); | 2565 GFX_write_string_color(&FontT48,&t7c2,TextC2,0,CLUT_WarningYellow); |
2525 } | 2566 } |
2545 { | 2586 { |
2546 TextC2[0] = '\f'; | 2587 TextC2[0] = '\f'; |
2547 TextC2[1] = TXT_2BYTE; | 2588 TextC2[1] = TXT_2BYTE; |
2548 TextC2[2] = TXT2BYTE_WarnCnsHigh; | 2589 TextC2[2] = TXT2BYTE_WarnCnsHigh; |
2549 TextC2[3] = 0; | 2590 TextC2[3] = 0; |
2550 GFX_write_string_color(&FontT48,&t7c1,TextC2,0,CLUT_WarningRed); | 2591 GFX_write_string_color(&FontT42,&t7c1,TextC2,0,CLUT_WarningRed); |
2551 } | 2592 } |
2552 else | 2593 else |
2553 { | 2594 { |
2554 if(stateUsed->warnings.aGf) | 2595 if(stateUsed->warnings.aGf) |
2555 { | 2596 { |
2565 } | 2606 } |
2566 | 2607 |
2567 if(stateUsed->diveSettings.diveMode == DIVEMODE_CCR) | 2608 if(stateUsed->diveSettings.diveMode == DIVEMODE_CCR) |
2568 GFX_write_string(&FontT24,&t7c1,"\027\f\002" "CCR",0); | 2609 GFX_write_string(&FontT24,&t7c1,"\027\f\002" "CCR",0); |
2569 // GFX_write_string(&FontT24,&t7c1,"\f\177\177\x80" "CCR",0); | 2610 // GFX_write_string(&FontT24,&t7c1,"\f\177\177\x80" "CCR",0); |
2611 else | |
2612 if(stateUsed->diveSettings.diveMode == DIVEMODE_PSCR) | |
2613 GFX_write_string(&FontT24,&t7c1,"\027\f\002" "PSCR",0); | |
2570 else | 2614 else |
2571 if(stateUsed->diveSettings.ccrOption) | 2615 if(stateUsed->diveSettings.ccrOption) |
2572 GFX_write_string(&FontT24,&t7c1,"\f\002\024" "Bailout",0); | 2616 GFX_write_string(&FontT24,&t7c1,"\f\002\024" "Bailout",0); |
2573 // GFX_write_string(&FontT24,&t7c1,"\f\177\177\x80\024" "Bailout",0); | 2617 // GFX_write_string(&FontT24,&t7c1,"\f\177\177\x80\024" "Bailout",0); |
2574 } | 2618 } |
2659 | 2703 |
2660 if((stateUsed->diveSettings.deco_type.ub.standard == VPM_MODE) && (selection_custom_field == LLC_GF)) /* no GF if in VPM mode */ | 2704 if((stateUsed->diveSettings.deco_type.ub.standard == VPM_MODE) && (selection_custom_field == LLC_GF)) /* no GF if in VPM mode */ |
2661 { | 2705 { |
2662 selection_custom_field++; | 2706 selection_custom_field++; |
2663 } | 2707 } |
2664 if((selection_custom_field == LLC_ScrubberTime) && ((settingsGetPointer()->scrubTimerMode == SCRUB_TIMER_OFF) || (settingsGetPointer()->dive_mode != DIVEMODE_CCR))) | 2708 if((selection_custom_field == LLC_ScrubberTime) && ((settingsGetPointer()->scrubTimerMode == SCRUB_TIMER_OFF) || (!isLoopMode(settingsGetPointer()->dive_mode)))) |
2665 { | 2709 { |
2666 selection_custom_field++; | 2710 selection_custom_field++; |
2667 } | 2711 } |
2668 | 2712 #ifdef ENABLE_PSCR_MODE |
2713 if((selection_custom_field == LCC_SimPpo2) && (settingsGetPointer()->dive_mode != DIVEMODE_PSCR)) | |
2714 { | |
2715 selection_custom_field++; | |
2716 } | |
2717 #endif | |
2669 if(selection_custom_field >= LLC_END) | 2718 if(selection_custom_field >= LLC_END) |
2670 { | 2719 { |
2671 selection_custom_field = LLC_Empty; | 2720 selection_custom_field = LLC_Empty; |
2672 } | 2721 } |
2673 } | 2722 } |
2801 else | 2850 else |
2802 { | 2851 { |
2803 snprintf(text,TEXTSIZE,"\020%u\016\016%%\017", (settingsGetPointer()->scrubTimerCur * 100 / settingsGetPointer()->scrubTimerMax)); | 2852 snprintf(text,TEXTSIZE,"\020%u\016\016%%\017", (settingsGetPointer()->scrubTimerCur * 100 / settingsGetPointer()->scrubTimerMax)); |
2804 } | 2853 } |
2805 break; | 2854 break; |
2855 #ifdef ENABLE_PSCR_MODE | |
2856 case LCC_SimPpo2: | |
2857 headerText[2] = TXT_SimPpo2; | |
2858 snprintf(text,TEXTSIZE,"\020%.2f\016\016Bar\017",stateUsed->lifeData.ppo2Simulated_bar); | |
2859 break; | |
2860 #endif | |
2806 | 2861 |
2807 #ifdef ENABLE_BOTTLE_SENSOR | 2862 #ifdef ENABLE_BOTTLE_SENSOR |
2808 case LCC_BottleBar: | 2863 case LCC_BottleBar: |
2809 headerText[2] = TXT_AtemGasVorrat; | 2864 headerText[2] = TXT_AtemGasVorrat; |
2810 tinyHeaderFont = 1; | 2865 tinyHeaderFont = 1; |
3378 text[textpointer++] = '\n'; | 3433 text[textpointer++] = '\n'; |
3379 text[textpointer++] = '\r'; | 3434 text[textpointer++] = '\r'; |
3380 text[textpointer++] = TXT_FutureTTS; | 3435 text[textpointer++] = TXT_FutureTTS; |
3381 text[textpointer++] = '\n'; | 3436 text[textpointer++] = '\n'; |
3382 text[textpointer++] = '\r'; | 3437 text[textpointer++] = '\r'; |
3383 if((pSettings->scrubTimerMode != SCRUB_TIMER_OFF) && (pSettings->dive_mode == DIVEMODE_CCR)) | 3438 if((pSettings->scrubTimerMode != SCRUB_TIMER_OFF) && (isLoopMode(pSettings->dive_mode))) |
3384 { | 3439 { |
3385 text[textpointer++] = TXT_ScrubTime; | 3440 text[textpointer++] = TXT_ScrubTime; |
3386 | 3441 |
3387 } | 3442 } |
3388 text[textpointer++] = '\017'; | 3443 text[textpointer++] = '\017'; |
3427 if (pDecoinfoFuture->output_time_to_surface_seconds < 1000 * 60) | 3482 if (pDecoinfoFuture->output_time_to_surface_seconds < 1000 * 60) |
3428 textpointer += snprintf(&text[textpointer],10,"\020%i'", (pDecoinfoFuture->output_time_to_surface_seconds + 59) / 60); | 3483 textpointer += snprintf(&text[textpointer],10,"\020%i'", (pDecoinfoFuture->output_time_to_surface_seconds + 59) / 60); |
3429 else | 3484 else |
3430 textpointer += snprintf(&text[textpointer],10,"\020%ih", (pDecoinfoFuture->output_time_to_surface_seconds + 59) / 3600); | 3485 textpointer += snprintf(&text[textpointer],10,"\020%ih", (pDecoinfoFuture->output_time_to_surface_seconds + 59) / 3600); |
3431 | 3486 |
3432 if((pSettings->scrubTimerMode != SCRUB_TIMER_OFF) && (pSettings->dive_mode == DIVEMODE_CCR)) | 3487 if((pSettings->scrubTimerMode != SCRUB_TIMER_OFF) && (isLoopMode(pSettings->dive_mode))) |
3433 { | 3488 { |
3434 text[textpointer++] = '\n'; | 3489 text[textpointer++] = '\n'; |
3435 text[textpointer++] = '\r'; | 3490 text[textpointer++] = '\r'; |
3436 text[textpointer++] = '\t'; | 3491 text[textpointer++] = '\t'; |
3437 if(settingsGetPointer()->scrubTimerMode == SCRUB_TIMER_MINUTES) | 3492 if(settingsGetPointer()->scrubTimerMode == SCRUB_TIMER_MINUTES) |