Mercurial > public > ostc4
comparison Discovery/Src/data_exchange_main.c @ 556:eb2060caca7d
Switch source of o2 sensor data depending on availability of external ADC:
Dependig on the HW configuration provided by RTE the data vields for o2 voltage values are derived from the optical or the external ADC interface. TODO: Add manual selection to O2 menu to enable manuel switching.
author | Ideenmodellierer |
---|---|
date | Thu, 12 Nov 2020 19:54:58 +0100 |
parents | d784f281833a |
children | 84a4e1200726 |
comparison
equal
deleted
inserted
replaced
555:573a2bc796c8 | 556:eb2060caca7d |
---|---|
70 #include "tCCR.h" | 70 #include "tCCR.h" |
71 #include "timer.h" | 71 #include "timer.h" |
72 #include "buehlmann.h" | 72 #include "buehlmann.h" |
73 #include "externLogbookFlash.h" | 73 #include "externLogbookFlash.h" |
74 | 74 |
75 //#define TESTBENCH | |
75 | 76 |
76 /* Exported variables --------------------------------------------------------*/ | 77 /* Exported variables --------------------------------------------------------*/ |
77 static uint8_t wasPowerOn = 0; | 78 static uint8_t wasPowerOn = 0; |
78 static confirmbit8_Type requestNecessary = { .uw = 0 }; | 79 static confirmbit8_Type requestNecessary = { .uw = 0 }; |
79 static uint8_t wasUpdateNotPowerOn = 0; | 80 static uint8_t wasUpdateNotPowerOn = 0; |
769 void DataEX_copy_to_LifeData(_Bool *modeChangeFlag) | 770 void DataEX_copy_to_LifeData(_Bool *modeChangeFlag) |
770 { | 771 { |
771 SDiveState *pStateReal = stateRealGetPointerWrite(); | 772 SDiveState *pStateReal = stateRealGetPointerWrite(); |
772 static uint16_t getDeviceDataAfterStartOfMainCPU = 20; | 773 static uint16_t getDeviceDataAfterStartOfMainCPU = 20; |
773 | 774 |
774 /* internal sensor: HUD data | |
775 */ | |
776 for(int i=0;i<3;i++) | |
777 { | |
778 pStateReal->lifeData.ppO2Sensor_bar[i] = get_ppO2Sensor_bar(i); | |
779 pStateReal->lifeData.sensorVoltage_mV[i] = get_sensorVoltage_mV(i); | |
780 } | |
781 pStateReal->lifeData.HUD_battery_voltage_V = get_HUD_battery_voltage_V(); | |
782 | |
783 | 775 |
784 // wireless - �ltere daten aufr�umen | 776 // wireless - �ltere daten aufr�umen |
785 #if 0 | 777 #if 0 |
786 for(int i=0;i<(2*NUM_GASES+1);i++) | 778 for(int i=0;i<(2*NUM_GASES+1);i++) |
787 { | 779 { |
866 { | 858 { |
867 pSettings->salinity = 0; | 859 pSettings->salinity = 0; |
868 dataIn.data[dataIn.boolPressureData].surface_mbar = 999; | 860 dataIn.data[dataIn.boolPressureData].surface_mbar = 999; |
869 dataIn.data[dataIn.boolPressureData].pressure_mbar = 98971; | 861 dataIn.data[dataIn.boolPressureData].pressure_mbar = 98971; |
870 dataIn.mode = MODE_DIVE; | 862 dataIn.mode = MODE_DIVE; |
863 } | |
864 | |
865 | |
866 /* internal sensor: HUD data */ | |
867 if(DataEX_external_ADC_Present == 0) | |
868 { | |
869 for(int i=0;i<3;i++) | |
870 { | |
871 pStateReal->lifeData.ppO2Sensor_bar[i] = get_ppO2Sensor_bar(i); | |
872 pStateReal->lifeData.sensorVoltage_mV[i] = get_sensorVoltage_mV(i); | |
873 } | |
874 pStateReal->lifeData.HUD_battery_voltage_V = get_HUD_battery_voltage_V(); | |
875 } | |
876 else /* use data from external ADC */ | |
877 { | |
878 if(pStateReal->data_old__lost_connection_to_slave == 0) | |
879 { | |
880 pStateReal->lifeData.sensorVoltage_mV[0] = dataIn.data[0].extADC_voltage[0]; | |
881 pStateReal->lifeData.sensorVoltage_mV[1] = dataIn.data[0].extADC_voltage[1]; | |
882 pStateReal->lifeData.sensorVoltage_mV[2] = dataIn.data[0].extADC_voltage[2]; | |
883 } | |
871 } | 884 } |
872 | 885 |
873 if(pStateReal->data_old__lost_connection_to_slave == 0) | 886 if(pStateReal->data_old__lost_connection_to_slave == 0) |
874 { | 887 { |
875 meter = getSampleDepth(&dataIn, pStateReal); | 888 meter = getSampleDepth(&dataIn, pStateReal); |
1168 { | 1181 { |
1169 DeviceDataUpdated = 0; | 1182 DeviceDataUpdated = 0; |
1170 DataEX_merge_DeviceData_and_store(); | 1183 DataEX_merge_DeviceData_and_store(); |
1171 } | 1184 } |
1172 } | 1185 } |
1173 | 1186 uint8_t DataEX_external_ADC_Present(void) |
1187 { | |
1188 uint8_t retval; | |
1189 SDataExchangeSlaveToMasterDeviceData * dataInDevice = (SDataExchangeSlaveToMasterDeviceData *)&dataIn; | |
1190 | |
1191 retval = dataInDevice->hw_Info.extADC; | |
1192 | |
1193 return retval; | |
1194 } |