# HG changeset patch # User Ideenmodellierer # Date 1684871419 -7200 # Node ID e40790a6716529de52a74fb69e1508e4dc8d25c3 # Parent 0b5f45448eb6f97b2def20f28ebcc78fcda7593d 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. diff -r 0b5f45448eb6 -r e40790a67165 Common/Inc/data_central.h --- 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; diff -r 0b5f45448eb6 -r e40790a67165 Discovery/Src/data_exchange_main.c --- 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); diff -r 0b5f45448eb6 -r e40790a67165 Small_CPU/Src/scheduler.c --- 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; }