# HG changeset patch # User ideenmodellierer # Date 1703702237 -3600 # Node ID 18946846b95b01a17f09d52dad948e5a03fe81f9 # Parent 8d6c35655d4db7a6233d6314114cc09dbec88cfd Bugfixes and code cleanup for BF views: BF views gauge and apnoe were using "dive computer" T3 view functions which caused some problem because these legacy views were not intended to work with customer view selection. A switch condition has been added to skip these kind of functions in case a design other T3 is in use. Another potential problem was that there were two definitions for T3 and T7 views which were basically the same. If they wold not be the same the switching functionality wold not work properly. To avoid this problem in futur the arrays have been merged => the view are handled sing the (newer) cv_view arrays instead of the standard_views which were in used before the user could the views which should be shown. diff -r 8d6c35655d4d -r 18946846b95b Discovery/Inc/tHome.h --- a/Discovery/Inc/tHome.h Wed Dec 27 19:24:44 2023 +0100 +++ b/Discovery/Inc/tHome.h Wed Dec 27 19:37:17 2023 +0100 @@ -80,7 +80,7 @@ CVIEW_Charger, CVIEW_CcrSummary, CVIEW_Timer, - CVIEW_END = 31 /* The ID is used in shift operation => 31 is the max number of supported views */ + CVIEW_END /* The ID is used in shift operation => 31 is the max number of supported views */ }; enum CUSTOMVIEWS_BF diff -r 8d6c35655d4d -r 18946846b95b Discovery/Src/t3.c --- a/Discovery/Src/t3.c Wed Dec 27 19:24:44 2023 +0100 +++ b/Discovery/Src/t3.c Wed Dec 27 19:37:17 2023 +0100 @@ -66,27 +66,6 @@ /* Private types -------------------------------------------------------------*/ #define TEXTSIZE 16 -#define NUMBER_OF_VIEWS 7 /* number of views defined in the array below */ - -const uint8_t t3_customviewsStandard[] = -{ - CVIEW_T3_Decostop, - CVIEW_sensors, - CVIEW_Compass, - CVIEW_T3_MaxDepth, - CVIEW_T3_StopWatch, - CVIEW_T3_TTS, - CVIEW_T3_ppO2andGas, - CVIEW_T3_GasList, - CVIEW_T3_Navigation, - CVIEW_T3_DepthData, - CVIEW_noneOrDebug, - CVIEW_T3_DecoTTS, -#ifdef ENABLE_T3_PROFILE_VIEW - CVIEW_T3_Profile, -#endif - CVIEW_T3_END -}; /* Private function prototypes -----------------------------------------------*/ void t3_refresh_divemode(void); @@ -102,7 +81,7 @@ SSettings* pSettings; pSettings = settingsGetPointer(); - t3_selection_customview = t3_customviewsStandard[0]; + t3_selection_customview = cv_changelist_BS[0]; t3screen.FBStartAdress = 0; t3screen.ImageHeight = 480; @@ -903,7 +882,7 @@ void t3_basics_refresh_customview(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode) { - static uint8_t last_customview = CVIEW_END; + static uint8_t last_customview = CVIEW_T3_END; char text[30]; uint16_t textpointer = 0; @@ -972,7 +951,7 @@ { heading = (uint16_t)stateUsed->lifeData.compass_heading; } - if(last_customview != tX_selection_customview) /* check if current selection is disabled and should be skipped */ + if((last_customview != tX_selection_customview) && (settingsGetPointer()->design == 3)) /* check if current selection is disabled and should be skipped */ { if(t3_customview_disabled(tX_selection_customview)) { @@ -1256,7 +1235,7 @@ } break; - case CVIEW_sensors: + case CVIEW_T3_sensors: snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_O2monitor); GFX_write_string(&FontT42,tXc1,text,0); @@ -1676,7 +1655,7 @@ i++; } - if (((view == CVIEW_sensors) || (view == CVIEW_sensors_mV)) && + if ((view == CVIEW_T3_sensors) && ((stateUsed->diveSettings.ppo2sensors_deactivated == 0x07) || (stateUsed->diveSettings.ccrOption == 0) || stateUsed->warnings.fallback)) { cv_disabled = 1; @@ -1688,7 +1667,7 @@ uint8_t t3_change_customview(uint8_t action) { - t3_basics_change_customview(&t3_selection_customview, t3_customviewsStandard, action); + t3_basics_change_customview(&t3_selection_customview, cv_changelist_BS, action); return t3_selection_customview; } @@ -1709,6 +1688,7 @@ if (tX_customviews[index] == *tX_selection_customview) { curViewIdx = index; + break; } index++; } @@ -1752,7 +1732,7 @@ break; } - if(t3_customview_disabled(tX_customviews[index])) + if((tX_customviews == cv_changelist_BS) && (t3_customview_disabled(tX_customviews[index]))) { iterate = 1; if(*tX_selection_customview == tX_customviews[index]) @@ -1952,7 +1932,7 @@ uint8_t increment = 1; uint8_t enabledViewCnt = 0; - pViews = (uint8_t*)t3_customviewsStandard; + pViews = (uint8_t*)cv_changelist_BS; while((*pViews != CVIEW_T3_END)) { increment = 1; diff -r 8d6c35655d4d -r 18946846b95b Discovery/Src/t5_gauge.c --- a/Discovery/Src/t5_gauge.c Wed Dec 27 19:24:44 2023 +0100 +++ b/Discovery/Src/t5_gauge.c Wed Dec 27 19:37:17 2023 +0100 @@ -63,8 +63,8 @@ const uint8_t t5_customviewsStandard[] = { - CVIEW_sensors, - CVIEW_Compass, + CVIEW_T3_sensors, + CVIEW_T3_Compass, CVIEW_T3_MaxDepth, CVIEW_T3_StopWatch, CVIEW_T3_Temperature, diff -r 8d6c35655d4d -r 18946846b95b Discovery/Src/t6_apnea.c --- a/Discovery/Src/t6_apnea.c Wed Dec 27 19:24:44 2023 +0100 +++ b/Discovery/Src/t6_apnea.c Wed Dec 27 19:37:17 2023 +0100 @@ -46,7 +46,7 @@ GFX_DrawCfgWindow t6c2; GFX_DrawCfgWindow t6c3; // for menu text -uint8_t t6_selection_customview = 0; +uint8_t t6_selection_customview = CVIEW_T3_noneOrDebug; /* Imported function prototypes ---------------------------------------------*/ @@ -61,7 +61,7 @@ const uint8_t t6_customviewsStandard[] = { - CVIEW_noneOrDebug, + CVIEW_T3_noneOrDebug, CVIEW_T3_Temperature, CVIEW_T3_END }; diff -r 8d6c35655d4d -r 18946846b95b Discovery/Src/t7.c --- a/Discovery/Src/t7.c Wed Dec 27 19:24:44 2023 +0100 +++ b/Discovery/Src/t7.c Wed Dec 27 19:37:17 2023 +0100 @@ -120,22 +120,6 @@ /* Private types -------------------------------------------------------------*/ -const uint8_t customviewsDiveStandard[] = -{ - CVIEW_sensors, - CVIEW_Compass, - CVIEW_Decolist, - CVIEW_Tissues, - CVIEW_Profile, - CVIEW_Gaslist, - CVIEW_sensors_mV, - CVIEW_EADTime, - CVIEW_SummaryOfLeftCorner, - CVIEW_Timer, - CVIEW_noneOrDebug, - CVIEW_END, - CVIEW_END -}; const uint8_t customviewsSurfaceStandard[] = { @@ -155,7 +139,7 @@ static uint8_t selection_custom_field = LLC_Temperature; -const uint8_t *customviewsDive = customviewsDiveStandard; +const uint8_t *customviewsDive = cv_changelist; const uint8_t *customviewsSurface = customviewsSurfaceStandard; #define TEXTSIZE 30 @@ -580,42 +564,7 @@ if(stateUsed->mode == MODE_DIVE) { - if(last_mode != MODE_DIVE) - { - last_mode = MODE_DIVE; - /* lower left corner primary */ - selection_custom_field = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary; - /* custom view primary OR debug if automatic return is off | T7 is default dive view => also initialize big font view */ - if((settingsGetPointer()->tX_customViewTimeout == 0) && (settingsGetPointer()->showDebugInfo)) - { - selection_customview = CVIEW_noneOrDebug; - t3_select_customview(CVIEW_noneOrDebug); - } - else - { - selection_customview = settingsGetPointer()->tX_customViewPrimary; - t3_set_customview_to_primary(); - } - t7_change_customview(ACTION_END); - - if((settingsGetPointer()->MotionDetection != MOTION_DETECT_OFF)) - { - InitMotionDetection(); - } - - if(settingsGetPointer()->extraDisplay == EXTRADISPLAY_BFACTIVE) - { - settingsGetPointer()->design = 3; - releaseAllFramesExcept(22,t7screen.FBStartAdress); - releaseFrame(22,t7screen.FBStartAdress); - set_globalState(StD); - return; - } - } - - if(status.page == PageSurface) - set_globalState(StD); - + /* T7 refresh is usally called at start of dive. Based on divesettings the design will be changed and T7 no longer called */ if(stateUsed->diveSettings.diveMode == DIVEMODE_Gauge) { settingsGetPointer()->design = 5; @@ -632,8 +581,44 @@ } else { - t7_refresh_divemode(); - } + if(last_mode != MODE_DIVE) + { + last_mode = MODE_DIVE; + /* lower left corner primary */ + selection_custom_field = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary; + /* custom view primary OR debug if automatic return is off | T7 is default dive view => also initialize big font view */ + if((settingsGetPointer()->tX_customViewTimeout == 0) && (settingsGetPointer()->showDebugInfo)) + { + selection_customview = CVIEW_noneOrDebug; + t3_select_customview(CVIEW_noneOrDebug); + } + else + { + selection_customview = settingsGetPointer()->tX_customViewPrimary; + } + t7_change_customview(ACTION_END); + + if((settingsGetPointer()->MotionDetection != MOTION_DETECT_OFF)) + { + InitMotionDetection(); + } + + if((settingsGetPointer()->extraDisplay == EXTRADISPLAY_BFACTIVE) && ( settingsGetPointer()->design == 7)) + { + settingsGetPointer()->design = 3; + t3_set_customview_to_primary(); + releaseAllFramesExcept(22,t7screen.FBStartAdress); + releaseFrame(22,t7screen.FBStartAdress); + set_globalState(StD); + return; + } + } + + if(status.page == PageSurface) + set_globalState(StD); + + t7_refresh_divemode(); + } } else // from if(stateUsed->mode == MODE_DIVE) {