changeset 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 66aef216828b
children 5d80bb8d22cb
files Common/Inc/data_exchange.h Discovery/Src/data_exchange_main.c Small_CPU/Src/compass.c Small_CPU/Src/externalInterface.c Small_CPU/Src/spi.c
diffstat 5 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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;
--- 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;
 }
--- 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)
--- 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;
 }
 
 
--- 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;