comparison 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
comparison
equal deleted inserted replaced
747:df0d43da1614 748:be25ab2d902c
38 #include "tInfo.h" 38 #include "tInfo.h"
39 #include "tInfoLog.h" 39 #include "tInfoLog.h"
40 #include "tInfoSensor.h" 40 #include "tInfoSensor.h"
41 #include "tComm.h" 41 #include "tComm.h"
42 #include "data_exchange_main.h" 42 #include "data_exchange_main.h"
43
43 44
44 extern void tM_build_pages(void); 45 extern void tM_build_pages(void);
45 46
46 /* Private function prototypes -----------------------------------------------*/ 47 /* Private function prototypes -----------------------------------------------*/
47 void openEdit_Bluetooth(void); 48 void openEdit_Bluetooth(void);
369 strSensorId[4] = 'X'; 370 strSensorId[4] = 'X';
370 strSensorId[5] = '1' + index; 371 strSensorId[5] = '1' + index;
371 372
372 switch(pSettings->ext_sensor_map[index]) 373 switch(pSettings->ext_sensor_map[index])
373 { 374 {
374 case SENSOR_SEARCH: strSensorId[4] = TXT2BYTE_SensorDetect; 375 case SENSOR_SEARCH: strSensorId[1] = TXT2BYTE_SensorDetect;
376 strSensorId[2] = 0;
377 strSensorId[4] = 0;
375 break; 378 break;
376 case SENSOR_OPTIC: strSensorId[4] = TXT2BYTE_O2IFOptic; 379 case SENSOR_OPTIC: strSensorId[4] = TXT2BYTE_O2IFOptic;
377 break; 380 break;
378 case SENSOR_ANALOG: strSensorId[4] = TXT2BYTE_O2IFAnalog; 381 case SENSOR_ANALOG: strSensorId[4] = TXT2BYTE_O2IFAnalog;
379 break; 382 break;
384 break; 387 break;
385 case SENSOR_SENTINEL: strSensorId[3] = 'S'; 388 case SENSOR_SENTINEL: strSensorId[3] = 'S';
386 strSensorId[4] = 'e'; 389 strSensorId[4] = 'e';
387 break; 390 break;
388 default: 391 default:
392 strSensorId[5] = 0;
389 break; 393 break;
390 } 394 }
391 if(strSensorId[4] != 'X') 395 if(strSensorId[4] != 'X')
392 { 396 {
393 write_label_var( 96, 340, ME_Y_LINE1 + (index * ME_Y_LINE_STEP), &FontT48, strSensorId); 397 write_label_var( 96, 340, ME_Y_LINE1 + (index * ME_Y_LINE_STEP), &FontT48, strSensorId);
397 { 401 {
398 snprintf(strSensorValue, 20,"%01.2f, %01.1f mV", pStateReal->lifeData.ppO2Sensor_bar[index], pStateReal->lifeData.sensorVoltage_mV[index]); 402 snprintf(strSensorValue, 20,"%01.2f, %01.1f mV", pStateReal->lifeData.ppO2Sensor_bar[index], pStateReal->lifeData.sensorVoltage_mV[index]);
399 } 403 }
400 else if(pSettings->ext_sensor_map[index] == SENSOR_CO2) 404 else if(pSettings->ext_sensor_map[index] == SENSOR_CO2)
401 { 405 {
402 snprintf(strSensorValue, 10,"%d ppm", pStateReal->lifeData.CO2_data.CO2_ppm); 406 snprintf(strSensorValue, 20,"%ld ppm", pStateReal->lifeData.CO2_data.CO2_ppm);
403 } 407 }
404 y_line = ME_Y_LINE1 + (index * ME_Y_LINE_STEP); 408 y_line = ME_Y_LINE1 + (index * ME_Y_LINE_STEP);
405 if(strSensorValue[0] != 0) 409 if(strSensorValue[0] != 0)
406 { 410 {
407 write_label_var( 480, 800, y_line, &FontT48, strSensorValue); 411 write_label_var( 480, 800, y_line, &FontT48, strSensorValue);
408 } 412 }
409 } 413 }
410 414
411 if(pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_OPTIC) 415 if(pSettings->ext_sensor_map[0] == SENSOR_OPTIC)
412 { 416 {
413 strSensorId[0] = TXT_2BYTE; 417 strSensorId[0] = TXT_2BYTE;
414 strSensorId[1] = TXT2BYTE_HUDbattery; 418 strSensorId[1] = TXT2BYTE_HUDbattery;
415 strSensorId[2] = 0; 419 strSensorId[2] = 0;
416 write_label_var( 30, 340, ME_Y_LINE4, &FontT48, strSensorId); 420 write_label_var( 30, 340, ME_Y_LINE4, &FontT48, strSensorId);