diff Discovery/Src/t7.c @ 365:c18aebb03fed MotionDetection

Bugfix: selection of current view not working
author ideenmodellierer
date Mon, 17 Jun 2019 19:53:01 +0200
parents b111fc4250e9
children 3c7030d6d67a
line wrap: on
line diff
--- a/Discovery/Src/t7.c	Mon Jun 17 19:47:07 2019 +0200
+++ b/Discovery/Src/t7.c	Mon Jun 17 19:53:01 2019 +0200
@@ -1481,7 +1481,7 @@
 
 void t7_change_customview(uint8_t action)
 {
-    const uint8_t *pViews;
+    uint8_t *pViews;
     uint8_t *pStartView,*pCurView, *pLastView;
     _Bool cv_disabled = 0;
 
@@ -1515,34 +1515,36 @@
     }
     else
     {
-		pViews--;
-		if(pViews = pStartView)
+		if(pViews == pStartView)
 		{
 			pViews = pLastView - 1;
 		}
+		else
+		{
+			pViews--;
+		}
     }
-    if(stateUsed->mode == MODE_DIVE)
-    {
-        do
-        {
-            cv_disabled = 0;
-            for(int i=0;i<6;i++)
-            {
-                if((*pViews == cv_changelist[i]) && !CHECK_BIT_THOME(settingsGetPointer()->cv_configuration, cv_changelist[i]))
-                {
-                    cv_disabled = 1;
-                    break;
-                }
-            }
-
-            if ((*pViews == CVIEW_sensors || *pViews == CVIEW_sensors_mV) &&
-            	stateUsed->diveSettings.ppo2sensors_deactivated)
-            {
-            	cv_disabled = 1;
-            }
-
-            if(cv_disabled)		/* view is disabled => jump to next view */
-            {
+
+       do
+       {
+           cv_disabled = 0;
+           for(int i=0;i<6;i++)
+           {
+               if((*pViews == cv_changelist[i]) && !CHECK_BIT_THOME(settingsGetPointer()->cv_configuration, cv_changelist[i]))
+               {
+                   cv_disabled = 1;
+                   break;
+               }
+           }
+
+           if (((*pViews == CVIEW_sensors) || (*pViews == CVIEW_sensors_mV)) &&
+           	((stateUsed->diveSettings.ppo2sensors_deactivated) || (stateUsed->diveSettings.ccrOption == 0)))
+           {
+	           	cv_disabled = 1;
+           }
+
+           if(cv_disabled)		/* view is disabled => jump to next view */
+           {
             	if((action == ACTION_BUTTON_ENTER) || (action == ACTION_SHAKE_POS))
             	{
             		pViews++;
@@ -1553,11 +1555,14 @@
             	}
             	else
             	{
-            		pViews--;
             		if(pViews == pStartView)
             		{
             			pViews = pLastView - 1;
             		}
+            		else
+            		{
+            			pViews--;
+            		}
             	}
             }
         } while(cv_disabled);