diff Discovery/Src/tMenuEditHardware.c @ 748:be25ab2d902c

Added display of co2 ppm values: Updated output functions for CO2 visualization and added the CO2 measurement to the lower left corner selection field. The sensor provides the value as factor 10 of ppm that's why the data type had to be changed to 32bit if ppm should be available without scaling every time. Cleanup sensor dialog: The HUD battery was displayed by default and some sensor combinations were not displayed correctly. The refresh function was updated to fix these issues.
author Ideenmodellierer
date Sun, 05 Mar 2023 22:14:53 +0100
parents 7e84ae1513b6
children ec7b62983a8c
line wrap: on
line diff
--- a/Discovery/Src/tMenuEditHardware.c	Sun Mar 05 22:06:47 2023 +0100
+++ b/Discovery/Src/tMenuEditHardware.c	Sun Mar 05 22:14:53 2023 +0100
@@ -41,6 +41,7 @@
 #include "tComm.h"
 #include "data_exchange_main.h"
 
+
 extern void tM_build_pages(void);
 
 /* Private function prototypes -----------------------------------------------*/
@@ -371,7 +372,9 @@
 
 			switch(pSettings->ext_sensor_map[index])
 			{
-				case SENSOR_SEARCH: strSensorId[4] = TXT2BYTE_SensorDetect;
+				case SENSOR_SEARCH: strSensorId[1] = TXT2BYTE_SensorDetect;
+									strSensorId[2] = 0;
+									strSensorId[4] = 0;
 								break;
 				case SENSOR_OPTIC:	strSensorId[4] = TXT2BYTE_O2IFOptic;
 								break;
@@ -386,6 +389,7 @@
 				 	 	 	 	 	  strSensorId[4] = 'e';
 				 	 	 	 	break;
 				default:
+									  strSensorId[5] = 0;
 					break;
 			}
 			if(strSensorId[4] != 'X')
@@ -399,7 +403,7 @@
 			}
 			else if(pSettings->ext_sensor_map[index] == SENSOR_CO2)
 			{
-				snprintf(strSensorValue, 10,"%d ppm",  pStateReal->lifeData.CO2_data.CO2_ppm);
+				snprintf(strSensorValue, 20,"%ld ppm",  pStateReal->lifeData.CO2_data.CO2_ppm);
 			}
 			y_line = ME_Y_LINE1 + (index * ME_Y_LINE_STEP);
 			if(strSensorValue[0] != 0)
@@ -408,7 +412,7 @@
 			}
 		}
 
-		if(pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_OPTIC)
+		if(pSettings->ext_sensor_map[0] == SENSOR_OPTIC)
 		{
 			strSensorId[0] = TXT_2BYTE;
 			strSensorId[1] = TXT2BYTE_HUDbattery;