Mercurial > public > ostc4
comparison Small_CPU/Src/externalInterface.c @ 957:3420e3ba698d Evo_2_23
External sensor commands: Add sensor ID to command:
In the previous version a command was send without information regarding the target sensor. To have the possibility in future to e.g. calibrate a specific sensor, the sensor ID is now transmitted together with the command. As example in the new implementation the O2 Sensor selected in the sensor menu will blink to enable sensor identification.
author | Ideenmodellierer |
---|---|
date | Mon, 06 Jan 2025 20:06:35 +0100 |
parents | 083afabc6578 |
children |
comparison
equal
deleted
inserted
replaced
956:083afabc6578 | 957:3420e3ba698d |
---|---|
1014 { | 1014 { |
1015 case EXT_INTERFACE_AUTODETECT: externalAutoDetect = DETECTION_INIT; | 1015 case EXT_INTERFACE_AUTODETECT: externalAutoDetect = DETECTION_INIT; |
1016 for(index = 0; index < 3; index++) | 1016 for(index = 0; index < 3; index++) |
1017 { | 1017 { |
1018 SensorMap[index] = SENSOR_SEARCH; | 1018 SensorMap[index] = SENSOR_SEARCH; |
1019 } | |
1020 break; | |
1021 case EXT_INTERFACE_CO2_CALIB: for(index = 0; index < EXT_INTERFACE_SENSOR_CNT; index++) | |
1022 { | |
1023 if(SensorMap[index] == SENSOR_CO2) | |
1024 { | |
1025 externalInterface_SensorState[index] = UART_CO2_CALIBRATE; | |
1026 break; | |
1027 } | |
1028 } | 1019 } |
1029 break; | 1020 break; |
1030 case EXT_INTERFACE_COPY_SENSORMAP: if(externalAutoDetect == DETECTION_OFF) | 1021 case EXT_INTERFACE_COPY_SENSORMAP: if(externalAutoDetect == DETECTION_OFF) |
1031 { | 1022 { |
1032 memcpy(SensorMap, MasterSensorMap, sizeof(MasterSensorMap)); | 1023 memcpy(SensorMap, MasterSensorMap, sizeof(MasterSensorMap)); |
1047 { | 1038 { |
1048 externalInterfaceMuxReqIntervall = 0xFFFF; | 1039 externalInterfaceMuxReqIntervall = 0xFFFF; |
1049 } | 1040 } |
1050 } | 1041 } |
1051 break; | 1042 break; |
1043 case EXT_INTERFACE_CO2_CALIB: index = (Cmd >> 8) & 0x000F; | |
1044 if(SensorMap[index] == SENSOR_CO2M) | |
1045 { | |
1046 index = Mux2ADCMap[index]; | |
1047 } | |
1048 if(SensorMap[index] == SENSOR_CO2) | |
1049 { | |
1050 externalInterface_SensorState[index] = UART_CO2_CALIBRATE; | |
1051 } | |
1052 break; | |
1053 case EXT_INTERFACE_O2_INDICATE: index = (Cmd >> 8) & 0x000F; | |
1054 if(SensorMap[index] == SENSOR_DIGO2M) | |
1055 { | |
1056 index = Mux2ADCMap[index]; | |
1057 } | |
1058 if(SensorMap[index] == SENSOR_DIGO2) | |
1059 { | |
1060 externalInterface_SensorState[index] = UART_O2_CHECK; | |
1061 } | |
1062 break; | |
1063 | |
1052 default: | 1064 default: |
1053 break; | 1065 break; |
1054 } | 1066 } |
1055 if(cmdLength != 0) | 1067 if(cmdLength != 0) |
1056 { | 1068 { |
1207 if((index != activeUartChannel) || (forceMuxChannel)) | 1219 if((index != activeUartChannel) || (forceMuxChannel)) |
1208 { | 1220 { |
1209 forceMuxChannel = 0; | 1221 forceMuxChannel = 0; |
1210 timeToTrigger = 100; | 1222 timeToTrigger = 100; |
1211 activeUartChannel = index; | 1223 activeUartChannel = index; |
1212 if((pmap[index + EXT_INTERFACE_MUX_OFFSET] == SENSOR_DIGO2) | 1224 switch(pmap[index + EXT_INTERFACE_MUX_OFFSET]) |
1213 || (pmap[index + EXT_INTERFACE_MUX_OFFSET] == SENSOR_CO2) | |
1214 || (pmap[index + EXT_INTERFACE_MUX_OFFSET] == SENSOR_GNSS)) | |
1215 { | 1225 { |
1216 uartO2_SetChannel(activeUartChannel); | 1226 case SENSOR_DIGO2: uartO2_SetChannel(activeUartChannel); |
1217 externalInterface_CheckBaudrate(SENSOR_MUX); | 1227 /* no break */ |
1218 UART_MUX_SelectAddress(activeUartChannel); | 1228 case SENSOR_CO2: |
1219 externalInterface_CheckBaudrate(pmap[activeUartChannel + EXT_INTERFACE_MUX_OFFSET]); | 1229 case SENSOR_GNSS: externalInterface_CheckBaudrate(SENSOR_MUX); |
1230 UART_MUX_SelectAddress(activeUartChannel); | |
1231 externalInterface_CheckBaudrate(pmap[activeUartChannel + EXT_INTERFACE_MUX_OFFSET]); | |
1232 break; | |
1233 default: | |
1234 break; | |
1220 } | 1235 } |
1221 } | 1236 } |
1222 } | 1237 } |
1223 } | 1238 } |
1224 else | 1239 else |