Mercurial > public > ostc4
changeset 780:e40790a67165
Discovery<=>SmallCPU inferface update:
The sensor data struct is extended to store the data of up to three (three visible O2 sensors). To avoid unnecessary payload on the SPI only the last update sensor data item is transfered. The sender receiver uses the sensor ID which is provided in parallel to identify the correct storage location.
author | Ideenmodellierer |
---|---|
date | Tue, 23 May 2023 21:50:19 +0200 |
parents | 0b5f45448eb6 |
children | 01b3eb9d55c3 |
files | Common/Inc/data_central.h Discovery/Src/data_exchange_main.c Small_CPU/Src/scheduler.c |
diffstat | 3 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/Common/Inc/data_central.h Tue May 23 21:45:34 2023 +0200 +++ b/Common/Inc/data_central.h Tue May 23 21:50:19 2023 +0200 @@ -173,7 +173,7 @@ typedef struct { /* from Small CPU */ - uint8_t extIf_sensor_data[32]; /* The external sensor may contain a 64 bit ID. It has been placed at the beginning of the structure to avoid problems in alignment */ + uint8_t extIf_sensor_data[3][32]; /* The external sensor may contain a 64 bit ID. It has been placed at the beginning of the structure to avoid problems in alignment */ uint8_t extIf_sensor_map[EXT_INTERFACE_SENSOR_CNT]; int32_t dive_time_seconds; @@ -434,6 +434,7 @@ SENSOR_SENTINEL, SENSOR_TYPE_O2_END, SENSOR_CO2, + SENSOR_MUX, SENSOR_END } externalInterfaceSensorType;
--- a/Discovery/Src/data_exchange_main.c Tue May 23 21:45:34 2023 +0200 +++ b/Discovery/Src/data_exchange_main.c Tue May 23 21:50:19 2023 +0200 @@ -994,9 +994,10 @@ { pStateReal->lifeData.extIf_sensor_Id = dataIn.data[(dataIn.boolADCO2Data && DATA_BUFFER_ADC)].externalInterface_SensorID; - if(pStateReal->lifeData.extIf_sensor_Id != 0) + if((pStateReal->lifeData.extIf_sensor_Id != 0) && (pStateReal->lifeData.extIf_sensor_Id <= 3)) { - memcpy(pStateReal->lifeData.extIf_sensor_data, dataIn.data[(dataIn.boolADCO2Data && DATA_BUFFER_ADC)].sensor_data, 32); + + memcpy(pStateReal->lifeData.extIf_sensor_data[pStateReal->lifeData.extIf_sensor_Id-1], dataIn.data[(dataIn.boolADCO2Data && DATA_BUFFER_ADC)].sensor_data, 32); } memcpy(pStateReal->lifeData.extIf_sensor_map, dataIn.data[(dataIn.boolADCO2Data && DATA_BUFFER_ADC)].sensor_map, EXT_INTERFACE_SENSOR_CNT);
--- a/Small_CPU/Src/scheduler.c Tue May 23 21:45:34 2023 +0200 +++ b/Small_CPU/Src/scheduler.c Tue May 23 21:50:19 2023 +0200 @@ -1735,7 +1735,7 @@ value = getExternalInterfaceChannel(channel); global.dataSendToMaster.data[boolADCBuffer && DATA_BUFFER_ADC].extADC_voltage[channel] = value; } - global.dataSendToMaster.data[boolADCBuffer && DATA_BUFFER_ADC].externalInterface_SensorID = externalInterface_GetSensorData((uint8_t*)&global.dataSendToMaster.data[boolADCBuffer && DATA_BUFFER_ADC].sensor_data); + global.dataSendToMaster.data[boolADCBuffer && DATA_BUFFER_ADC].externalInterface_SensorID = externalInterface_GetSensorData(0, (uint8_t*)&global.dataSendToMaster.data[boolADCBuffer && DATA_BUFFER_ADC].sensor_data); memcpy(global.dataSendToMaster.data[boolADCBuffer && DATA_BUFFER_ADC].sensor_map,externalInterface_GetSensorMapPointer(1),EXT_INTERFACE_SENSOR_CNT); global.dataSendToMaster.boolADCO2Data |= boolADCBuffer; }