comparison Discovery/Src/data_exchange_main.c @ 559:84a4e1200726

Check if HW evaluation was performed: Devicedata is only requested once at startup and then every 10 minutes. To make sure that HW information related to compass and ADC are forwarded, two indicators have been added which may delay the respond by one second.
author Ideenmodellierer
date Sun, 15 Nov 2020 19:52:03 +0100
parents eb2060caca7d
children 9bb9a52d6ae5
comparison
equal deleted inserted replaced
558:66aef216828b 559:84a4e1200726
81 81
82 /* Private variables with external access ------------------------------------*/ 82 /* Private variables with external access ------------------------------------*/
83 83
84 /* Private variables ---------------------------------------------------------*/ 84 /* Private variables ---------------------------------------------------------*/
85 static uint8_t told_reset_logik_alles_ok = 0; 85 static uint8_t told_reset_logik_alles_ok = 0;
86 static hw_Info_t hw_Info;
86 87
87 static SDataReceiveFromMaster dataOut; 88 static SDataReceiveFromMaster dataOut;
88 static SDataExchangeSlaveToMaster dataIn; 89 static SDataExchangeSlaveToMaster dataIn;
89 90
90 static uint8_t data_old__lost_connection_to_slave_counter_temp = 0; 91 static uint8_t data_old__lost_connection_to_slave_counter_temp = 0;
683 { 684 {
684 SDataExchangeSlaveToMasterDeviceData * dataInDevice = (SDataExchangeSlaveToMasterDeviceData *)&dataIn; 685 SDataExchangeSlaveToMasterDeviceData * dataInDevice = (SDataExchangeSlaveToMasterDeviceData *)&dataIn;
685 SDevice * pDeviceState = stateDeviceGetPointerWrite(); 686 SDevice * pDeviceState = stateDeviceGetPointerWrite();
686 687
687 memcpy(pDeviceState, &dataInDevice->DeviceData[dataInDevice->boolDeviceData], sizeof(SDevice)); 688 memcpy(pDeviceState, &dataInDevice->DeviceData[dataInDevice->boolDeviceData], sizeof(SDevice));
689 memcpy(&hw_Info, &dataInDevice->hw_Info, sizeof(dataInDevice->hw_Info));
690
688 DeviceDataUpdated = 1; /* indicate new data to be written to flash by background task (at last op hour count will be updated) */ 691 DeviceDataUpdated = 1; /* indicate new data to be written to flash by background task (at last op hour count will be updated) */
689 } 692 }
690 693
691 694
692 static void DataEX_copy_to_VpmRepetitiveData(void) 695 static void DataEX_copy_to_VpmRepetitiveData(void)
862 dataIn.mode = MODE_DIVE; 865 dataIn.mode = MODE_DIVE;
863 } 866 }
864 867
865 868
866 /* internal sensor: HUD data */ 869 /* internal sensor: HUD data */
867 if(DataEX_external_ADC_Present == 0) 870 if(pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_OPTIC)
868 { 871 {
869 for(int i=0;i<3;i++) 872 for(int i=0;i<3;i++)
870 { 873 {
871 pStateReal->lifeData.ppO2Sensor_bar[i] = get_ppO2Sensor_bar(i); 874 pStateReal->lifeData.ppO2Sensor_bar[i] = get_ppO2Sensor_bar(i);
872 pStateReal->lifeData.sensorVoltage_mV[i] = get_sensorVoltage_mV(i); 875 pStateReal->lifeData.sensorVoltage_mV[i] = get_sensorVoltage_mV(i);
878 if(pStateReal->data_old__lost_connection_to_slave == 0) 881 if(pStateReal->data_old__lost_connection_to_slave == 0)
879 { 882 {
880 pStateReal->lifeData.sensorVoltage_mV[0] = dataIn.data[0].extADC_voltage[0]; 883 pStateReal->lifeData.sensorVoltage_mV[0] = dataIn.data[0].extADC_voltage[0];
881 pStateReal->lifeData.sensorVoltage_mV[1] = dataIn.data[0].extADC_voltage[1]; 884 pStateReal->lifeData.sensorVoltage_mV[1] = dataIn.data[0].extADC_voltage[1];
882 pStateReal->lifeData.sensorVoltage_mV[2] = dataIn.data[0].extADC_voltage[2]; 885 pStateReal->lifeData.sensorVoltage_mV[2] = dataIn.data[0].extADC_voltage[2];
886 pStateReal->lifeData.ppO2Sensor_bar[0] = pStateReal->lifeData.sensorVoltage_mV[0] * pSettings->ppo2sensors_calibCoeff[0];
887 pStateReal->lifeData.ppO2Sensor_bar[1] = pStateReal->lifeData.sensorVoltage_mV[1] * pSettings->ppo2sensors_calibCoeff[1];
888 pStateReal->lifeData.ppO2Sensor_bar[2] = pStateReal->lifeData.sensorVoltage_mV[2] * pSettings->ppo2sensors_calibCoeff[2];
883 } 889 }
884 } 890 }
885 891
886 if(pStateReal->data_old__lost_connection_to_slave == 0) 892 if(pStateReal->data_old__lost_connection_to_slave == 0)
887 { 893 {
1184 } 1190 }
1185 } 1191 }
1186 uint8_t DataEX_external_ADC_Present(void) 1192 uint8_t DataEX_external_ADC_Present(void)
1187 { 1193 {
1188 uint8_t retval; 1194 uint8_t retval;
1189 SDataExchangeSlaveToMasterDeviceData * dataInDevice = (SDataExchangeSlaveToMasterDeviceData *)&dataIn; 1195 retval = hw_Info.extADC;
1190
1191 retval = dataInDevice->hw_Info.extADC;
1192 1196
1193 return retval; 1197 return retval;
1194 } 1198 }