comparison Discovery/Src/data_exchange_main.c @ 716:74cfd91199bd

Added customizable data area for specific sensor data: In future smart sensors will be connected via UART interface. These sensor provide additional data like diagnostics or id numbers which may vary from sensor to sensor. That's why a byte array has been added which stores up to 32 bytes. The layout of this array may be specific to sensor needs. As first example temperature and id number of the DiveO2 sensor are provided.
author Ideenmodellierer
date Sun, 20 Nov 2022 20:43:04 +0100
parents 6d7c812fc173
children 5143e927219f
comparison
equal deleted inserted replaced
715:6c620f5f4834 716:74cfd91199bd
929 929
930 930
931 /* internal sensor: HUD data */ 931 /* internal sensor: HUD data */
932 if(pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_OPTIC) 932 if(pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_OPTIC)
933 { 933 {
934 pStateReal->lifeData.extIf_sensor_Id = 0;
934 for(int i=0;i<3;i++) 935 for(int i=0;i<3;i++)
935 { 936 {
936 pStateReal->lifeData.ppO2Sensor_bar[i] = get_ppO2Sensor_bar(i); 937 pStateReal->lifeData.ppO2Sensor_bar[i] = get_ppO2Sensor_bar(i);
937 pStateReal->lifeData.sensorVoltage_mV[i] = get_sensorVoltage_mV(i); 938 pStateReal->lifeData.sensorVoltage_mV[i] = get_sensorVoltage_mV(i);
938 } 939 }
959 else 960 else
960 { 961 {
961 pStateReal->lifeData.ppO2Sensor_bar[idx] = pStateReal->lifeData.sensorVoltage_mV[idx] * pSettings->ppo2sensors_calibCoeff[idx]; 962 pStateReal->lifeData.ppO2Sensor_bar[idx] = pStateReal->lifeData.sensorVoltage_mV[idx] * pSettings->ppo2sensors_calibCoeff[idx];
962 } 963 }
963 } 964 }
964 965 }
966 pStateReal->lifeData.extIf_sensor_Id = dataIn.data[(dataIn.boolADCO2Data && DATA_BUFFER_ADC)].externalInterface_SensorID;
967 if(pStateReal->lifeData.extIf_sensor_Id != 0)
968 {
969 memcpy(pStateReal->lifeData.extIf_sensor_data, dataIn.data[(dataIn.boolADCO2Data && DATA_BUFFER_ADC)].sensor_data, 32);
965 } 970 }
966 } 971 }
967 } 972 }
968 973
969 if(pStateReal->data_old__lost_connection_to_slave == 0) 974 if(pStateReal->data_old__lost_connection_to_slave == 0)