diff Discovery/Src/t7.c @ 379:0dbf550dc743 MotionDetection

Added missing customerview selection In the previous version only 6 out of 10 custom views could be configurated => Added a second page for the dive menu system tab In case all views are deactivated the none / debug page will be set as default
author ideenmodellierer
date Mon, 16 Sep 2019 22:49:34 +0200
parents ef1b8579166c
children 14fd5f35cb50
line wrap: on
line diff
--- a/Discovery/Src/t7.c	Mon Sep 16 22:46:24 2019 +0200
+++ b/Discovery/Src/t7.c	Mon Sep 16 22:49:34 2019 +0200
@@ -1501,6 +1501,7 @@
 
 uint8_t t7_GetEnabled_customviews()
 {
+	int8_t i;
     uint8_t *pViews;
     uint8_t increment = 1;
 
@@ -1516,14 +1517,23 @@
     {
     	increment = 1;
     /* check if view is enabled */
-        for(int i=0;i<6;i++)
+    	i=0;
+    	do
         {
-             if((*pViews == cv_changelist[i]) && !CHECK_BIT_THOME(cv_config, (1 << cv_changelist[i])))
+             if(*pViews == cv_changelist[i])
              {
-            	 increment = 0;
-                   break;
+            	 if(!CHECK_BIT_THOME(cv_config, cv_changelist[i]))
+             	 {
+            	 	 increment = 0;
+             	 }
+                 break;
              }
-        }
+             i++;
+        } while(cv_changelist[i] != CVIEW_END);
+    	if(cv_changelist[i] == CVIEW_END)
+    	{
+    		 increment = 0;
+    	}
         if (((*pViews == CVIEW_sensors) || (*pViews == CVIEW_sensors_mV)) &&
            	((stateUsed->diveSettings.ppo2sensors_deactivated) || (stateUsed->diveSettings.ccrOption == 0)))
         {
@@ -1538,6 +1548,7 @@
 
 void t7_change_customview(uint8_t action)
 {
+	int8_t i;
     uint8_t *pViews;
     uint8_t *pStartView,*pCurView, *pLastView;
     _Bool cv_disabled = 0;
@@ -1585,13 +1596,15 @@
     do
     {
         cv_disabled = 0;
-        for(int i=0;i<6;i++)
+        i=0;
+       	while(cv_changelist[i] != CVIEW_END)
         {
              if((*pViews == cv_changelist[i]) && !CHECK_BIT_THOME(settingsGetPointer()->cv_configuration, cv_changelist[i]))
              {
             	 cv_disabled = 1;
                    break;
              }
+             i++;
         }
 
         if (((*pViews == CVIEW_sensors) || (*pViews == CVIEW_sensors_mV)) &&