comparison Discovery/Src/data_exchange_main.c @ 691:52d68cf9994c Betatest

Improvment external interface usage: The previous implementation of the external interface was straight forward for ADC and Co2 UART usage. The new implementation provides the possibility to configurate the behavior of the external interface. e.g. Switching of external3,3V and ADC separatly and selection of UART protocol.
author Ideenmodellierer
date Fri, 05 Aug 2022 15:26:28 +0200
parents 1b995079c045
children 6d7c812fc173
comparison
equal deleted inserted replaced
690:fca2bd25e6e2 691:52d68cf9994c
389 dataOut.data.timeoutDiveReachedZeroDepth = settings->timeoutDiveReachedZeroDepth; 389 dataOut.data.timeoutDiveReachedZeroDepth = settings->timeoutDiveReachedZeroDepth;
390 390
391 dataOut.data.offsetPressureSensor_mbar = settings->offsetPressure_mbar; 391 dataOut.data.offsetPressureSensor_mbar = settings->offsetPressure_mbar;
392 dataOut.data.offsetTemperatureSensor_centiDegree = settings->offsetTemperature_centigrad; 392 dataOut.data.offsetTemperatureSensor_centiDegree = settings->offsetTemperature_centigrad;
393 393
394
395
396 if(settings->ppo2sensors_source == O2_SENSOR_SOURCE_ANALOG)
397 {
398 externalInterface_Cmd |= EXT_INTERFACE_ADC_ON | EXT_INTERFACE_33V_ON;
399 }
400
401 #ifdef ENABLE_SENTINEL_MODE
402 if(settings->ppo2sensors_source == O2_SENSOR_SOURCE_SENTINEL)
403 {
404 externalInterface_Cmd |= EXT_INTERFACE_33V_ON | EXT_INTERFACE_UART_SENTINEL;
405 externalInterface_Cmd &= (~EXT_INTERFACE_ADC_ON);
406 }
407 #endif
408
409 if(settings->ext_uart_protocol)
410 {
411 externalInterface_Cmd |= (settings->ext_uart_protocol << 8);
412 }
394 if(settings->co2_sensor_active) 413 if(settings->co2_sensor_active)
395 { 414 {
396 externalInterface_Cmd |= EXT_INTERFACE_33V_ON; 415 externalInterface_Cmd |= EXT_INTERFACE_33V_ON | EXT_INTERFACE_UART_CO2;
397 } 416 }
398 dataOut.data.externalInterface_Cmd = externalInterface_Cmd; 417 dataOut.data.externalInterface_Cmd = externalInterface_Cmd;
399 externalInterface_Cmd = 0; 418 externalInterface_Cmd = 0;
400 419
401 if((hardwareDataGetPointer()->primarySerial <= 32) || (((hardwareDataGetPointer()->primarySerial == 72) && (hardwareDataGetPointer()->secondarySerial == 15)))) 420 if((hardwareDataGetPointer()->primarySerial <= 32) || (((hardwareDataGetPointer()->primarySerial == 72) && (hardwareDataGetPointer()->secondarySerial == 15))))
918 { 937 {
919 if(pStateReal->data_old__lost_connection_to_slave == 0) 938 if(pStateReal->data_old__lost_connection_to_slave == 0)
920 { 939 {
921 for(idx = 0; idx < 3; idx++) 940 for(idx = 0; idx < 3; idx++)
922 { 941 {
923 pStateReal->lifeData.sensorVoltage_mV[idx] = dataIn.data[0].extADC_voltage[idx]; 942 pStateReal->lifeData.sensorVoltage_mV[idx] = dataIn.data[(dataIn.boolADCO2Data && DATA_BUFFER_ADC)].extADC_voltage[idx];
924 if(pStateReal->lifeData.sensorVoltage_mV[idx] < IGNORE_O2_VOLTAGE_LEVEL_MV) 943 if(pStateReal->lifeData.sensorVoltage_mV[idx] < IGNORE_O2_VOLTAGE_LEVEL_MV)
925 { 944 {
926 pStateReal->lifeData.sensorVoltage_mV[idx] = 0.0; 945 pStateReal->lifeData.sensorVoltage_mV[idx] = 0.0;
927 pStateReal->lifeData.ppO2Sensor_bar[idx] = 0; 946 pStateReal->lifeData.ppO2Sensor_bar[idx] = 0;
928 } 947 }
1080 /* sensorErrors 1099 /* sensorErrors
1081 */ 1100 */
1082 pStateReal->sensorErrorsRTE = dataIn.sensorErrors; 1101 pStateReal->sensorErrorsRTE = dataIn.sensorErrors;
1083 1102
1084 /* data from CO2 sensor */ 1103 /* data from CO2 sensor */
1085 pStateReal->lifeData.CO2_data.CO2_ppm = dataIn.data[0].CO2_ppm; 1104 pStateReal->lifeData.CO2_data.CO2_ppm = dataIn.data[(dataIn.boolADCO2Data && DATA_BUFFER_CO2)].CO2_ppm;
1086 pStateReal->lifeData.CO2_data.signalStrength = dataIn.data[0].CO2_signalStrength; 1105 pStateReal->lifeData.CO2_data.signalStrength = dataIn.data[(dataIn.boolADCO2Data && DATA_BUFFER_CO2)].CO2_signalStrength;
1087 } 1106 }
1088 1107
1089 /* apnea specials 1108 /* apnea specials
1090 */ 1109 */
1091 if(pStateReal->diveSettings.diveMode == DIVEMODE_Apnea) 1110 if(pStateReal->diveSettings.diveMode == DIVEMODE_Apnea)