diff Discovery/Src/t3.c @ 837:18946846b95b Evo_2_23

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.
author ideenmodellierer
date Wed, 27 Dec 2023 19:37:17 +0100
parents 717b460294cd
children aed39d19269c
line wrap: on
line diff
--- 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;