diff Discovery/Src/t3.c @ 384:427ae9f8e28e MotionDetection

Consider number of available t3 views in sector handling: Before chande the number of sectors were taken from t7 view only causing t3 view to be shown inconsistent in case t7 view count were not 6. => added function to count views.
author ideenmodellierer
date Thu, 17 Oct 2019 23:09:17 +0200
parents 74a8296a2318
children 39c147e47c1c
line wrap: on
line diff
--- a/Discovery/Src/t3.c	Thu Oct 17 21:15:42 2019 +0200
+++ b/Discovery/Src/t3.c	Thu Oct 17 23:09:17 2019 +0200
@@ -58,6 +58,7 @@
 
 /* Private types -------------------------------------------------------------*/
 #define TEXTSIZE 16
+#define NUMBER_OF_VIEWS 7	/* number of views defined in the array below */
 
 const uint8_t t3_customviewsStandard[] =
 {
@@ -1251,3 +1252,36 @@
     GFX_draw_circle(tXscreen, center, 107, CLUT_Font030);
     GFX_draw_circle(tXscreen, center, 108, CLUT_Font030);
 }
+
+uint8_t t3_GetEnabled_customviews()
+{
+	int8_t i;
+    uint8_t enabledViewCnt = 0;
+    uint32_t cv_config = settingsGetPointer()->cv_configuration;
+
+    i=0;
+   	do
+    {
+        if(cv_changelist[i] == CVIEW_sensors) /* at the moment specific big font view may not be selected. Only sensor setting is taken from t7 configuration */
+        {
+          	 if(!CHECK_BIT_THOME(cv_config, cv_changelist[i]))
+          	 {
+           		 enabledViewCnt = NUMBER_OF_VIEWS - 1;		/* sensor shall not be displayed */
+           	 }
+          	 else
+          	 {
+           		 enabledViewCnt = NUMBER_OF_VIEWS; 			/* enable all possible views */
+           	 }
+             break;
+        }
+        i++;
+    } while(cv_changelist[i] != CVIEW_END);
+    if ((stateUsed->diveSettings.ppo2sensors_deactivated) || (stateUsed->diveSettings.ccrOption == 0))
+    {
+    	enabledViewCnt = NUMBER_OF_VIEWS - 1;		/* sensor shall not be displayed */
+    }
+
+    return enabledViewCnt;
+}
+
+