diff Discovery/Src/base.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 d55817a11f4c
children 5078da3845c0
line wrap: on
line diff
--- a/Discovery/Src/base.c	Sun Nov 20 20:46:10 2022 +0100
+++ b/Discovery/Src/base.c	Sun Nov 20 20:49:41 2022 +0100
@@ -212,6 +212,7 @@
 #include "tHome.h"
 #include "tInfo.h"
 #include "tInfoLog.h"
+#include "tInfoSensor.h"
 #include "tMenu.h"
 #include "tMenuEdit.h"
 #include "tMenuEditGasOC.h"
@@ -699,9 +700,9 @@
 		tMenuEdit_refresh_live_content();
 		break;
 	case BaseInfo:
-		tInfo_refresh(); ///< only compass at the moment 23.Feb.2015 hw
+		tInfo_refresh();
 		break;
-	case BaseComm: 		/* refresh already done in tim callback */
+	case BaseComm: 		/* refresh already done in time callback */
 		break;
 	default:
 		if(get_globalState() == StStop)
@@ -816,13 +817,17 @@
 				sendActionToMenuEdit(action);
 			break;
 
-		case BaseInfo:
-			if (status.page == InfoPageLogList)
-				sendActionToInfoLogList(action);
-			else if (status.page == InfoPageLogShow)
-				sendActionToInfoLogShow(action);
-			else
-				sendActionToInfo(action);
+		case BaseInfo:	switch(status.page)
+						{
+							case InfoPageLogList: 	sendActionToInfoLogList(action);
+								break;
+							case InfoPageLogShow: 	sendActionToInfoLogShow(action);
+								break;
+							case InfoPageSensor: 	sendActionToInfoSensor(action);
+								break;
+							default:				sendActionToInfo(action);
+								break;
+						}
 			break;
 
 		default:
@@ -1790,23 +1795,21 @@
 			case BaseInfo:
 				if((timeout_in_seconds  >= settingsGetPointer()->timeoutInfo) || RequestModeChange)
 				{
-					if(status.page == InfoPageLogList)
-					{
-						exitLog();
-						timeout_in_seconds = 0;
-					}
-					else
-					if(status.page == InfoPageLogShow)
+					timeout_in_seconds = 0;
+
+					switch(status.page)
 					{
-						show_logbook_exit();
-						exitLog();
-						timeout_in_seconds = 0;
-					}
-					else
-					if(status.page != InfoPageCompass)
-					{
-						exitInfo();
-						timeout_in_seconds = 0;
+						case InfoPageLogList:	exitLog();
+							break;
+						case InfoPageLogShow:	show_logbook_exit();
+												exitLog();
+							break;
+						case InfoPageCompass:		/* compass has individual timeout */
+							break;
+						case InfoPageSensor:	exitInfoToBack();
+							break;
+						default:				exitInfo();
+							break;
 					}
 				}
 				break;