# HG changeset patch # User Ideenmodellierer # Date 1605466323 -3600 # Node ID 84a4e1200726dcc144ba4aa23bd30f390c722b5b # Parent 66aef216828b89f120b4221dd94c32d57cb69312 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. diff -r 66aef216828b -r 84a4e1200726 Common/Inc/data_exchange.h --- a/Common/Inc/data_exchange.h Thu Nov 12 20:06:04 2020 +0100 +++ b/Common/Inc/data_exchange.h Sun Nov 15 19:52:03 2020 +0100 @@ -69,7 +69,9 @@ } confirmbit8_t; typedef struct{ -uint8_t reserve:7; +uint8_t checkCompass:1; +uint8_t checkADC:1; +uint8_t reserve:5; uint8_t extADC:1; uint8_t compass:8; } hw_Info_t; diff -r 66aef216828b -r 84a4e1200726 Discovery/Src/data_exchange_main.c --- a/Discovery/Src/data_exchange_main.c Thu Nov 12 20:06:04 2020 +0100 +++ b/Discovery/Src/data_exchange_main.c Sun Nov 15 19:52:03 2020 +0100 @@ -83,6 +83,7 @@ /* Private variables ---------------------------------------------------------*/ static uint8_t told_reset_logik_alles_ok = 0; +static hw_Info_t hw_Info; static SDataReceiveFromMaster dataOut; static SDataExchangeSlaveToMaster dataIn; @@ -685,6 +686,8 @@ SDevice * pDeviceState = stateDeviceGetPointerWrite(); memcpy(pDeviceState, &dataInDevice->DeviceData[dataInDevice->boolDeviceData], sizeof(SDevice)); + memcpy(&hw_Info, &dataInDevice->hw_Info, sizeof(dataInDevice->hw_Info)); + DeviceDataUpdated = 1; /* indicate new data to be written to flash by background task (at last op hour count will be updated) */ } @@ -864,7 +867,7 @@ /* internal sensor: HUD data */ - if(DataEX_external_ADC_Present == 0) + if(pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_OPTIC) { for(int i=0;i<3;i++) { @@ -880,6 +883,9 @@ pStateReal->lifeData.sensorVoltage_mV[0] = dataIn.data[0].extADC_voltage[0]; pStateReal->lifeData.sensorVoltage_mV[1] = dataIn.data[0].extADC_voltage[1]; pStateReal->lifeData.sensorVoltage_mV[2] = dataIn.data[0].extADC_voltage[2]; + pStateReal->lifeData.ppO2Sensor_bar[0] = pStateReal->lifeData.sensorVoltage_mV[0] * pSettings->ppo2sensors_calibCoeff[0]; + pStateReal->lifeData.ppO2Sensor_bar[1] = pStateReal->lifeData.sensorVoltage_mV[1] * pSettings->ppo2sensors_calibCoeff[1]; + pStateReal->lifeData.ppO2Sensor_bar[2] = pStateReal->lifeData.sensorVoltage_mV[2] * pSettings->ppo2sensors_calibCoeff[2]; } } @@ -1186,9 +1192,7 @@ uint8_t DataEX_external_ADC_Present(void) { uint8_t retval; - SDataExchangeSlaveToMasterDeviceData * dataInDevice = (SDataExchangeSlaveToMasterDeviceData *)&dataIn; - - retval = dataInDevice->hw_Info.extADC; + retval = hw_Info.extADC; return retval; } diff -r 66aef216828b -r 84a4e1200726 Small_CPU/Src/compass.c --- a/Small_CPU/Src/compass.c Thu Nov 12 20:06:04 2020 +0100 +++ b/Small_CPU/Src/compass.c Sun Nov 15 19:52:03 2020 +0100 @@ -294,6 +294,7 @@ if(global.deviceDataSendToMaster.hw_Info.compass == 0) { global.deviceDataSendToMaster.hw_Info.compass = hardwareCompass; + global.deviceDataSendToMaster.hw_Info.checkCompass = 1; } tfull32 dataBlock[4]; if(BFA_readLastDataBlock((uint32_t *)dataBlock) == BFA_OK) diff -r 66aef216828b -r 84a4e1200726 Small_CPU/Src/externalInterface.c --- a/Small_CPU/Src/externalInterface.c Thu Nov 12 20:06:04 2020 +0100 +++ b/Small_CPU/Src/externalInterface.c Sun Nov 15 19:52:03 2020 +0100 @@ -64,6 +64,7 @@ externalInterfacePresent = 1; global.deviceDataSendToMaster.hw_Info.extADC = 1; } + global.deviceDataSendToMaster.hw_Info.checkADC = 1; } diff -r 66aef216828b -r 84a4e1200726 Small_CPU/Src/spi.c --- a/Small_CPU/Src/spi.c Thu Nov 12 20:06:04 2020 +0100 +++ b/Small_CPU/Src/spi.c Sun Nov 15 19:52:03 2020 +0100 @@ -307,7 +307,9 @@ if ((global.dataSendToSlave.getDeviceDataNow) || (DeviceDataPending)) { - if(((DevicedataDelayCnt == 0) || (((get_voltage() != 6.0) && (get_temperature() != 0.0))))) /* devicedata complete? */ + if(((DevicedataDelayCnt == 0) || (((get_voltage() != 6.0) && (get_temperature() != 0.0) + && global.deviceDataSendToMaster.hw_Info.checkCompass) + && global.deviceDataSendToMaster.hw_Info.checkADC))) /* devicedata complete? */ { global.dataSendToSlave.getDeviceDataNow = 0; DeviceDataPending = 0;