changeset 724:f285424f04d9

Development feature: external pressure sensor It now possible to use ADC channel 2 as channel for external pressure data. This function may be activated by compile switch only. It is usefull for sensor verification, e.g. by using a small pressure chamber.
author Ideenmodellierer
date Thu, 05 Jan 2023 18:30:06 +0100
parents 9b9ed5459d57
children 621265ec3d23
files Discovery/Src/tInfoSensor.c Discovery/Src/tMenuEditHardware.c
diffstat 2 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Src/tInfoSensor.c	Thu Jan 05 18:27:04 2023 +0100
+++ b/Discovery/Src/tInfoSensor.c	Thu Jan 05 18:30:06 2023 +0100
@@ -84,6 +84,8 @@
     char text[31];
     uint8_t strIndex = 0;
 
+    float pressure = 0.0;
+
     text[0] = '\001';
 	text[1] = TXT_Sensor;
 	text[2] = ' ';
@@ -102,6 +104,21 @@
     tInfo_write_content_simple(  30, 340, ME_Y_LINE1, &FontT48, text, CLUT_Font020);
     snprintf(text,32,"%c: %02.1f",TXT_Temperature , (float)pDiveO2Data->temperature / 1000.0);
     tInfo_write_content_simple(  30, 340, ME_Y_LINE2, &FontT48, text, CLUT_Font020);
+
+#ifdef ENABLE_EXTERNAL_PRESSURE
+    pressure = (float)(stateRealGetPointer()->lifeData.ppO2Sensor_bar[2]);
+#else
+    pressure = (float)pDiveO2Data->pressure / 1000.0;
+#endif
+    snprintf(text,32,"Druck: %02.1f (%02.1f)", (float)pDiveO2Data->pressure / 1000.0, pressure *1000.0);
+
+    tInfo_write_content_simple(  30, 340, ME_Y_LINE3, &FontT48, text, CLUT_Font020);
+    snprintf(text,32,"Feuchtigkeit: %02.1f", (float)pDiveO2Data->humidity / 1000.0);
+    tInfo_write_content_simple(  30, 340, ME_Y_LINE4, &FontT48, text, CLUT_Font020);
+    snprintf(text,32,"Status: 0x%lx", pDiveO2Data->status);
+    tInfo_write_content_simple(  30, 340, ME_Y_LINE5, &FontT48, text, CLUT_Font020);
+    snprintf(text,32,"Norm ppO2: %02.3f (%02.1f)", (float)(stateRealGetPointer()->lifeData.ppO2Sensor_bar[0] / (pressure / 1000.0)),(float)(stateRealGetPointer()->lifeData.ppO2Sensor_bar[0]));
+    tInfo_write_content_simple(  30, 340, ME_Y_LINE6, &FontT48, text, CLUT_Font020);
 }
 
 void sendActionToInfoSensor(uint8_t sendAction)
--- a/Discovery/Src/tMenuEditHardware.c	Thu Jan 05 18:27:04 2023 +0100
+++ b/Discovery/Src/tMenuEditHardware.c	Thu Jan 05 18:30:06 2023 +0100
@@ -568,6 +568,13 @@
 				{
 					if(pStateReal->lifeData.sensorVoltage_mV[loop] > 0.0001)		/* sensor connected ?*/
 					{
+#ifdef ENABLE_EXTERNAL_PRESSURE
+						if(loop == 2)
+						{
+							compensatedRef = pStateReal->lifeData.pressure_ambient_bar;
+						}
+#endif
+
 						pSettings->ppo2sensors_calibCoeff[loop] =  compensatedRef / pStateReal->lifeData.sensorVoltage_mV[loop];
 					}
 					else