Mercurial > public > ostc4
comparison Discovery/Src/t7.c @ 981:c6c781a2e85b default
Merge into default
| author | heinrichsweikamp |
|---|---|
| date | Tue, 11 Feb 2025 18:12:00 +0100 |
| parents | 7149f372b0ba |
| children | 41136649b90d |
comparison
equal
deleted
inserted
replaced
| 871:f7318457df4d | 981:c6c781a2e85b |
|---|---|
| 31 | 31 |
| 32 #include "t7.h" | 32 #include "t7.h" |
| 33 #include "t3.h" | 33 #include "t3.h" |
| 34 #include "settings.h" | 34 #include "settings.h" |
| 35 #include "data_exchange_main.h" | 35 #include "data_exchange_main.h" |
| 36 #include "data_central.h" | |
| 36 #include "decom.h" | 37 #include "decom.h" |
| 37 #include "gfx_fonts.h" | 38 #include "gfx_fonts.h" |
| 38 #include "logbook_miniLive.h" | 39 #include "logbook_miniLive.h" |
| 39 #include "math.h" | 40 #include "math.h" |
| 40 #include "tComm.h" | 41 #include "tComm.h" |
| 44 #include "unit.h" | 45 #include "unit.h" |
| 45 #include "motion.h" | 46 #include "motion.h" |
| 46 #include "configuration.h" | 47 #include "configuration.h" |
| 47 #include "base.h" | 48 #include "base.h" |
| 48 #include "tMenuEditSetpoint.h" | 49 #include "tMenuEditSetpoint.h" |
| 50 #include "vpm.h" | |
| 49 | 51 |
| 50 #define TIMER_ACTION_DELAY_S 10 | 52 #define TIMER_ACTION_DELAY_S 10 |
| 51 | 53 |
| 52 /* Private function prototypes -----------------------------------------------*/ | 54 /* Private function prototypes -----------------------------------------------*/ |
| 53 | 55 |
| 67 void t7_debug(void); | 69 void t7_debug(void); |
| 68 | 70 |
| 69 void t7_miniLiveLogProfile(void); | 71 void t7_miniLiveLogProfile(void); |
| 70 void t7_logo_OSTC(void); | 72 void t7_logo_OSTC(void); |
| 71 void t7_ChargerView(void); | 73 void t7_ChargerView(void); |
| 72 static void t7_colorscheme_mod(char *text); | |
| 73 | 74 |
| 74 uint8_t t7_test_customview_warnings(void); | 75 uint8_t t7_test_customview_warnings(void); |
| 75 void t7_show_customview_warnings(void); | 76 void t7_show_customview_warnings(void); |
| 76 | 77 |
| 77 uint8_t t7_test_customview_warnings_surface_mode(void); | 78 uint8_t t7_test_customview_warnings_surface_mode(void); |
| 78 void t7_show_customview_warnings_surface_mode(void); | 79 void t7_show_customview_warnings_surface_mode(void); |
| 79 | 80 |
| 80 uint8_t t7_customtextPrepare(char * text); | 81 uint8_t t7_customtextPrepare(char * text); |
| 82 | |
| 83 static void t7_drawAcentGraph(uint8_t color); | |
| 84 static uint8_t t7_drawSlowExitGraph(void); | |
| 85 static void t7_showPosition(void); | |
| 81 | 86 |
| 82 /* Imported function prototypes ---------------------------------------------*/ | 87 /* Imported function prototypes ---------------------------------------------*/ |
| 83 extern uint8_t write_gas(char *text, uint8_t oxygen, uint8_t helium); | 88 extern uint8_t write_gas(char *text, uint8_t oxygen, uint8_t helium); |
| 84 | 89 |
| 85 /* Exported variables --------------------------------------------------------*/ | 90 /* Exported variables --------------------------------------------------------*/ |
| 118 .pointer = 0, | 123 .pointer = 0, |
| 119 }; | 124 }; |
| 120 | 125 |
| 121 | 126 |
| 122 /* Private types -------------------------------------------------------------*/ | 127 /* Private types -------------------------------------------------------------*/ |
| 123 const uint8_t customviewsDiveStandard[] = | 128 |
| 124 { | |
| 125 CVIEW_sensors, | |
| 126 CVIEW_Compass, | |
| 127 CVIEW_Decolist, | |
| 128 CVIEW_Tissues, | |
| 129 CVIEW_Profile, | |
| 130 CVIEW_Gaslist, | |
| 131 CVIEW_sensors_mV, | |
| 132 CVIEW_EADTime, | |
| 133 CVIEW_SummaryOfLeftCorner, | |
| 134 CVIEW_Timer, | |
| 135 CVIEW_noneOrDebug, | |
| 136 CVIEW_END, | |
| 137 CVIEW_END | |
| 138 }; | |
| 139 | 129 |
| 140 const uint8_t customviewsSurfaceStandard[] = | 130 const uint8_t customviewsSurfaceStandard[] = |
| 141 { | 131 { |
| 142 // CVIEW_CompassDebug, | 132 // CVIEW_CompassDebug, |
| 143 CVIEW_Hello, | 133 CVIEW_Hello, |
| 147 CVIEW_Gaslist, | 137 CVIEW_Gaslist, |
| 148 CVIEW_sensors_mV, | 138 CVIEW_sensors_mV, |
| 149 CVIEW_Charger, | 139 CVIEW_Charger, |
| 150 CVIEW_CcrSummary, | 140 CVIEW_CcrSummary, |
| 151 CVIEW_Timer, | 141 CVIEW_Timer, |
| 142 #if defined ENABLE_GPIO_V2 || defined ENABLE_GNSS_SUPPORT | |
| 143 CVIEW_Position, | |
| 144 #endif | |
| 152 CVIEW_END | 145 CVIEW_END |
| 153 }; | 146 }; |
| 154 | 147 |
| 155 | 148 |
| 156 static uint8_t selection_custom_field = LLC_Temperature; | 149 static uint8_t selection_custom_field = LLC_Temperature; |
| 157 | 150 |
| 158 const uint8_t *customviewsDive = customviewsDiveStandard; | 151 const uint8_t *customviewsDive = cv_changelist; |
| 159 const uint8_t *customviewsSurface = customviewsSurfaceStandard; | 152 const uint8_t *customviewsSurface = customviewsSurfaceStandard; |
| 160 | 153 |
| 161 #define TEXTSIZE 30 | 154 #define TEXTSIZE 30 |
| 162 /* offset includes line: 2 = line +1 | 155 /* offset includes line: 2 = line +1 |
| 163 * box (line) is 300 px | 156 * box (line) is 300 px |
| 213 t7l1.WindowY0 = 318; | 206 t7l1.WindowY0 = 318; |
| 214 t7l1.WindowY1 = 479; | 207 t7l1.WindowY1 = 479; |
| 215 | 208 |
| 216 t7l2.Image = &t7screen; | 209 t7l2.Image = &t7screen; |
| 217 t7l2.WindowNumberOfTextLines = 2; | 210 t7l2.WindowNumberOfTextLines = 2; |
| 218 t7l2.WindowLineSpacing = 22; // Abstand von Y0 | 211 t7l2.WindowLineSpacing = 12; // Abstand von Y0 |
| 219 t7l2.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster | 212 t7l2.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster |
| 220 t7l2.WindowX0 = 0; | 213 t7l2.WindowX0 = 0; |
| 221 t7l2.WindowX1 = t7l1.WindowX1; | 214 t7l2.WindowX1 = t7l1.WindowX1; |
| 222 t7l2.WindowY0 = 142; | 215 t7l2.WindowY0 = 142; |
| 223 t7l2.WindowY1 = t7l1.WindowY0 - 5; | 216 t7l2.WindowY1 = t7l1.WindowY0 - 5; |
| 380 t7l1.WindowY0 = CUSTOMBOX_LINE_TOP; | 373 t7l1.WindowY0 = CUSTOMBOX_LINE_TOP; |
| 381 t7l1.WindowY1 = 150 + TOP_LINE_HIGHT; | 374 t7l1.WindowY1 = 150 + TOP_LINE_HIGHT; |
| 382 | 375 |
| 383 t7l2.Image = &t7screen; | 376 t7l2.Image = &t7screen; |
| 384 t7l2.WindowNumberOfTextLines = 2; | 377 t7l2.WindowNumberOfTextLines = 2; |
| 385 t7l2.WindowLineSpacing = 22; // Abstand von Y0 | 378 t7l2.WindowLineSpacing = 12; // Abstand von Y0 |
| 386 t7l2.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster | 379 t7l2.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster |
| 387 t7l2.WindowX0 = t7l1.WindowX0; | 380 t7l2.WindowX0 = t7l1.WindowX0; |
| 388 t7l2.WindowX1 = t7l1.WindowX1; | 381 t7l2.WindowX1 = t7l1.WindowX1; |
| 389 t7l2.WindowY0 = t7l1.WindowY1 + 5; | 382 t7l2.WindowY0 = t7l1.WindowY1 + 5; |
| 390 t7l2.WindowY1 = t7l2.WindowY0 + 146; | 383 t7l2.WindowY1 = t7l2.WindowY0 + 146; |
| 578 | 571 |
| 579 background.pointer = 0; | 572 background.pointer = 0; |
| 580 | 573 |
| 581 if(stateUsed->mode == MODE_DIVE) | 574 if(stateUsed->mode == MODE_DIVE) |
| 582 { | 575 { |
| 583 if(last_mode != MODE_DIVE) | 576 /* T7 refresh is usally called at start of dive. Based on divesettings the design will be changed and T7 no longer called */ |
| 584 { | |
| 585 last_mode = MODE_DIVE; | |
| 586 /* lower left corner primary */ | |
| 587 selection_custom_field = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary; | |
| 588 /* custom view primary OR debug if automatic return is off | T7 is default dive view => also initialize big font view */ | |
| 589 if((settingsGetPointer()->tX_customViewTimeout == 0) && (settingsGetPointer()->showDebugInfo)) | |
| 590 { | |
| 591 selection_customview = CVIEW_noneOrDebug; | |
| 592 t3_select_customview(CVIEW_noneOrDebug); | |
| 593 } | |
| 594 else | |
| 595 { | |
| 596 selection_customview = settingsGetPointer()->tX_customViewPrimary; | |
| 597 t3_set_customview_to_primary(); | |
| 598 } | |
| 599 t7_change_customview(ACTION_END); | |
| 600 | |
| 601 if((settingsGetPointer()->MotionDetection != MOTION_DETECT_OFF)) | |
| 602 { | |
| 603 InitMotionDetection(); | |
| 604 } | |
| 605 | |
| 606 if(settingsGetPointer()->extraDisplay == EXTRADISPLAY_BFACTIVE) | |
| 607 { | |
| 608 settingsGetPointer()->design = 3; | |
| 609 releaseAllFramesExcept(22,t7screen.FBStartAdress); | |
| 610 releaseFrame(22,t7screen.FBStartAdress); | |
| 611 set_globalState(StD); | |
| 612 return; | |
| 613 } | |
| 614 } | |
| 615 | |
| 616 if(status.page == PageSurface) | |
| 617 set_globalState(StD); | |
| 618 | |
| 619 if(stateUsed->diveSettings.diveMode == DIVEMODE_Gauge) | 577 if(stateUsed->diveSettings.diveMode == DIVEMODE_Gauge) |
| 620 { | 578 { |
| 621 settingsGetPointer()->design = 5; | 579 settingsGetPointer()->design = 5; |
| 622 releaseAllFramesExcept(22,t7screen.FBStartAdress); | 580 releaseAllFramesExcept(22,t7screen.FBStartAdress); |
| 623 releaseFrame(22,t7screen.FBStartAdress); | 581 releaseFrame(22,t7screen.FBStartAdress); |
| 630 releaseFrame(22,t7screen.FBStartAdress); | 588 releaseFrame(22,t7screen.FBStartAdress); |
| 631 return; | 589 return; |
| 632 } | 590 } |
| 633 else | 591 else |
| 634 { | 592 { |
| 635 t7_refresh_divemode(); | 593 if(last_mode != MODE_DIVE) |
| 636 } | 594 { |
| 595 last_mode = MODE_DIVE; | |
| 596 /* lower left corner primary */ | |
| 597 selection_custom_field = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary; | |
| 598 /* custom view primary OR debug if automatic return is off | T7 is default dive view => also initialize big font view */ | |
| 599 if((settingsGetPointer()->tX_customViewTimeout == 0) && (settingsGetPointer()->showDebugInfo)) | |
| 600 { | |
| 601 selection_customview = CVIEW_noneOrDebug; | |
| 602 t3_select_customview(CVIEW_noneOrDebug); | |
| 603 } | |
| 604 else | |
| 605 { | |
| 606 selection_customview = settingsGetPointer()->tX_customViewPrimary; | |
| 607 } | |
| 608 t7_change_customview(ACTION_END); | |
| 609 | |
| 610 if((settingsGetPointer()->MotionDetection != MOTION_DETECT_OFF)) | |
| 611 { | |
| 612 InitMotionDetection(); | |
| 613 } | |
| 614 | |
| 615 if((settingsGetPointer()->extraDisplay == EXTRADISPLAY_BFACTIVE) && ( settingsGetPointer()->design == 7)) | |
| 616 { | |
| 617 settingsGetPointer()->design = 3; | |
| 618 t3_set_customview_to_primary(); | |
| 619 releaseAllFramesExcept(22,t7screen.FBStartAdress); | |
| 620 releaseFrame(22,t7screen.FBStartAdress); | |
| 621 set_globalState(StD); | |
| 622 return; | |
| 623 } | |
| 624 } | |
| 625 | |
| 626 if(status.page == PageSurface) | |
| 627 set_globalState(StD); | |
| 628 | |
| 629 t7_refresh_divemode(); | |
| 630 } | |
| 637 } | 631 } |
| 638 else // from if(stateUsed->mode == MODE_DIVE) | 632 else // from if(stateUsed->mode == MODE_DIVE) |
| 639 { | 633 { |
| 640 if(last_mode != MODE_SURFACE) | 634 if(last_mode != MODE_SURFACE) |
| 641 { | 635 { |
| 1432 if(stateUsed->warnings.newPressure) | 1426 if(stateUsed->warnings.newPressure) |
| 1433 { | 1427 { |
| 1434 count++; | 1428 count++; |
| 1435 } | 1429 } |
| 1436 #endif | 1430 #endif |
| 1431 #ifdef HAVE_DEBUG_WARNINGS | |
| 1432 count += stateUsed->warnings.debug; | |
| 1433 #endif | |
| 1437 return count; | 1434 return count; |
| 1438 } | 1435 } |
| 1439 | 1436 |
| 1440 | 1437 |
| 1441 uint8_t t7_test_customview_warnings_surface_mode(void) | 1438 uint8_t t7_test_customview_warnings_surface_mode(void) |
| 1503 | 1500 |
| 1504 void t7_show_customview_warnings(void) | 1501 void t7_show_customview_warnings(void) |
| 1505 { | 1502 { |
| 1506 char text[256]; | 1503 char text[256]; |
| 1507 uint8_t textpointer, lineFree; | 1504 uint8_t textpointer, lineFree; |
| 1505 #ifdef HAVE_DEBUG_WARNINGS | |
| 1506 uint8_t index = 0; | |
| 1507 #endif | |
| 1508 | 1508 |
| 1509 text[0] = '\025'; | 1509 text[0] = '\025'; |
| 1510 text[1] = '\f'; | 1510 text[1] = '\f'; |
| 1511 text[2] = '\001'; | 1511 text[2] = '\001'; |
| 1512 text[3] = TXT_Warning; | 1512 text[3] = TXT_Warning; |
| 1589 text[textpointer++] = '\r'; | 1589 text[textpointer++] = '\r'; |
| 1590 text[textpointer] = 0; | 1590 text[textpointer] = 0; |
| 1591 lineFree--; | 1591 lineFree--; |
| 1592 } | 1592 } |
| 1593 #endif | 1593 #endif |
| 1594 #ifdef HAVE_DEBUG_WARNINGS | |
| 1595 if(lineFree && stateUsed->warnings.debug) | |
| 1596 { | |
| 1597 for(index=0; index<3; index++) | |
| 1598 { | |
| 1599 if(((stateUsed->lifeData.extIf_sensor_map[index] == SENSOR_DIGO2M) && (((SSensorDataDiveO2*)(stateUsed->lifeData.extIf_sensor_data[index]))->status & DVO2_FATAL_ERROR))) | |
| 1600 { | |
| 1601 textpointer += snprintf(&text[textpointer],32,"\001Debug: %lx\n",((SSensorDataDiveO2*)(stateUsed->lifeData.extIf_sensor_data[index]))->status); | |
| 1602 } | |
| 1603 } | |
| 1604 lineFree--; | |
| 1605 } | |
| 1606 #endif | |
| 1594 /* | 1607 /* |
| 1595 if(lineFree && stateUsed->warnings.lowBattery) | 1608 if(lineFree && stateUsed->warnings.lowBattery) |
| 1596 { | 1609 { |
| 1597 text[textpointer++] = TXT_2BYTE; | 1610 text[textpointer++] = TXT_2BYTE; |
| 1598 text[textpointer++] = TXT2BYTE_WarnBatteryLow; | 1611 text[textpointer++] = TXT2BYTE_WarnBatteryLow; |
| 1601 text[textpointer] = 0; | 1614 text[textpointer] = 0; |
| 1602 lineFree--; | 1615 lineFree--; |
| 1603 } | 1616 } |
| 1604 */ | 1617 */ |
| 1605 GFX_write_string(&FontT48,&t7cW,text,1); | 1618 GFX_write_string(&FontT48,&t7cW,text,1); |
| 1619 requestBuzzerActivation(1); | |
| 1606 } | 1620 } |
| 1607 | 1621 |
| 1608 | 1622 |
| 1609 void t7_set_customview_to_primary(void) | 1623 void t7_set_customview_to_primary(void) |
| 1610 { | 1624 { |
| 1946 heading[headingIndex++] = TXT2BYTE_Scrubber; | 1960 heading[headingIndex++] = TXT2BYTE_Scrubber; |
| 1947 | 1961 |
| 1948 data[dataIndex++] = '\n'; | 1962 data[dataIndex++] = '\n'; |
| 1949 data[dataIndex++] = '\r'; | 1963 data[dataIndex++] = '\r'; |
| 1950 data[dataIndex++] = '\t'; | 1964 data[dataIndex++] = '\t'; |
| 1951 dataIndex += printScrubberText(&data[dataIndex], 10, settings); | 1965 dataIndex += printScrubberText(&data[dataIndex], 10, settings->scrubberData, settings); |
| 1952 } | 1966 } |
| 1953 | 1967 |
| 1954 heading[headingIndex++] = '\017'; | 1968 heading[headingIndex++] = '\017'; |
| 1955 heading[headingIndex++] = 0; | 1969 heading[headingIndex++] = 0; |
| 1956 | 1970 |
| 1975 GFX_write_string(&FontT24, &t7cY0free, heading, 1); | 1989 GFX_write_string(&FontT24, &t7cY0free, heading, 1); |
| 1976 t7cY0free.WindowY1 += 10; | 1990 t7cY0free.WindowY1 += 10; |
| 1977 t7cY0free.WindowX1 += 10; | 1991 t7cY0free.WindowX1 += 10; |
| 1978 } | 1992 } |
| 1979 | 1993 |
| 1980 t7_colorscheme_mod(data); | 1994 Gfx_colorsscheme_mod(data, 0); |
| 1981 | 1995 |
| 1982 GFX_write_string(&FontT42, &t7cY0free, data, 1); | 1996 GFX_write_string(&FontT42, &t7cY0free, data, 1); |
| 1983 } | 1997 } |
| 1984 | 1998 |
| 1985 | 1999 |
| 2129 GFX_write_string(&FontT24, &t7cY0free, heading, 1); | 2143 GFX_write_string(&FontT24, &t7cY0free, heading, 1); |
| 2130 t7cY0free.WindowY1 += 10; | 2144 t7cY0free.WindowY1 += 10; |
| 2131 t7cY0free.WindowX1 += 10; | 2145 t7cY0free.WindowX1 += 10; |
| 2132 } | 2146 } |
| 2133 | 2147 |
| 2134 t7_colorscheme_mod(data); | 2148 Gfx_colorsscheme_mod(data, 0); |
| 2135 | 2149 |
| 2136 GFX_write_string(&FontT42, &t7cY0free, data, 1); | 2150 GFX_write_string(&FontT42, &t7cY0free, data, 1); |
| 2137 | 2151 |
| 2138 t7_colorscheme_mod(timer); | 2152 Gfx_colorsscheme_mod(timer, 0); |
| 2139 | 2153 |
| 2140 GFX_write_string(&FontT105, &t7cY0free, timer, 4); | 2154 GFX_write_string(&FontT105, &t7cY0free, timer, 4); |
| 2141 } | 2155 } |
| 2142 | 2156 |
| 2143 | 2157 |
| 2163 uint8_t oxygen, helium; // CVIEW_Gaslist | 2177 uint8_t oxygen, helium; // CVIEW_Gaslist |
| 2164 float depth, surface, fraction_nitrogen, fraction_helium, ead, end; // CVIEW_EADTime | 2178 float depth, surface, fraction_nitrogen, fraction_helium, ead, end; // CVIEW_EADTime |
| 2165 SSettingsStatus SettingsStatus; | 2179 SSettingsStatus SettingsStatus; |
| 2166 SSettings* pSettings; | 2180 SSettings* pSettings; |
| 2167 pSettings = settingsGetPointer(); | 2181 pSettings = settingsGetPointer(); |
| 2182 uint8_t decoPlanEntries = 6; | |
| 2168 | 2183 |
| 2169 uint8_t local_ppo2sensors_deactivated = 0; | 2184 uint8_t local_ppo2sensors_deactivated = 0; |
| 2170 | 2185 |
| 2171 if(stateUsed->mode == MODE_DIVE) /* show sensors based on current dive settings */ | 2186 if(stateUsed->mode == MODE_DIVE) /* show sensors based on current dive settings */ |
| 2172 { | 2187 { |
| 2173 local_ppo2sensors_deactivated = stateUsed->diveSettings.ppo2sensors_deactivated; | 2188 local_ppo2sensors_deactivated = stateUsed->diveSettings.ppo2sensors_deactivated; |
| 2174 } | 2189 } |
| 2175 else | 2190 else |
| 2176 { | 2191 { |
| 2177 local_ppo2sensors_deactivated = pSettings->ppo2sensors_deactivated; | 2192 local_ppo2sensors_deactivated = pSettings->ppo2sensors_deactivated; |
| 2178 } | 2193 } |
| 2179 | 2194 |
| 2180 if(last_customview != selection_customview) /* check if current selection is disabled and should be skipped */ | 2195 if(last_customview != selection_customview) /* check if current selection is disabled and should be skipped */ |
| 2181 { | 2196 { |
| 2182 if(t7_customview_disabled(selection_customview)) | 2197 if(t7_customview_disabled(selection_customview)) |
| 2617 t7cY0free.WindowX0 += 15; | 2632 t7cY0free.WindowX0 += 15; |
| 2618 } | 2633 } |
| 2619 break; | 2634 break; |
| 2620 | 2635 |
| 2621 case CVIEW_Decolist: | 2636 case CVIEW_Decolist: |
| 2622 snprintf(text,100,"\032\f\001 %c%c", TXT_2BYTE, TXT2BYTE_Decolist); | 2637 |
| 2638 | |
| 2639 if(settingsGetPointer()->VPM_conservatism.ub.alternative == 0) | |
| 2640 { | |
| 2641 text[0] = '\032'; | |
| 2642 } | |
| 2643 else | |
| 2644 { | |
| 2645 switch(vpm_get_TableState()) | |
| 2646 { | |
| 2647 case VPM_TABLE_MISSED: text[0] = '\025'; | |
| 2648 break; | |
| 2649 case VPM_TABLE_WARNING: text[0] = '\024'; | |
| 2650 break; | |
| 2651 case VPM_TABLE_ACTIVE: | |
| 2652 case VPM_TABLE_INIT: | |
| 2653 default: text[0] = '\032'; | |
| 2654 break; | |
| 2655 } | |
| 2656 } | |
| 2657 snprintf(&text[1],100,"\f\001 %c%c", TXT_2BYTE, TXT2BYTE_Decolist); | |
| 2623 GFX_write_string(&FontT42,&t7cH,text,0); | 2658 GFX_write_string(&FontT42,&t7cH,text,0); |
| 2624 | 2659 |
| 2625 uint8_t depthNext, depthLast, depthSecond, depthInc; | 2660 uint8_t depthNext, depthLast, depthSecond, depthInc; |
| 2626 | 2661 |
| 2627 depthLast = (uint8_t)(stateUsed->diveSettings.last_stop_depth_bar * 10); | 2662 depthLast = (uint8_t)(stateUsed->diveSettings.last_stop_depth_bar * 10); |
| 2632 { | 2667 { |
| 2633 depthLast = (uint8_t)unit_depth_integer(depthLast); | 2668 depthLast = (uint8_t)unit_depth_integer(depthLast); |
| 2634 depthSecond = (uint8_t)unit_depth_integer(depthSecond); | 2669 depthSecond = (uint8_t)unit_depth_integer(depthSecond); |
| 2635 depthInc = (uint8_t)unit_depth_integer(depthInc); | 2670 depthInc = (uint8_t)unit_depth_integer(depthInc); |
| 2636 } | 2671 } |
| 2672 if(stateUsed->diveSettings.deco_type.ub.standard == VPM_MODE) /* show additional VPM data in last slot */ | |
| 2673 { | |
| 2674 decoPlanEntries = 5; | |
| 2675 } | |
| 2637 | 2676 |
| 2638 const SDecoinfo * pDecoinfo = getDecoInfo(); | 2677 const SDecoinfo * pDecoinfo = getDecoInfo(); |
| 2639 for(start=DECOINFO_STRUCT_MAX_STOPS-1; start>0; start--) | 2678 for(start=DECOINFO_STRUCT_MAX_STOPS-1; start>0; start--) |
| 2640 if(pDecoinfo->output_stop_length_seconds[start]) break; | 2679 if(pDecoinfo->output_stop_length_seconds[start]) break; |
| 2641 start -= 6; | 2680 start -= decoPlanEntries; |
| 2642 if(start < 0) start = 0; | 2681 if(start < 0) start = 0; |
| 2643 | 2682 |
| 2644 textpointer = 0; | 2683 textpointer = 0; |
| 2645 for(int i=start;i<6+start;i++) | 2684 for(int i=start;i<decoPlanEntries+start;i++) |
| 2646 { | 2685 { |
| 2647 if(i == 0) | 2686 if(i == 0) |
| 2648 depthNext = depthLast; | 2687 depthNext = depthLast; |
| 2649 else | 2688 else |
| 2650 depthNext = depthSecond + (( i - 1 )* depthInc); | 2689 depthNext = depthSecond + (( i - 1 )* depthInc); |
| 2652 if(pDecoinfo->output_stop_length_seconds[i]) | 2691 if(pDecoinfo->output_stop_length_seconds[i]) |
| 2653 textpointer += snprintf(&text[textpointer],20,"\030\034 %2u\016\016%c%c\017%3i'\n\r",depthNext, unit_depth_char1(), unit_depth_char2(), (pDecoinfo->output_stop_length_seconds[i]+59)/60); | 2692 textpointer += snprintf(&text[textpointer],20,"\030\034 %2u\016\016%c%c\017%3i'\n\r",depthNext, unit_depth_char1(), unit_depth_char2(), (pDecoinfo->output_stop_length_seconds[i]+59)/60); |
| 2654 else | 2693 else |
| 2655 textpointer += snprintf(&text[textpointer],20,"\031\034 %2u\016\016%c%c\017\n\r",depthNext, unit_depth_char1(), unit_depth_char2()); | 2694 textpointer += snprintf(&text[textpointer],20,"\031\034 %2u\016\016%c%c\017\n\r",depthNext, unit_depth_char1(), unit_depth_char2()); |
| 2656 if(textpointer > 200) break; | 2695 if(textpointer > 200) break; |
| 2696 } | |
| 2697 if(decoPlanEntries == 5) /* add VPM deco zone */ | |
| 2698 { | |
| 2699 textpointer += snprintf(&text[textpointer],30,"\031\034 Zone %2u\016\016%c%c\017\n\r",vpm_get_decozone(), unit_depth_char1(), unit_depth_char2()); | |
| 2657 } | 2700 } |
| 2658 if(!pSettings->FlipDisplay) | 2701 if(!pSettings->FlipDisplay) |
| 2659 { | 2702 { |
| 2660 t7cY0free.WindowY0 = t7cC.WindowY0 - 10; | 2703 t7cY0free.WindowY0 = t7cC.WindowY0 - 10; |
| 2661 } | 2704 } |
| 2670 GFX_write_string(&FontT42, &t7cY0free, text, 1); | 2713 GFX_write_string(&FontT42, &t7cY0free, text, 1); |
| 2671 break; | 2714 break; |
| 2672 case CVIEW_CcrSummary: | 2715 case CVIEW_CcrSummary: |
| 2673 snprintf(text, 100, "\032\f\001%c%c", TXT_2BYTE, TXT2BYTE_CcrSummary); | 2716 snprintf(text, 100, "\032\f\001%c%c", TXT_2BYTE, TXT2BYTE_CcrSummary); |
| 2674 GFX_write_string(&FontT42, &t7cH, text, 0); | 2717 GFX_write_string(&FontT42, &t7cH, text, 0); |
| 2675 | |
| 2676 t7_CcrSummary(pSettings); | 2718 t7_CcrSummary(pSettings); |
| 2677 | |
| 2678 break; | 2719 break; |
| 2679 case CVIEW_Timer: | 2720 case CVIEW_Timer: |
| 2680 snprintf(text, 100, "\032\f\001%c%c", TXT_2BYTE, TXT2BYTE_Timer); | 2721 snprintf(text, 100, "\032\f\001%c%c", TXT_2BYTE, TXT2BYTE_Timer); |
| 2681 GFX_write_string(&FontT42, &t7cH, text, 0); | 2722 GFX_write_string(&FontT42, &t7cH, text, 0); |
| 2682 | 2723 |
| 2685 updateTimer(pSettings, nowS, last_customview != CVIEW_Timer); | 2726 updateTimer(pSettings, nowS, last_customview != CVIEW_Timer); |
| 2686 | 2727 |
| 2687 showTimer(pSettings, nowS); | 2728 showTimer(pSettings, nowS); |
| 2688 | 2729 |
| 2689 break; | 2730 break; |
| 2731 | |
| 2732 case CVIEW_Position: | |
| 2733 snprintf(text, 100, "\032\f\001%c%c", TXT_2BYTE, TXT2BYTE_Position); | |
| 2734 GFX_write_string(&FontT42, &t7cH, text, 0); | |
| 2735 t7_showPosition(); | |
| 2690 } | 2736 } |
| 2691 | 2737 |
| 2692 last_customview = selection_customview; | 2738 last_customview = selection_customview; |
| 2693 } | 2739 } |
| 2694 | 2740 |
| 2706 | 2752 |
| 2707 char TextC1[2*TEXTSIZE]; | 2753 char TextC1[2*TEXTSIZE]; |
| 2708 char TextC2[TEXTSIZE]; | 2754 char TextC2[TEXTSIZE]; |
| 2709 uint8_t textPointer; | 2755 uint8_t textPointer; |
| 2710 | 2756 |
| 2711 point_t start, stop; | 2757 uint8_t color = 0; |
| 2712 uint8_t color; | |
| 2713 int textlength; | 2758 int textlength; |
| 2714 | 2759 |
| 2715 uint16_t nextstopLengthSeconds = 0; | 2760 uint16_t nextstopLengthSeconds = 0; |
| 2716 uint8_t nextstopDepthMeter = 0; | 2761 uint8_t nextstopDepthMeter = 0; |
| 2717 uint8_t oxygen_percentage = 0; | 2762 uint8_t oxygen_percentage = 0; |
| 2729 | 2774 |
| 2730 SafetyStopTime.Total = timer_Safetystop_GetCountDown(); | 2775 SafetyStopTime.Total = timer_Safetystop_GetCountDown(); |
| 2731 SafetyStopTime.Minutes = SafetyStopTime.Total / 60; | 2776 SafetyStopTime.Minutes = SafetyStopTime.Total / 60; |
| 2732 SafetyStopTime.Seconds = SafetyStopTime.Total - (SafetyStopTime.Minutes * 60); | 2777 SafetyStopTime.Seconds = SafetyStopTime.Total - (SafetyStopTime.Minutes * 60); |
| 2733 | 2778 |
| 2734 TimeoutTime.Total = settingsGetPointer()->timeoutDiveReachedZeroDepth - stateUsed->lifeData.counterSecondsShallowDepth; | 2779 TimeoutTime.Total = pSettings->timeoutDiveReachedZeroDepth - stateUsed->lifeData.counterSecondsShallowDepth; |
| 2735 if(TimeoutTime.Total > settingsGetPointer()->timeoutDiveReachedZeroDepth) | 2780 if(TimeoutTime.Total > pSettings->timeoutDiveReachedZeroDepth) |
| 2736 { | 2781 { |
| 2737 TimeoutTime.Total = 0; | 2782 TimeoutTime.Total = 0; |
| 2738 } | 2783 } |
| 2739 TimeoutTime.Minutes = TimeoutTime.Total / 60; | 2784 TimeoutTime.Minutes = TimeoutTime.Total / 60; |
| 2740 TimeoutTime.Seconds = TimeoutTime.Total - (TimeoutTime.Minutes * 60); | 2785 TimeoutTime.Seconds = TimeoutTime.Total - (TimeoutTime.Minutes * 60); |
| 2748 { | 2793 { |
| 2749 nextstopDepthMeter = 0; | 2794 nextstopDepthMeter = 0; |
| 2750 nextstopLengthSeconds = 0; | 2795 nextstopLengthSeconds = 0; |
| 2751 } | 2796 } |
| 2752 | 2797 |
| 2798 | |
| 2799 /* max depth */ | |
| 2800 snprintf(TextL2,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
| 2801 GFX_write_string(&FontT42,&t7l2,TextL2,0); | |
| 2802 | |
| 2803 if(unit_depth_float(stateUsed->lifeData.max_depth_meter) < 100) | |
| 2804 snprintf(TextL2,TEXTSIZE,"\020%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | |
| 2805 else | |
| 2806 snprintf(TextL2,TEXTSIZE,"\020%01.0f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | |
| 2807 | |
| 2808 Gfx_colorsscheme_mod(TextL2, 0); | |
| 2809 GFX_write_string(&FontT105,&t7l2,TextL2,1); | |
| 2810 | |
| 2811 /* ascent rate graph */ | |
| 2812 color = 0xff; | |
| 2813 if((pSettings->slowExitTime != 0) && (nextstopDepthMeter == 0) && (stateUsed->lifeData.depth_meter < pSettings->last_stop_depth_meter)) | |
| 2814 { | |
| 2815 color = t7_drawSlowExitGraph(); | |
| 2816 } | |
| 2817 if(color == 0xff) | |
| 2818 { | |
| 2819 color = drawingColor_from_ascentspeed(stateUsed->lifeData.ascent_rate_meter_per_min); | |
| 2820 if(stateUsed->lifeData.ascent_rate_meter_per_min > 1) /* a value < 1 would cause a bar in negative direction brush rectangle of 12 and step width of 6 */ | |
| 2821 { | |
| 2822 | |
| 2823 t7_drawAcentGraph(color); | |
| 2824 } | |
| 2825 } | |
| 2826 | |
| 2753 /* depth */ | 2827 /* depth */ |
| 2754 float depth = unit_depth_float(stateUsed->lifeData.depth_meter); | 2828 float depth = unit_depth_float(stateUsed->lifeData.depth_meter); |
| 2755 | 2829 |
| 2756 if(depth <= 0.3f) | 2830 if(depth <= 0.3f) |
| 2757 depth = 0; | 2831 depth = 0; |
| 2758 | 2832 |
| 2759 if(settingsGetPointer()->nonMetricalSystem) | 2833 if(settingsGetPointer()->nonMetricalSystem) |
| 2760 snprintf(TextL1,TEXTSIZE,"\032\f[feet]"); | 2834 snprintf(TextL1,TEXTSIZE,"\032\f[feet]"); |
| 2761 else | 2835 else |
| 2762 snprintf(TextL1,TEXTSIZE,"\032\f%c",TXT_Depth); | 2836 snprintf(TextL1,TEXTSIZE,"\032\f%c",TXT_Depth); |
| 2837 | |
| 2763 GFX_write_string(&FontT24,&t7l1,TextL1,0); | 2838 GFX_write_string(&FontT24,&t7l1,TextL1,0); |
| 2764 | 2839 |
| 2765 if((stateUsed->lifeData.ascent_rate_meter_per_min > 8) || (stateUsed->lifeData.ascent_rate_meter_per_min < -10)) | 2840 if((stateUsed->lifeData.ascent_rate_meter_per_min > 8) || (stateUsed->lifeData.ascent_rate_meter_per_min < -10)) |
| 2766 { | 2841 { |
| 2767 snprintf(TextL1,TEXTSIZE,"\f\002%.0f %c%c/min " | 2842 snprintf(TextL1,TEXTSIZE,"\f\002%.0f %c%c/min " |
| 2775 if( depth < 100) | 2850 if( depth < 100) |
| 2776 snprintf(TextL1,TEXTSIZE,"\020%01.1f",depth); | 2851 snprintf(TextL1,TEXTSIZE,"\020%01.1f",depth); |
| 2777 else | 2852 else |
| 2778 snprintf(TextL1,TEXTSIZE,"\020%01.0f",depth); | 2853 snprintf(TextL1,TEXTSIZE,"\020%01.0f",depth); |
| 2779 | 2854 |
| 2780 t7_colorscheme_mod(TextL1); | 2855 Gfx_colorsscheme_mod(TextL1, color); |
| 2781 GFX_write_string(&FontT144,&t7l1,TextL1,1); | 2856 |
| 2782 | 2857 GFX_write_string(&FontT144,&t7l1,TextL1,0); |
| 2783 /* max depth */ | 2858 |
| 2784 snprintf(TextL2,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | 2859 /* divetime */ |
| 2785 GFX_write_string(&FontT42,&t7l2,TextL2,0); | 2860 if(stateUsed->lifeData.counterSecondsShallowDepth) |
| 2786 | 2861 { |
| 2787 if(unit_depth_float(stateUsed->lifeData.max_depth_meter) < 100) | 2862 snprintf(TextR1,TEXTSIZE,"\f\002\136 %u:%02u",TimeoutTime.Minutes, TimeoutTime.Seconds); |
| 2788 snprintf(TextL2,TEXTSIZE,"\020%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | 2863 GFX_write_string(&FontT42,&t7r1,TextR1,0); |
| 2789 else | 2864 } |
| 2790 snprintf(TextL2,TEXTSIZE,"\020%01.0f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | 2865 else |
| 2791 | 2866 { |
| 2792 t7_colorscheme_mod(TextL2); | 2867 snprintf(TextR1,TEXTSIZE,"\032\f\002%c",TXT_Divetime); |
| 2793 GFX_write_string(&FontT105,&t7l2,TextL2,1); | 2868 GFX_write_string(&FontT42,&t7r1,TextR1,0); |
| 2794 | 2869 } |
| 2795 /* ascent rate graph */ | 2870 |
| 2796 if(stateUsed->lifeData.ascent_rate_meter_per_min > 1) /* a value < 1 would cause a bar in negative direction brush rectangle of 12 and step width of 6 */ | 2871 if(Divetime.Minutes < 1000) |
| 2797 { | 2872 snprintf(TextR1,TEXTSIZE,"\020\002\016%u:%02u",Divetime.Minutes, Divetime.Seconds); |
| 2798 if(!pSettings->FlipDisplay) | 2873 else |
| 2874 snprintf(TextR1,TEXTSIZE,"\020\002\016%u'",Divetime.Minutes); | |
| 2875 Gfx_colorsscheme_mod(TextR1, 0); | |
| 2876 GFX_write_string(&FontT105,&t7r1,TextR1,1); | |
| 2877 | |
| 2878 /* next deco stop */ | |
| 2879 if(nextstopDepthMeter) | |
| 2880 { | |
| 2881 snprintf(TextR2,TEXTSIZE,"\032\f\002%c",TXT_Decostop); | |
| 2882 GFX_write_string(&FontT42,&t7r2,TextR2,0); | |
| 2883 | |
| 2884 if((stateUsed->diveSettings.deco_type.ub.standard == VPM_MODE) && (pSettings->VPM_conservatism.ub.alternative) | |
| 2885 && (fabs(stateUsed->lifeData.depth_meter - nextstopDepthMeter)) < 1.5) | |
| 2799 { | 2886 { |
| 2800 start.y = t7l1.WindowY0 - 1; | 2887 TextR2[0] = '\026'; |
| 2888 textlength = 1; | |
| 2801 } | 2889 } |
| 2802 else | 2890 else |
| 2803 { | 2891 { |
| 2804 start.y = t7l3.WindowY0 - 25; | 2892 TextR2[0] = '\020'; |
| 2893 textlength = 1; | |
| 2805 } | 2894 } |
| 2806 | 2895 |
| 2807 for(int i = 0; i<4;i++) | 2896 textlength += snprintf(&TextR2[textlength],TEXTSIZE,"\002%u%c%c %u'" |
| 2808 { | |
| 2809 start.y += 5*6; | |
| 2810 stop.y = start.y; | |
| 2811 start.x = CUSTOMBOX_LINE_LEFT - 1; | |
| 2812 stop.x = start.x - 17; | |
| 2813 GFX_draw_line(&t7screen, start, stop, 0); | |
| 2814 // start.x = CUSTOMBOX_LINE_RIGHT + 2; old right too | |
| 2815 // stop.x = start.x + 17; | |
| 2816 // GFX_draw_line(&t7screen, start, stop, 0); | |
| 2817 } | |
| 2818 // new thick bar design Sept. 2015 | |
| 2819 start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 3 - 5; | |
| 2820 stop.x = start.x; | |
| 2821 if(!pSettings->FlipDisplay) | |
| 2822 { | |
| 2823 start.y = t7l1.WindowY0 - 1; | |
| 2824 } | |
| 2825 else | |
| 2826 { | |
| 2827 start.y = t7l3.WindowY0 - 25; | |
| 2828 } | |
| 2829 stop.y = start.y + (uint16_t)(stateUsed->lifeData.ascent_rate_meter_per_min * 6); | |
| 2830 stop.y -= 3; // wegen der Liniendicke von 12 anstelle von 9 | |
| 2831 if(stop.y >= 470) | |
| 2832 stop.y = 470; | |
| 2833 start.y += 7; // starte etwas weiter oben | |
| 2834 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 10) | |
| 2835 color = CLUT_EverythingOkayGreen; | |
| 2836 else | |
| 2837 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 15) | |
| 2838 color = CLUT_WarningYellow; | |
| 2839 else | |
| 2840 color = CLUT_WarningRed; | |
| 2841 | |
| 2842 GFX_draw_thick_line(12,&t7screen, start, stop, color); | |
| 2843 } | |
| 2844 //snprintf(TextL2,TEXTSIZE,"\f%.1f m/min",stateUsed->lifeData.ascent_rate_meter_per_min); | |
| 2845 | |
| 2846 /* divetime */ | |
| 2847 if(stateUsed->lifeData.counterSecondsShallowDepth) | |
| 2848 { | |
| 2849 snprintf(TextR1,TEXTSIZE,"\f\002\136 %u:%02u",TimeoutTime.Minutes, TimeoutTime.Seconds); | |
| 2850 GFX_write_string(&FontT42,&t7r1,TextR1,0); | |
| 2851 } | |
| 2852 else | |
| 2853 { | |
| 2854 snprintf(TextR1,TEXTSIZE,"\032\f\002%c",TXT_Divetime); | |
| 2855 GFX_write_string(&FontT42,&t7r1,TextR1,0); | |
| 2856 } | |
| 2857 | |
| 2858 if(Divetime.Minutes < 1000) | |
| 2859 snprintf(TextR1,TEXTSIZE,"\020\002\016%u:%02u",Divetime.Minutes, Divetime.Seconds); | |
| 2860 else | |
| 2861 snprintf(TextR1,TEXTSIZE,"\020\002\016%u'",Divetime.Minutes); | |
| 2862 t7_colorscheme_mod(TextR1); | |
| 2863 GFX_write_string(&FontT105,&t7r1,TextR1,1); | |
| 2864 | |
| 2865 /* next deco stop */ | |
| 2866 if(nextstopDepthMeter) | |
| 2867 { | |
| 2868 snprintf(TextR2,TEXTSIZE,"\032\f\002%c",TXT_Decostop); | |
| 2869 GFX_write_string(&FontT42,&t7r2,TextR2,0); | |
| 2870 textlength = snprintf(TextR2,TEXTSIZE,"\020\002%u%c%c %u'" | |
| 2871 , unit_depth_integer(nextstopDepthMeter) | 2897 , unit_depth_integer(nextstopDepthMeter) |
| 2872 , unit_depth_char1_T105() | 2898 , unit_depth_char1_T105() |
| 2873 , unit_depth_char2_T105() | 2899 , unit_depth_char2_T105() |
| 2874 , (nextstopLengthSeconds+59)/60); | 2900 , (nextstopLengthSeconds+59)/60); |
| 2875 t7_colorscheme_mod(TextR2); | 2901 Gfx_colorsscheme_mod(TextR2, 0); |
| 2876 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) | 2902 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) |
| 2877 TextR2[0] = '\031'; | 2903 TextR2[0] = '\031'; |
| 2878 if(textlength <= 9) | 2904 if(textlength <= 9) |
| 2879 GFX_write_string(&FontT105,&t7r2,TextR2,1); | 2905 GFX_write_string(&FontT105,&t7r2,TextR2,1); |
| 2880 else if(textlength <= 10) | 2906 else if(textlength <= 10) |
| 2885 else if(SafetyStopTime.Total && (depth > timer_Safetystop_GetDepthUpperLimit())) | 2911 else if(SafetyStopTime.Total && (depth > timer_Safetystop_GetDepthUpperLimit())) |
| 2886 { | 2912 { |
| 2887 snprintf(TextR2,TEXTSIZE,"\032\f\002%c%c",TXT_2BYTE,TXT2BYTE_SafetyStop2); | 2913 snprintf(TextR2,TEXTSIZE,"\032\f\002%c%c",TXT_2BYTE,TXT2BYTE_SafetyStop2); |
| 2888 GFX_write_string(&FontT42,&t7r2,TextR2,0); | 2914 GFX_write_string(&FontT42,&t7r2,TextR2,0); |
| 2889 snprintf(TextR2,TEXTSIZE,"\020\002\016%u:%02u",SafetyStopTime.Minutes,SafetyStopTime.Seconds); | 2915 snprintf(TextR2,TEXTSIZE,"\020\002\016%u:%02u",SafetyStopTime.Minutes,SafetyStopTime.Seconds); |
| 2890 t7_colorscheme_mod(TextR2); | 2916 Gfx_colorsscheme_mod(TextR2, 0); |
| 2891 GFX_write_string(&FontT105,&t7r2,TextR2,1); | 2917 GFX_write_string(&FontT105,&t7r2,TextR2,1); |
| 2892 } | 2918 } |
| 2893 | 2919 |
| 2894 /* tts - option 1 | 2920 /* tts - option 1 |
| 2895 * ndl - option 2 | 2921 * ndl - option 2 |
| 2900 GFX_write_string(&FontT42,&t7r3,TextR3,0); | 2926 GFX_write_string(&FontT42,&t7r3,TextR3,0); |
| 2901 if(pDecoinfo->output_time_to_surface_seconds < 1000 * 60) | 2927 if(pDecoinfo->output_time_to_surface_seconds < 1000 * 60) |
| 2902 snprintf(TextR3,TEXTSIZE,"\020\002%i'",(pDecoinfo->output_time_to_surface_seconds + 59)/ 60); | 2928 snprintf(TextR3,TEXTSIZE,"\020\002%i'",(pDecoinfo->output_time_to_surface_seconds + 59)/ 60); |
| 2903 else | 2929 else |
| 2904 snprintf(TextR3,TEXTSIZE,"\020\002%ih",(pDecoinfo->output_time_to_surface_seconds + 59)/ 3600); | 2930 snprintf(TextR3,TEXTSIZE,"\020\002%ih",(pDecoinfo->output_time_to_surface_seconds + 59)/ 3600); |
| 2905 t7_colorscheme_mod(TextR3); | 2931 Gfx_colorsscheme_mod(TextR3, 0); |
| 2906 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) | 2932 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) |
| 2907 TextR2[0] = '\031'; | 2933 TextR2[0] = '\031'; |
| 2908 GFX_write_string(&FontT105,&t7r3,TextR3,1); | 2934 GFX_write_string(&FontT105,&t7r3,TextR3,1); |
| 2909 } | 2935 } |
| 2910 else if(pDecoinfo->output_ndl_seconds) | 2936 else if(pDecoinfo->output_ndl_seconds) |
| 2913 GFX_write_string(&FontT42,&t7r3,TextR3,0); | 2939 GFX_write_string(&FontT42,&t7r3,TextR3,0); |
| 2914 if(pDecoinfo->output_ndl_seconds < 1000 * 60) | 2940 if(pDecoinfo->output_ndl_seconds < 1000 * 60) |
| 2915 snprintf(TextR3,TEXTSIZE,"\020\002%i'",pDecoinfo->output_ndl_seconds/60); | 2941 snprintf(TextR3,TEXTSIZE,"\020\002%i'",pDecoinfo->output_ndl_seconds/60); |
| 2916 else | 2942 else |
| 2917 snprintf(TextR3,TEXTSIZE,"\020\002%ih",pDecoinfo->output_ndl_seconds/3600); | 2943 snprintf(TextR3,TEXTSIZE,"\020\002%ih",pDecoinfo->output_ndl_seconds/3600); |
| 2918 t7_colorscheme_mod(TextR3); | 2944 Gfx_colorsscheme_mod(TextR3, 0); |
| 2919 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) | 2945 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) |
| 2920 TextR2[0] = '\031'; | 2946 TextR2[0] = '\031'; |
| 2921 GFX_write_string(&FontT105,&t7r3,TextR3,1); | 2947 GFX_write_string(&FontT105,&t7r3,TextR3,1); |
| 2922 } | 2948 } |
| 2923 | 2949 |
| 2953 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); | 2979 GFX_write_string_color(&FontT48,&t7c2,TextR1,0,CLUT_WarningYellow); |
| 2954 } else if (get_globalState() == StDBAILOUT) { | 2980 } else if (get_globalState() == StDBAILOUT) { |
| 2955 if (isLoopMode(stateUsed->diveSettings.diveMode)) { | 2981 if (isLoopMode(stateUsed->diveSettings.diveMode)) { |
| 2956 textPointer = snprintf(TextR1, TEXTSIZE, "\a\001 %c%c ", TXT_2BYTE, TXT2BYTE_BailoutShort); | 2982 textPointer = snprintf(TextR1, TEXTSIZE, "\a\001 %c%c ", TXT_2BYTE, TXT2BYTE_BailoutShort); |
| 2957 textPointer += tHome_gas_writer(stateUsed->diveSettings.gas[actualBetterBailoutGasId()].oxygen_percentage, stateUsed->diveSettings.gas[actualBetterBailoutGasId()].helium_percentage, &TextR1[textPointer]); | 2983 textPointer += tHome_gas_writer(stateUsed->diveSettings.gas[actualBetterBailoutGasId()].oxygen_percentage, stateUsed->diveSettings.gas[actualBetterBailoutGasId()].helium_percentage, &TextR1[textPointer]); |
| 2984 TextR1[textPointer++] = '?'; | |
| 2958 TextR1[textPointer++] = ' '; | 2985 TextR1[textPointer++] = ' '; |
| 2959 TextR1[textPointer++] = '?'; | 2986 TextR1[textPointer++] = 0; |
| 2960 } else { | 2987 } else { |
| 2961 textPointer = snprintf(TextR1, TEXTSIZE, "\a\001 %c%c %01.2f/", TXT_2BYTE, TXT2BYTE_LoopShort, stateUsed->diveSettings.setpoint[actualBetterSetpointId()].setpoint_cbar / 100.0); | 2988 textPointer = snprintf(TextR1, TEXTSIZE, "\a\001 %c%c %01.2f/", TXT_2BYTE, TXT2BYTE_LoopShort, stateUsed->diveSettings.setpoint[actualBetterSetpointId()].setpoint_cbar / 100.0); |
| 2962 textPointer += tHome_gas_writer(stateUsed->diveSettings.gas[stateUsed->lifeData.lastDiluent_GasIdInSettings].oxygen_percentage, stateUsed->diveSettings.gas[stateUsed->lifeData.lastDiluent_GasIdInSettings].helium_percentage, &TextR1[textPointer]); | 2989 textPointer += tHome_gas_writer(stateUsed->diveSettings.gas[stateUsed->lifeData.lastDiluent_GasIdInSettings].oxygen_percentage, stateUsed->diveSettings.gas[stateUsed->lifeData.lastDiluent_GasIdInSettings].helium_percentage, &TextR1[textPointer]); |
| 2990 TextR1[textPointer++] = '?'; | |
| 2963 TextR1[textPointer++] = ' '; | 2991 TextR1[textPointer++] = ' '; |
| 2964 TextR1[textPointer++] = '?'; | 2992 TextR1[textPointer++] = 0; |
| 2965 } | 2993 } |
| 2966 | 2994 |
| 2967 GFX_write_string_color(&FontT48, &t7c2, TextR1, 0, CLUT_WarningYellow); | 2995 GFX_write_string_color(&FontT48, &t7c2, TextR1, 0, CLUT_WarningYellow); |
| 2968 } else if (get_globalState() == StDSETPOINT) { | 2996 } else if (get_globalState() == StDSETPOINT) { |
| 2969 snprintf(TextR1, TEXTSIZE, "\a\001 %c%c %01.2f? ", TXT_2BYTE, TXT2BYTE_SetpointShort, getSwitchToSetpointCbar() / 100.0); | 2997 snprintf(TextR1, TEXTSIZE, "\a\001 %c%c %01.2f? ", TXT_2BYTE, TXT2BYTE_SetpointShort, getSwitchToSetpointCbar() / 100.0); |
| 3059 } | 3087 } |
| 3060 GFX_write_string_color(&FontT48,&t7c2,TextC2,0,CLUT_WarningYellow); | 3088 GFX_write_string_color(&FontT48,&t7c2,TextC2,0,CLUT_WarningYellow); |
| 3061 } | 3089 } |
| 3062 else | 3090 else |
| 3063 { | 3091 { |
| 3064 t7_colorscheme_mod(TextC2); | 3092 Gfx_colorsscheme_mod(TextC2, 0); |
| 3065 GFX_write_string(&FontT48,&t7c2,TextC2,0); // T54 has only numbers | 3093 GFX_write_string(&FontT48,&t7c2,TextC2,0); // T54 has only numbers |
| 3066 } | 3094 } |
| 3067 | 3095 |
| 3068 if(stateUsed->diveSettings.ccrOption) | 3096 if(stateUsed->diveSettings.ccrOption) |
| 3069 { | 3097 { |
| 3076 TextC2[0] = '\a'; // inverse instead of color \020 | 3104 TextC2[0] = '\a'; // inverse instead of color \020 |
| 3077 GFX_write_string_color(&FontT48,&t7c2,TextC2,0,CLUT_WarningYellow); | 3105 GFX_write_string_color(&FontT48,&t7c2,TextC2,0,CLUT_WarningYellow); |
| 3078 } | 3106 } |
| 3079 else | 3107 else |
| 3080 { | 3108 { |
| 3081 t7_colorscheme_mod(TextC2); | 3109 Gfx_colorsscheme_mod(TextC2, 0); |
| 3082 GFX_write_string(&FontT48,&t7c2,TextC2,0); | 3110 GFX_write_string(&FontT48,&t7c2,TextC2,0); |
| 3083 } | 3111 } |
| 3084 } | 3112 } |
| 3085 } | 3113 } |
| 3086 else if(settingsGetPointer()->alwaysShowPPO2) | 3114 else if(settingsGetPointer()->alwaysShowPPO2) |
| 3087 { | 3115 { |
| 3088 snprintf(TextC2,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2); | 3116 snprintf(TextC2,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2); |
| 3089 t7_colorscheme_mod(TextC2); | 3117 Gfx_colorsscheme_mod(TextC2, 0); |
| 3090 GFX_write_string(&FontT48,&t7c2,TextC2,0); | 3118 GFX_write_string(&FontT48,&t7c2,TextC2,0); |
| 3091 } | 3119 } |
| 3092 } | 3120 } |
| 3093 | 3121 |
| 3094 /* algorithm, ccr, bailout and battery */ | 3122 /* algorithm, ccr, bailout and battery */ |
| 3171 GFX_write_string(&FontT24,&t7voltage,TextC1,0); | 3199 GFX_write_string(&FontT24,&t7voltage,TextC1,0); |
| 3172 } | 3200 } |
| 3173 } | 3201 } |
| 3174 else | 3202 else |
| 3175 { | 3203 { |
| 3176 t7_colorscheme_mod(TextC1); | 3204 Gfx_colorsscheme_mod(TextC1, 0); |
| 3177 GFX_write_string(&Batt24,&t7batt,TextC1,0); | 3205 GFX_write_string(&Batt24,&t7batt,TextC1,0); |
| 3178 | 3206 |
| 3179 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) | 3207 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) |
| 3180 { | 3208 { |
| 3181 snprintf(TextC1,16,"\020\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); | 3209 snprintf(TextC1,16,"\020\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); |
| 3182 t7_colorscheme_mod(TextC1); | 3210 Gfx_colorsscheme_mod(TextC1, 0); |
| 3183 GFX_write_string(&FontT24,&t7voltage,TextC1,0); // t7batt | 3211 GFX_write_string(&FontT24,&t7voltage,TextC1,0); // t7batt |
| 3184 } | 3212 } |
| 3185 } | 3213 } |
| 3186 | 3214 |
| 3187 /* customizable left lower corner */ | 3215 /* customizable left lower corner */ |
| 3195 | 3223 |
| 3196 background.pointer = 0; | 3224 background.pointer = 0; |
| 3197 if(customview_warnings && warning_count_high_time) | 3225 if(customview_warnings && warning_count_high_time) |
| 3198 t7_show_customview_warnings(); | 3226 t7_show_customview_warnings(); |
| 3199 else | 3227 else |
| 3228 { | |
| 3200 t7_refresh_customview(); | 3229 t7_refresh_customview(); |
| 3230 requestBuzzerActivation(0); | |
| 3231 } | |
| 3201 | 3232 |
| 3202 /* the frame */ | 3233 /* the frame */ |
| 3203 draw_frame(1,1, CLUT_DIVE_pluginbox, CLUT_DIVE_FieldSeperatorLines); | 3234 draw_frame(1,1, CLUT_DIVE_pluginbox, CLUT_DIVE_FieldSeperatorLines); |
| 3204 } | 3235 } |
| 3205 | 3236 |
| 3225 if((selection_custom_field == LCC_SimPpo2) && (settingsGetPointer()->dive_mode != DIVEMODE_PSCR)) | 3256 if((selection_custom_field == LCC_SimPpo2) && (settingsGetPointer()->dive_mode != DIVEMODE_PSCR)) |
| 3226 { | 3257 { |
| 3227 selection_custom_field++; | 3258 selection_custom_field++; |
| 3228 } | 3259 } |
| 3229 #endif | 3260 #endif |
| 3261 #ifdef ENABLE_CO2_SUPPORT | |
| 3262 if((selection_custom_field == LCC_CO2) && (settingsGetPointer()->co2_sensor_active == 0)) | |
| 3263 { | |
| 3264 selection_custom_field++; | |
| 3265 } | |
| 3266 | |
| 3267 #endif | |
| 3268 | |
| 3230 if(selection_custom_field >= LLC_END) | 3269 if(selection_custom_field >= LLC_END) |
| 3231 { | 3270 { |
| 3232 selection_custom_field = LLC_Empty; | 3271 selection_custom_field = LLC_Empty; |
| 3233 } | 3272 } |
| 3234 } | 3273 } |
| 3355 | 3394 |
| 3356 case LLC_ScrubberTime: | 3395 case LLC_ScrubberTime: |
| 3357 tinyHeaderFont = 1; | 3396 tinyHeaderFont = 1; |
| 3358 headerText[2] = TXT_ScrubTime; | 3397 headerText[2] = TXT_ScrubTime; |
| 3359 | 3398 |
| 3360 printScrubberText(text, TEXTSIZE, pSettings); | 3399 printScrubberText(text, TEXTSIZE, stateUsed->scrubberDataDive, pSettings); |
| 3361 | 3400 |
| 3362 break; | 3401 break; |
| 3363 #ifdef ENABLE_PSCR_MODE | 3402 #ifdef ENABLE_PSCR_MODE |
| 3364 case LCC_SimPpo2: | 3403 case LCC_SimPpo2: |
| 3365 headerText[2] = TXT_SimPpo2; | 3404 headerText[2] = TXT_SimPpo2; |
| 3481 if(tinyHeaderFont) | 3520 if(tinyHeaderFont) |
| 3482 GFX_write_string(&FontT24,&t7l3,headerText,0); | 3521 GFX_write_string(&FontT24,&t7l3,headerText,0); |
| 3483 else | 3522 else |
| 3484 GFX_write_string(&FontT42,&t7l3,headerText,0); | 3523 GFX_write_string(&FontT42,&t7l3,headerText,0); |
| 3485 | 3524 |
| 3486 t7_colorscheme_mod(text); | 3525 Gfx_colorsscheme_mod(text, 0); |
| 3487 #ifndef ENABLE_BOTTLE_SENSOR | 3526 #ifndef ENABLE_BOTTLE_SENSOR |
| 3488 #ifdef ENABLE_CO2_SUPPORT | 3527 #ifdef ENABLE_CO2_SUPPORT |
| 3489 if(selection_custom_field != LCC_CO2) | 3528 if(selection_custom_field != LCC_CO2) |
| 3490 { | 3529 { |
| 3491 GFX_write_string(&FontT105,&t7l3,text,line); | 3530 GFX_write_string(&FontT105,&t7l3,text,line); |
| 3604 | 3643 |
| 3605 text[textptr] = 0; | 3644 text[textptr] = 0; |
| 3606 return lineCount; | 3645 return lineCount; |
| 3607 } | 3646 } |
| 3608 | 3647 |
| 3609 static void t7_colorscheme_mod(char *text) { | |
| 3610 char *p = text; | |
| 3611 while (*p) { | |
| 3612 if ((*p == '\020') && !GFX_is_colorschemeDiveStandard()) | |
| 3613 *p = '\027'; | |
| 3614 p++; | |
| 3615 } | |
| 3616 } | |
| 3617 | |
| 3618 void draw_frame(_Bool PluginBoxHeader, _Bool LinesOnTheSides, uint8_t colorBox, uint8_t colorLinesOnTheSide) | 3648 void draw_frame(_Bool PluginBoxHeader, _Bool LinesOnTheSides, uint8_t colorBox, uint8_t colorLinesOnTheSide) |
| 3619 { | 3649 { |
| 3620 point_t LeftLow, WidthHeight; | 3650 point_t LeftLow, WidthHeight; |
| 3621 point_t start, stop; | 3651 point_t start, stop; |
| 3622 | 3652 |
| 3978 | 4008 |
| 3979 t7cY0free.WindowLineSpacing = 28 + 48 + 14; | 4009 t7cY0free.WindowLineSpacing = 28 + 48 + 14; |
| 3980 t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 2 * t7cY0free.WindowLineSpacing; | 4010 t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 2 * t7cY0free.WindowLineSpacing; |
| 3981 t7cY0free.WindowNumberOfTextLines = 3; | 4011 t7cY0free.WindowNumberOfTextLines = 3; |
| 3982 | 4012 |
| 4013 #ifdef T7_DEBUG_RUNTIME | |
| 4014 textpointer += snprintf(&text[textpointer],50,"Main loop %ld\n\r",getMainLoopTime()); | |
| 4015 textpointer += snprintf(&text[textpointer],50,"Grafic loop %ld\n\r",getGfxLoopTime()); | |
| 4016 textpointer += snprintf(&text[textpointer],50,"Decoloop %ld\n\r",getDecoLoopTime()); | |
| 4017 GFX_write_string(&FontT24, &t7cY0free, text, 1); | |
| 4018 #else | |
| 3983 textpointer += snprintf(&text[textpointer],50,"Ambient [bar]\n\r"); | 4019 textpointer += snprintf(&text[textpointer],50,"Ambient [bar]\n\r"); |
| 3984 textpointer += snprintf(&text[textpointer],50,"Surface [bar] + salt\n\r"); | 4020 textpointer += snprintf(&text[textpointer],50,"Surface [bar] + salt\n\r"); |
| 3985 // textpointer += snprintf(&text[textpointer],50,"Difference [mbar]\n\r"); | 4021 // textpointer += snprintf(&text[textpointer],50,"Difference [mbar]\n\r"); |
| 3986 textpointer += snprintf(&text[textpointer],50,"ShallowCounter [s]\n\r"); | 4022 textpointer += snprintf(&text[textpointer],50,"ShallowCounter [s]\n\r"); |
| 3987 GFX_write_string(&FontT24, &t7cY0free, text, 1); | 4023 GFX_write_string(&FontT24, &t7cY0free, text, 1); |
| 3995 ,stateUsed->lifeData.pressure_ambient_bar | 4031 ,stateUsed->lifeData.pressure_ambient_bar |
| 3996 ,stateUsed->lifeData.pressure_surface_bar | 4032 ,stateUsed->lifeData.pressure_surface_bar |
| 3997 ,settingsGetPointer()->salinity | 4033 ,settingsGetPointer()->salinity |
| 3998 ,stateUsed->lifeData.counterSecondsShallowDepth); | 4034 ,stateUsed->lifeData.counterSecondsShallowDepth); |
| 3999 GFX_write_string(&FontT42, &t7cY0free, text, 1); | 4035 GFX_write_string(&FontT42, &t7cY0free, text, 1); |
| 4036 #endif | |
| 4000 } | 4037 } |
| 4001 | 4038 |
| 4002 | 4039 void t7_showPosition(void) |
| 4040 { | |
| 4041 char text[256+50]; | |
| 4042 uint8_t textpointer = 0; | |
| 4043 point_t start, stop; | |
| 4044 uint8_t index = 0; | |
| 4045 uint8_t color = 0; | |
| 4046 SSettings* pSettings = settingsGetPointer(); | |
| 4047 | |
| 4048 t7cY0free.WindowLineSpacing = 28 + 48 + 14; | |
| 4049 t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 2 * t7cY0free.WindowLineSpacing; | |
| 4050 t7cY0free.WindowNumberOfTextLines = 3; | |
| 4051 t7cY0free.WindowY0 -= 20; | |
| 4052 | |
| 4053 t7cY0free.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
| 4054 t7cY0free.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; | |
| 4055 | |
| 4056 if(pSettings->FlipDisplay) | |
| 4057 { | |
| 4058 t7cY0free.WindowY0 = t7cH.WindowY0 + 15; | |
| 4059 t7cY0free.WindowY1 = t7cY0free.WindowY0 + 250; | |
| 4060 } | |
| 4061 | |
| 4062 if(stateUsed->lifeData.gnssData.fixType < 2) | |
| 4063 { | |
| 4064 textpointer += snprintf(&text[textpointer],50,"\001Satellites\n\r"); | |
| 4065 if(stateUsed->lifeData.gnssData.alive & GNSS_ALIVE_STATE_ALIVE) | |
| 4066 { | |
| 4067 textpointer += snprintf(&text[textpointer],50,"\001\020Status\n\r"); | |
| 4068 } | |
| 4069 else | |
| 4070 { | |
| 4071 textpointer += snprintf(&text[textpointer],50,"\001\021Status\n\r"); | |
| 4072 } | |
| 4073 } | |
| 4074 else | |
| 4075 { | |
| 4076 textpointer += snprintf(&text[textpointer],50,"\001Longitude\n\r"); | |
| 4077 textpointer += snprintf(&text[textpointer],50,"\001Latitude\n\r"); | |
| 4078 } | |
| 4079 GFX_write_string(&FontT24, &t7cY0free, text, 1); | |
| 4080 | |
| 4081 if(!pSettings->FlipDisplay) | |
| 4082 { | |
| 4083 t7cY0free.WindowY0 -= 52; | |
| 4084 } | |
| 4085 else | |
| 4086 { | |
| 4087 t7cY0free.WindowY1 = 370; | |
| 4088 } | |
| 4089 | |
| 4090 if(stateUsed->lifeData.gnssData.fixType < 2) | |
| 4091 { | |
| 4092 snprintf(text,60,"\001%d\n\r",stateUsed->lifeData.gnssData.numSat); | |
| 4093 } | |
| 4094 else | |
| 4095 { | |
| 4096 snprintf(text,60, | |
| 4097 "\001%0.5f\n\r" | |
| 4098 "\001%0.5f\n\r" | |
| 4099 ,stateUsed->lifeData.gnssData.coord.fLat ,stateUsed->lifeData.gnssData.coord.fLon); | |
| 4100 } | |
| 4101 GFX_write_string(&FontT42, &t7cY0free, text, 1); | |
| 4102 | |
| 4103 if(stateUsed->lifeData.gnssData.fixType < 2) /* draw status bars */ | |
| 4104 { | |
| 4105 if(!pSettings->FlipDisplay) | |
| 4106 { | |
| 4107 start.x = t7cY0free.WindowX0 + 85; | |
| 4108 stop.x = start.x; | |
| 4109 start.y = t7cY0free.WindowY0 + 75; | |
| 4110 stop.y = start.y + 20; | |
| 4111 } | |
| 4112 else | |
| 4113 { | |
| 4114 start.x = t7cY0free.WindowX0 - 50; | |
| 4115 stop.x = start.x; | |
| 4116 start.y = t7cY0free.WindowY0 - 75; | |
| 4117 stop.y = start.y - 20; | |
| 4118 } | |
| 4119 | |
| 4120 while((index < stateUsed->lifeData.gnssData.numSat) && (index < 4)) | |
| 4121 { | |
| 4122 if(stateUsed->lifeData.gnssData.signalQual[index] > 4) color = CLUT_NiceGreen; | |
| 4123 if((stateUsed->lifeData.gnssData.signalQual[index] > 2) && (stateUsed->lifeData.gnssData.signalQual[index] <= 4)) color = CLUT_WarningYellow; | |
| 4124 if(stateUsed->lifeData.gnssData.signalQual[index] <= 2) color = CLUT_WarningRed; | |
| 4125 GFX_draw_thick_line(20, &t7screen, start, stop, color); | |
| 4126 start.x += 40; | |
| 4127 stop.x += 40; | |
| 4128 | |
| 4129 index++; | |
| 4130 } | |
| 4131 if(stateUsed->lifeData.gnssData.alive & GNSS_ALIVE_BACKUP_POS) | |
| 4132 { | |
| 4133 snprintf(text,50,"\001%2.2f %2.2f", stateUsed->lifeData.gnssData.coord.fLat,stateUsed->lifeData.gnssData.coord.fLon); | |
| 4134 GFX_write_string(&FontT24, &t7cY0free, text, 3); | |
| 4135 } | |
| 4136 } | |
| 4137 | |
| 4138 | |
| 4139 } | |
| 4003 void t7_SummaryOfLeftCorner(void) | 4140 void t7_SummaryOfLeftCorner(void) |
| 4004 { | 4141 { |
| 4005 char text[256+60]; | 4142 char text[256+60]; |
| 4006 uint8_t textpointer = 0; | 4143 uint8_t textpointer = 0; |
| 4007 SSettings* pSettings = settingsGetPointer(); | 4144 SSettings* pSettings = settingsGetPointer(); |
| 4108 { | 4245 { |
| 4109 text[textpointer++] = '\n'; | 4246 text[textpointer++] = '\n'; |
| 4110 text[textpointer++] = '\r'; | 4247 text[textpointer++] = '\r'; |
| 4111 text[textpointer++] = '\t'; | 4248 text[textpointer++] = '\t'; |
| 4112 | 4249 |
| 4113 textpointer += printScrubberText(&text[textpointer], 10, pSettings); | 4250 textpointer += printScrubberText(&text[textpointer], 10, stateUsed->scrubberDataDive, pSettings); |
| 4114 } | 4251 } |
| 4115 text[textpointer++] = 0; | 4252 text[textpointer++] = 0; |
| 4116 t7_colorscheme_mod(text); | 4253 Gfx_colorsscheme_mod(text, 0); |
| 4117 GFX_write_string(&FontT42, &t7cY0free, text, 1); | 4254 GFX_write_string(&FontT42, &t7cY0free, text, 1); |
| 4118 } | 4255 } |
| 4119 | 4256 |
| 4120 void t7_compass(uint16_t ActualHeading, uint16_t UserSetHeading) | 4257 void t7_compass(uint16_t ActualHeading, uint16_t UserSetHeading) |
| 4121 { | 4258 { |
| 4493 } | 4630 } |
| 4494 else | 4631 else |
| 4495 { | 4632 { |
| 4496 level = 10; | 4633 level = 10; |
| 4497 } | 4634 } |
| 4635 if(curIndex > 1) | |
| 4636 { | |
| 4637 level = (level + ChargerLog[curIndex - 1]) / 2; /* smooth small jumps */ | |
| 4638 } | |
| 4498 if(curIndex < 59) | 4639 if(curIndex < 59) |
| 4499 { | 4640 { |
| 4500 ChargerLog[curIndex++] = level; | 4641 ChargerLog[curIndex++] = level; |
| 4501 } | 4642 } |
| 4502 else | 4643 else |
| 4503 { | 4644 { |
| 4504 memcpy (&ChargerLog[0],&ChargerLog[1],sizeof(ChargerLog) - 1); | 4645 memcpy (&ChargerLog[0],&ChargerLog[1],sizeof(ChargerLog) - 1); |
| 4505 ChargerLog[curIndex] = level; | 4646 ChargerLog[curIndex] = level; |
| 4506 } | 4647 } |
| 4507 if(curIndex > 1) | 4648 if(curIndex > 1) /* estimate time til charging is complete */ |
| 4508 { | 4649 { |
| 4509 averageSpeed = ((averageSpeed * (curIndex-1)) + charge) / curIndex; | 4650 averageSpeed = ((averageSpeed * (curIndex-1)) + charge) / curIndex; |
| 4510 completeSec = (100.0 - stateUsed->lifeData.battery_charge) / averageSpeed; | 4651 completeSec = (100.0 - stateUsed->lifeData.battery_charge) / averageSpeed; |
| 4511 } | 4652 } |
| 4512 else | 4653 else |
| 4559 localCharge *= -1.0; | 4700 localCharge *= -1.0; |
| 4560 } | 4701 } |
| 4561 | 4702 |
| 4562 if(stateUsed->chargeStatus != CHARGER_off) | 4703 if(stateUsed->chargeStatus != CHARGER_off) |
| 4563 { | 4704 { |
| 4564 if(lastCharge != localCharge) | 4705 curTick = HAL_GetTick(); |
| 4565 { | 4706 deltatime = (curTick - lastTick); |
| 4566 curTick = HAL_GetTick(); | 4707 |
| 4567 deltatime = (curTick - lastTick); | 4708 if((deltatime > 3000) || (lastCharge != localCharge)) /* Charge value update is expected every 2 second. */ |
| 4568 lastTick = curTick; | 4709 { /* Added timeout to keep graph moving in case charger is temporary idle */ |
| 4569 if(lastCharge < localCharge) | 4710 if(lastCharge != localCharge) |
| 4570 { | 4711 { |
| 4571 speed = (localCharge - lastCharge) * 1000.0 / deltatime; | 4712 if(lastCharge < localCharge) |
| 4713 { | |
| 4714 speed = (localCharge - lastCharge) * 1000.0 / deltatime; | |
| 4715 } | |
| 4716 | |
| 4717 if(localCharge > 100.0) | |
| 4718 { | |
| 4719 localCharge = 100.0; | |
| 4720 } | |
| 4721 lastCharge = localCharge; | |
| 4572 } | 4722 } |
| 4573 | |
| 4574 if(localCharge > 100.0) | |
| 4575 { | |
| 4576 localCharge = 100.0; | |
| 4577 } | |
| 4578 | |
| 4579 lastCharge = localCharge; | |
| 4580 } | |
| 4581 | |
| 4582 | |
| 4583 if(deltatime > 1000) | |
| 4584 { | |
| 4585 deltatime = 0; | 4723 deltatime = 0; |
| 4586 remainingSec = LogDeltaCharge(speed); | 4724 remainingSec = LogDeltaCharge(speed); |
| 4587 speed = 0; | 4725 speed = 0; |
| 4726 lastTick = curTick; | |
| 4588 } | 4727 } |
| 4589 } | 4728 } |
| 4590 textpointer += snprintf(&text[textpointer],50,"\n\r"); | 4729 textpointer += snprintf(&text[textpointer],50,"\n\r"); |
| 4591 textpointer += snprintf(&text[textpointer],50,"\001%c\n\r",TXT_ChargeHour); | 4730 textpointer += snprintf(&text[textpointer],50,"\001%c\n\r",TXT_ChargeHour); |
| 4592 | 4731 |
| 4603 { | 4742 { |
| 4604 t7cY0free.WindowY0 -= 52; | 4743 t7cY0free.WindowY0 -= 52; |
| 4605 } | 4744 } |
| 4606 else | 4745 else |
| 4607 { | 4746 { |
| 4608 t7cY0free.WindowY1 += 52; | 4747 t7cY0free.WindowY1 += 52; |
| 4609 } | 4748 } |
| 4610 | 4749 |
| 4611 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->chargeStatus != CHARGER_off)) | 4750 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->chargeStatus != CHARGER_off)) |
| 4612 { | 4751 { |
| 4613 snprintf(text,60, | 4752 snprintf(text,60, |
| 4662 bool t7_isCompassShowing(void) | 4801 bool t7_isCompassShowing(void) |
| 4663 { | 4802 { |
| 4664 return selection_customview == CVIEW_Compass || selection_custom_field == LLC_Compass; | 4803 return selection_customview == CVIEW_Compass || selection_custom_field == LLC_Compass; |
| 4665 } | 4804 } |
| 4666 | 4805 |
| 4806 void t7_drawAcentGraph(uint8_t color) | |
| 4807 { | |
| 4808 point_t start, stop; | |
| 4809 | |
| 4810 SSettings* pSettings; | |
| 4811 pSettings = settingsGetPointer(); | |
| 4812 | |
| 4813 | |
| 4814 if(!pSettings->FlipDisplay) | |
| 4815 { | |
| 4816 start.y = t7l1.WindowY0 - 1; | |
| 4817 } | |
| 4818 else | |
| 4819 { | |
| 4820 start.y = t7l3.WindowY0 - 25; | |
| 4821 } | |
| 4822 | |
| 4823 for(int i = 0; i<4;i++) | |
| 4824 { | |
| 4825 start.y += 5*6; | |
| 4826 stop.y = start.y; | |
| 4827 start.x = CUSTOMBOX_LINE_LEFT - 1; | |
| 4828 stop.x = start.x - 17; | |
| 4829 GFX_draw_line(&t7screen, start, stop, 0); | |
| 4830 // start.x = CUSTOMBOX_LINE_RIGHT + 2; old right too | |
| 4831 // stop.x = start.x + 17; | |
| 4832 // GFX_draw_line(&t7screen, start, stop, 0); | |
| 4833 } | |
| 4834 // new thick bar design Sept. 2015 | |
| 4835 start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 3 - 5; | |
| 4836 stop.x = start.x; | |
| 4837 if(!pSettings->FlipDisplay) | |
| 4838 { | |
| 4839 start.y = t7l1.WindowY0 - 1; | |
| 4840 } | |
| 4841 else | |
| 4842 { | |
| 4843 start.y = t7l3.WindowY0 - 25; | |
| 4844 } | |
| 4845 stop.y = start.y + (uint16_t)(stateUsed->lifeData.ascent_rate_meter_per_min * 6); | |
| 4846 stop.y -= 3; // wegen der Liniendicke von 12 anstelle von 9 | |
| 4847 if(stop.y >= 470) | |
| 4848 stop.y = 470; | |
| 4849 start.y += 7; // starte etwas weiter oben | |
| 4850 if(color == 0) | |
| 4851 { | |
| 4852 color = CLUT_EverythingOkayGreen; /* do not use white color for drawing graph */ | |
| 4853 } | |
| 4854 | |
| 4855 GFX_draw_thick_line(12,&t7screen, start, stop, color); | |
| 4856 } | |
| 4857 | |
| 4858 #define ASCENT_GRAPH_YPIXEL 110 | |
| 4859 | |
| 4860 | |
| 4861 uint8_t t7_drawSlowExitGraph() /* this function is only called if diver is below last last stop depth */ | |
| 4862 { | |
| 4863 static uint16_t countDownSec = 0; | |
| 4864 uint8_t drawingMeterStep; | |
| 4865 static float exitDepthMeter = 0.0; | |
| 4866 | |
| 4867 uint8_t index = 0; | |
| 4868 uint8_t color = 0; | |
| 4869 point_t start, stop; | |
| 4870 | |
| 4871 SSettings* pSettings; | |
| 4872 pSettings = settingsGetPointer(); | |
| 4873 | |
| 4874 | |
| 4875 if(calculateSlowExit(&countDownSec, &exitDepthMeter, &color)) /* graph to be drawn? */ | |
| 4876 { | |
| 4877 if(!pSettings->FlipDisplay) | |
| 4878 { | |
| 4879 start.y = t7l1.WindowY0 - 1; | |
| 4880 } | |
| 4881 else | |
| 4882 { | |
| 4883 start.y = t7l3.WindowY0 - 25; | |
| 4884 } | |
| 4885 drawingMeterStep = ASCENT_GRAPH_YPIXEL / pSettings->last_stop_depth_meter; /* based on 120 / 4 = 30 of standard ascent graph */ | |
| 4886 for(index = 0; index < pSettings->last_stop_depth_meter; index++) /* draw meter indicators */ | |
| 4887 { | |
| 4888 start.y += drawingMeterStep; | |
| 4889 stop.y = start.y; | |
| 4890 start.x = CUSTOMBOX_LINE_LEFT - 1; | |
| 4891 stop.x = start.x - 38; | |
| 4892 GFX_draw_line(&t7screen, start, stop, 0); | |
| 4893 } | |
| 4894 | |
| 4895 start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 20; | |
| 4896 stop.x = start.x; | |
| 4897 if(!pSettings->FlipDisplay) | |
| 4898 { | |
| 4899 start.y = t7l1.WindowY0 + ASCENT_GRAPH_YPIXEL + 5; | |
| 4900 } | |
| 4901 else | |
| 4902 { | |
| 4903 start.y = t7l3.WindowY0 - 25 + ASCENT_GRAPH_YPIXEL + 5; | |
| 4904 } | |
| 4905 stop.y = start.y - countDownSec * (ASCENT_GRAPH_YPIXEL / (float)(pSettings->slowExitTime * 60.0)); | |
| 4906 if(stop.y >= 470) stop.y = 470; | |
| 4907 if(!pSettings->FlipDisplay) | |
| 4908 { | |
| 4909 stop.y += 5; | |
| 4910 } | |
| 4911 GFX_draw_thick_line(15,&t7screen, start, stop, 3); | |
| 4912 /* mark diver depth */ | |
| 4913 start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 30; | |
| 4914 stop.x = start.x + 24; | |
| 4915 | |
| 4916 start.y = start.y - (stateUsed->lifeData.depth_meter * (ASCENT_GRAPH_YPIXEL) / pSettings->last_stop_depth_meter); | |
| 4917 stop.y = start.y; | |
| 4918 GFX_draw_thick_line(10,&t7screen, start, stop, 9); | |
| 4919 } | |
| 4920 else | |
| 4921 { | |
| 4922 color = 0xff; | |
| 4923 } | |
| 4924 return color; | |
| 4925 } | |
| 4667 | 4926 |
| 4668 void t7_tick(void) | 4927 void t7_tick(void) |
| 4669 { | 4928 { |
| 4670 SSettings *settings = settingsGetPointer(); | 4929 SSettings *settings = settingsGetPointer(); |
| 4671 | 4930 |
