Mercurial > public > ostc4
comparison Discovery/Src/data_exchange_main.c @ 796:75ace7af8212
Expanded Sensor map structure:
In the previous version the number of possible sensors were set to 5 based on the assumption that ADC slots are shared with digital O2 sensors. As result three of five slots would have been limited to O2 measurement usecase, leaving just two slots left for other sensors (e.g. CO2). In order to have as much flexibility (and less risk for data structure changes) the number of sensors has been set to 7 (3 ADC + 4 UART MUX)
author | Ideenmodellierer |
---|---|
date | Mon, 31 Jul 2023 20:00:06 +0200 |
parents | 19ab6f3ed52a |
children | dd7ce655db26 |
comparison
equal
deleted
inserted
replaced
795:d4083ac09b5d | 796:75ace7af8212 |
---|---|
395 | 395 |
396 dataOut.data.offsetPressureSensor_mbar = settings->offsetPressure_mbar; | 396 dataOut.data.offsetPressureSensor_mbar = settings->offsetPressure_mbar; |
397 dataOut.data.offsetTemperatureSensor_centiDegree = settings->offsetTemperature_centigrad; | 397 dataOut.data.offsetTemperatureSensor_centiDegree = settings->offsetTemperature_centigrad; |
398 | 398 |
399 | 399 |
400 memcpy(dataOut.data.externalInterface_SensorMap, settings->ext_sensor_map, 5); | 400 memcpy(dataOut.data.externalInterface_SensorMap, settings->ext_sensor_map, EXT_INTERFACE_SENSOR_CNT); |
401 | 401 |
402 memset(SensorActive, 0, sizeof(SensorActive)); | 402 memset(SensorActive, 0, sizeof(SensorActive)); |
403 for (index = 0; index < EXT_INTERFACE_SENSOR_CNT; index++) | 403 for (index = 0; index < EXT_INTERFACE_SENSOR_CNT; index++) |
404 { | 404 { |
405 switch(settings->ext_sensor_map[index]) | 405 switch(settings->ext_sensor_map[index]) |
406 { | 406 { |
407 case SENSOR_ANALOG: SensorActive[SENSOR_ANALOG] = 1; | 407 case SENSOR_ANALOG: SensorActive[SENSOR_ANALOG] = 1; |
408 break; | 408 break; |
409 case SENSOR_DIGO2: SensorActive[SENSOR_DIGO2] = 1; | 409 case SENSOR_DIGO2M: SensorActive[SENSOR_DIGO2] = 1; |
410 break; | 410 break; |
411 case SENSOR_CO2: SensorActive[SENSOR_CO2] = 1; | 411 case SENSOR_CO2: SensorActive[SENSOR_CO2] = 1; |
412 break; | 412 break; |
413 #ifdef ENABLE_SENTINEL_MODE | 413 #ifdef ENABLE_SENTINEL_MODE |
414 case SENSOR_SENTINEL: SensorActive[SENSOR_SENTINEL] = 1; | 414 case SENSOR_SENTINEL: SensorActive[SENSOR_SENTINEL] = 1; |
975 pStateReal->lifeData.sensorVoltage_mV[idx] = 0.0; | 975 pStateReal->lifeData.sensorVoltage_mV[idx] = 0.0; |
976 pStateReal->lifeData.ppO2Sensor_bar[idx] = 0; | 976 pStateReal->lifeData.ppO2Sensor_bar[idx] = 0; |
977 } | 977 } |
978 else | 978 else |
979 { | 979 { |
980 if(dataIn.data[(dataIn.boolADCO2Data && DATA_BUFFER_ADC)].sensor_map[idx] == SENSOR_DIGO2) | 980 if(dataIn.data[(dataIn.boolADCO2Data && DATA_BUFFER_ADC)].sensor_map[idx] == SENSOR_DIGO2M) |
981 { | 981 { |
982 pStateReal->lifeData.ppO2Sensor_bar[idx] = pStateReal->lifeData.sensorVoltage_mV[idx] / 100.0; | 982 pStateReal->lifeData.ppO2Sensor_bar[idx] = pStateReal->lifeData.sensorVoltage_mV[idx] / 100.0; |
983 } | 983 } |
984 else | 984 else |
985 { | 985 { |