comparison Discovery/Src/data_exchange_main.c @ 786:19ab6f3ed52a

Cleanup sensor data interface: In a very early implementation of the multiplexer the address of the mux was 0 followed by the sensors. As a resul the ID of the channels was shifted by one. To avoid confusion and because the mux address is meanwhile changed to the last address, it makes sense to return to the indexing where only the three visible sensor slots are used as reference (0,1,2).
author Ideenmodellierer
date Sun, 04 Jun 2023 21:54:24 +0200
parents e40790a67165
children 75ace7af8212
comparison
equal deleted inserted replaced
785:3c0b16473af4 786:19ab6f3ed52a
992 992
993 if(pStateReal->data_old__lost_connection_to_slave == 0) 993 if(pStateReal->data_old__lost_connection_to_slave == 0)
994 { 994 {
995 995
996 pStateReal->lifeData.extIf_sensor_Id = dataIn.data[(dataIn.boolADCO2Data && DATA_BUFFER_ADC)].externalInterface_SensorID; 996 pStateReal->lifeData.extIf_sensor_Id = dataIn.data[(dataIn.boolADCO2Data && DATA_BUFFER_ADC)].externalInterface_SensorID;
997 if((pStateReal->lifeData.extIf_sensor_Id != 0) && (pStateReal->lifeData.extIf_sensor_Id <= 3)) 997 if(pStateReal->lifeData.extIf_sensor_Id < 3)
998 { 998 {
999 999
1000 memcpy(pStateReal->lifeData.extIf_sensor_data[pStateReal->lifeData.extIf_sensor_Id-1], dataIn.data[(dataIn.boolADCO2Data && DATA_BUFFER_ADC)].sensor_data, 32); 1000 memcpy(pStateReal->lifeData.extIf_sensor_data[pStateReal->lifeData.extIf_sensor_Id], dataIn.data[(dataIn.boolADCO2Data && DATA_BUFFER_ADC)].sensor_data, 32);
1001 } 1001 }
1002 memcpy(pStateReal->lifeData.extIf_sensor_map, dataIn.data[(dataIn.boolADCO2Data && DATA_BUFFER_ADC)].sensor_map, EXT_INTERFACE_SENSOR_CNT); 1002 memcpy(pStateReal->lifeData.extIf_sensor_map, dataIn.data[(dataIn.boolADCO2Data && DATA_BUFFER_ADC)].sensor_map, EXT_INTERFACE_SENSOR_CNT);
1003 1003
1004 1004
1005 meter = getSampleDepth(&dataIn, pStateReal); 1005 meter = getSampleDepth(&dataIn, pStateReal);