comparison Discovery/Src/data_exchange_main.c @ 577:9bb9a52d6ae5

Handle o2 voltage values < 0.5mV as invalid: Values < 0.5mv will now be handled as ppo2 = 0Bar to avaid problems (e.g. by negativ values) in the decompression calculation. In the custom display sensors with low voltage are show using '-'
author Ideenmodellierer
date Sun, 29 Nov 2020 22:58:11 +0100
parents 84a4e1200726
children 830de438e0b0
comparison
equal deleted inserted replaced
576:1105cf7bbf6f 577:9bb9a52d6ae5
99 #define UNKNOWN_TIME_MINUTES 0 99 #define UNKNOWN_TIME_MINUTES 0
100 #define UNKNOWN_TIME_SECOND 0 100 #define UNKNOWN_TIME_SECOND 0
101 #define UNKNOWN_DATE_DAY 1 101 #define UNKNOWN_DATE_DAY 1
102 #define UNKNOWN_DATE_MONTH 1 102 #define UNKNOWN_DATE_MONTH 1
103 #define UNKNOWN_DATE_YEAR 16 103 #define UNKNOWN_DATE_YEAR 16
104
105 #define IGNORE_O2_VOLTAGE_LEVEL_MV (0.5f)
104 106
105 /* Private function prototypes -----------------------------------------------*/ 107 /* Private function prototypes -----------------------------------------------*/
106 static uint8_t DataEX_check_header_and_footer_ok(void); 108 static uint8_t DataEX_check_header_and_footer_ok(void);
107 static uint8_t DataEX_check_header_and_footer_shifted(void); 109 static uint8_t DataEX_check_header_and_footer_shifted(void);
108 static uint8_t DataEX_check_header_and_footer_devicedata(void); 110 static uint8_t DataEX_check_header_and_footer_devicedata(void);
772 774
773 void DataEX_copy_to_LifeData(_Bool *modeChangeFlag) 775 void DataEX_copy_to_LifeData(_Bool *modeChangeFlag)
774 { 776 {
775 SDiveState *pStateReal = stateRealGetPointerWrite(); 777 SDiveState *pStateReal = stateRealGetPointerWrite();
776 static uint16_t getDeviceDataAfterStartOfMainCPU = 20; 778 static uint16_t getDeviceDataAfterStartOfMainCPU = 20;
777 779 uint8_t idx;
778 780
779 // wireless - �ltere daten aufr�umen 781 // wireless - �ltere daten aufr�umen
780 #if 0 782 #if 0
781 for(int i=0;i<(2*NUM_GASES+1);i++) 783 for(int i=0;i<(2*NUM_GASES+1);i++)
782 { 784 {
878 } 880 }
879 else /* use data from external ADC */ 881 else /* use data from external ADC */
880 { 882 {
881 if(pStateReal->data_old__lost_connection_to_slave == 0) 883 if(pStateReal->data_old__lost_connection_to_slave == 0)
882 { 884 {
883 pStateReal->lifeData.sensorVoltage_mV[0] = dataIn.data[0].extADC_voltage[0]; 885 for(idx = 0; idx < 3; idx++)
884 pStateReal->lifeData.sensorVoltage_mV[1] = dataIn.data[0].extADC_voltage[1]; 886 {
885 pStateReal->lifeData.sensorVoltage_mV[2] = dataIn.data[0].extADC_voltage[2]; 887 pStateReal->lifeData.sensorVoltage_mV[idx] = dataIn.data[0].extADC_voltage[idx];
886 pStateReal->lifeData.ppO2Sensor_bar[0] = pStateReal->lifeData.sensorVoltage_mV[0] * pSettings->ppo2sensors_calibCoeff[0]; 888 if(pStateReal->lifeData.sensorVoltage_mV[idx] < IGNORE_O2_VOLTAGE_LEVEL_MV)
887 pStateReal->lifeData.ppO2Sensor_bar[1] = pStateReal->lifeData.sensorVoltage_mV[1] * pSettings->ppo2sensors_calibCoeff[1]; 889 {
888 pStateReal->lifeData.ppO2Sensor_bar[2] = pStateReal->lifeData.sensorVoltage_mV[2] * pSettings->ppo2sensors_calibCoeff[2]; 890 pStateReal->lifeData.sensorVoltage_mV[idx] = 0.0;
891 pStateReal->lifeData.ppO2Sensor_bar[idx] = 0;
892 }
893 else
894 {
895 pStateReal->lifeData.ppO2Sensor_bar[idx] = pStateReal->lifeData.sensorVoltage_mV[idx] * pSettings->ppo2sensors_calibCoeff[idx];
896 }
897
898 }
889 } 899 }
890 } 900 }
891 901
892 if(pStateReal->data_old__lost_connection_to_slave == 0) 902 if(pStateReal->data_old__lost_connection_to_slave == 0)
893 { 903 {