diff Discovery/Src/t3.c @ 582:64bf41faab83

Show Fallback if no valid sensor value is available: In previous version fallback was shown when communication to HUD was lost. Now it will be displayed in case no sensor value ist judged as valid. In case of a fallback event ppo2 warnings as well as the data readings are no longer displayed.
author Ideenmodellierer
date Sat, 12 Dec 2020 20:52:58 +0100
parents 9bb9a52d6ae5
children f52bc70e380f
line wrap: on
line diff
--- a/Discovery/Src/t3.c	Sat Dec 12 19:18:57 2020 +0100
+++ b/Discovery/Src/t3.c	Sat Dec 12 20:52:58 2020 +0100
@@ -689,6 +689,8 @@
 
 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;
+
     char text[512];
     uint16_t textpointer = 0;
 
@@ -757,6 +759,14 @@
     {
     	heading = (uint16_t)stateUsed->lifeData.compass_heading;
     }
+	if(last_customview != tX_selection_customview)		/* check if current selection is disabled and should be skipped */
+	{
+		if(t3_customview_disabled(tX_selection_customview))
+		{
+			tX_selection_customview = t3_change_customview(ACTION_BUTTON_ENTER);
+		}
+		last_customview = tX_selection_customview;
+	}
 
     switch(tX_selection_customview)
     {
@@ -1413,7 +1423,7 @@
     }
 
     if (((view == CVIEW_sensors) || (view == CVIEW_sensors_mV)) &&
-       	((stateUsed->diveSettings.ppo2sensors_deactivated == 0x07) || (stateUsed->diveSettings.ccrOption == 0)))
+       	((stateUsed->diveSettings.ppo2sensors_deactivated == 0x07) || (stateUsed->diveSettings.ccrOption == 0) || stateUsed->warnings.fallback))
     {
       	cv_disabled = 1;
     }
@@ -1421,10 +1431,11 @@
     return cv_disabled;
 }
 
-void t3_change_customview(uint8_t action)
+uint8_t t3_change_customview(uint8_t action)
 {
 
     t3_basics_change_customview(&t3_selection_customview, t3_customviewsStandard, action);
+    return t3_selection_customview;
 }