diff Discovery/Src/base.c @ 586:bb5ce239741f

Motion control: Jump back to primary view if focus is lost: The modes sector and scroll are tipically used to have a short look at other information pages (e.g. compass). By automatically jumping back to the primary view, there is no longer the need to select the preferred view when leaving focus mode
author Ideenmodellierer
date Sun, 13 Dec 2020 18:31:40 +0100
parents e581425c7e3e
children 132e7e3d13a7
line wrap: on
line diff
--- a/Discovery/Src/base.c	Sun Dec 13 18:29:12 2020 +0100
+++ b/Discovery/Src/base.c	Sun Dec 13 18:31:40 2020 +0100
@@ -232,6 +232,8 @@
 #include "test_vpm.h"
 #include "tDebug.h"
 #include "motion.h"
+#include "t7.h"
+#include "t3.h"
 
 #ifdef DEMOMODE
 #include "demo.h"
@@ -347,6 +349,7 @@
 {
     uint32_t pLayerInvisible;
     uint16_t totalDiveCounterFound;
+    uint8_t wasInFocus = 0;
 
 	SStateList status;
 #ifdef ENABLE_MOTION_CONTROL
@@ -512,6 +515,7 @@
 
        			if(viewInFocus())
         		{
+       				wasInFocus = 1;
        				set_Backlight_Boost(settingsGetPointer()->viewPortMode & 0x03);
 					switch(settingsGetPointer()->MotionDetection)
 					{
@@ -536,6 +540,19 @@
        			}
        			else
        			{
+       				if(wasInFocus)
+       				{
+       					wasInFocus = 0;
+       					if(settingsGetPointer()->design == 7)
+       					{
+       						t7_set_customview_to_primary();
+       					}
+       					else
+       					{
+       						t3_set_customview_to_primary();
+       					}
+       				}
+
        				set_Backlight_Boost(0);
        			}
         	}
@@ -772,6 +789,10 @@
 						else								/* return to t7 view */
 						{
 							settingsGetPointer()->design = 7;
+							if(settingsGetPointer()->MotionDetection == MOTION_DETECT_SECTOR)
+							{
+								DefinePitchSectors(settingsGetPointer()->viewPitch,CUSTOMER_DEFINED_VIEWS);
+							}
 						}
 					}
 					else
@@ -785,7 +806,7 @@
 						settingsGetPointer()->design = 3;
 						if(settingsGetPointer()->MotionDetection == MOTION_DETECT_SECTOR)
 						{
-							DefinePitchSectors(stateRealGetPointer()->lifeData.compass_pitch,CUSTOMER_DEFINED_VIEWS);
+							DefinePitchSectors(settingsGetPointer()->viewPitch,CUSTOMER_DEFINED_VIEWS);
 						}
 					}
 					else if (settingsGetPointer()->extraDisplay	== EXTRADISPLAY_DECOGAME)