diff Discovery/Src/tInfo.c @ 718:b9f699d2e3d0

Updated menu structure to support new sensor information page: The sensor information page has been added to the sensor submenu of the hardware menu. It will be shown dynamically in case a smart sensor is detected. In order to have this dynamic visualization some new functions had to be added to the general menu file. The information page returns to the sensor menu, for this behavior also a new function had to be added.
author Ideenmodellierer
date Sun, 20 Nov 2022 20:49:41 +0100
parents 01f40cb1057e
children a370741a743b
line wrap: on
line diff
--- a/Discovery/Src/tInfo.c	Sun Nov 20 20:46:10 2022 +0100
+++ b/Discovery/Src/tInfo.c	Sun Nov 20 20:49:41 2022 +0100
@@ -36,7 +36,9 @@
 //#include "tInfoDive.h"
 //#include "tInfoSurface.h"
 #include "tInfoCompass.h"
+#include "tInfoSensor.h"
 #include "tMenu.h"
+#include "tMenuEdit.h"
 
 #include <string.h>
 
@@ -198,25 +200,40 @@
 
 void tInfo_refresh(void)
 {
-    if(!inDebugMode() && (get_globalState() != StICOMPASS))
-        return;
-
     uint32_t oldIscreen;
-
+    uint32_t globalState = get_globalState();
     oldIscreen = tIscreen.FBStartAdress;
-    tIscreen.FBStartAdress = getFrame(14);
-    infoColor = CLUT_InfoCompass;
-
+    
     if(inDebugMode())
-        tDebug_refresh();
+    {
+	    tIscreen.FBStartAdress = getFrame(14);
+    	infoColor = CLUT_InfoCompass;
+    	tDebug_refresh();
+    }
     else
-        refreshInfo_Compass(tIscreen);
-
-    if(inDebugMode() || (get_globalState() == StICOMPASS)) /* could be timeout and exitInfo */
-        GFX_SetFramesTopBottom(tIscreen.FBStartAdress, 0,480);
-
-    if(oldIscreen)
-        releaseFrame(14,oldIscreen);
+    {
+    	switch(globalState)
+    	{
+    		case StICOMPASS: 	tIscreen.FBStartAdress = getFrame(14);
+    							infoColor = CLUT_InfoCompass;
+    							refreshInfo_Compass(tIscreen);
+    				break;
+    		case StISENINFO: 	tIscreen.FBStartAdress = getFrame(14);
+    							infoColor = CLUT_MenuPageHardware;
+    							refreshInfo_Sensor(tIscreen);
+    				break;
+    		default:
+    				break;
+    	}
+    }
+    if(oldIscreen != tIscreen.FBStartAdress)
+    {
+    	GFX_SetFramesTopBottom(tIscreen.FBStartAdress, 0,480);
+    	if(oldIscreen)
+    	{
+    	 	releaseFrame(14,oldIscreen);
+    	}
+    }
 }
 
 
@@ -227,6 +244,12 @@
     exitDebugMode();
 }
 
+void exitInfoToBack(void)
+{
+    releaseFrame(14,tIscreen.FBStartAdress);
+    exitMenuEdit_to_BackMenu();
+}
+
 
 void sendActionToInfo(uint8_t sendAction)
 {