comparison Small_CPU/Src/externalInterface.c @ 976:0b81ac558e89 Evo_2_23

Devbugfix UART buffer cleaning: In the previous version a buffer cleaning function was used which resets the ringbuffer read index. As result the processing of data was stopped until the DMA write comes to the index 0. When reaching it the complete buffer was proceeded including possibly invalid data. The usage of the cleanbuffer function was replaced by the flush buffer function (meaning the data is discarded but the data index is maintained). There was already a function for this. Because the function was 99% the same as the read function, it was integrated into the ReadData function. Calling the function with parameter flush = 1 will result in a buffer flush. The workaround of the previous revision was updated to only be applied in case a DiveO2 sensor is operated in stand alone mode.
author Ideenmodellierer
date Wed, 29 Jan 2025 17:21:20 +0100 (7 weeks ago)
parents 142f3d0363b3
children
comparison
equal deleted inserted replaced
975:142f3d0363b3 976:0b81ac558e89
1154 } 1154 }
1155 } 1155 }
1156 1156
1157 if(externalInterface_SensorState[activeSensorId] != UART_COMMON_INIT) 1157 if(externalInterface_SensorState[activeSensorId] != UART_COMMON_INIT)
1158 { 1158 {
1159 UART_ReadData(pmap[activeSensorId]); 1159 UART_ReadData(pmap[activeSensorId], 0);
1160 UART_WriteData(&Uart1Ctrl); 1160 UART_WriteData(&Uart1Ctrl);
1161 } 1161 }
1162 if(externalInterface_SensorState[activeSensorId] == UART_COMMON_INIT) 1162 if(externalInterface_SensorState[activeSensorId] == UART_COMMON_INIT)
1163 { 1163 {
1164 lastRequestTick = tick; 1164 lastRequestTick = tick;
1261 #endif 1261 #endif
1262 default: 1262 default:
1263 break; 1263 break;
1264 } 1264 }
1265 } 1265 }
1266 #if 0
1267 else
1268 {
1269 if(((time_elapsed_ms(lastRequestTick,tick) > (externalInterfaceMuxReqIntervall - 100))
1270 && externalInterface_SensorState[activeSensorId] = UART_COMMON_IDLE))
1271 {
1272 externalInterface_ReadAndSwitch();
1273 }
1274 }
1275 #endif
1276 } 1266 }
1277 1267
1278 #if 0 1268 #if 0
1279 #ifdef ENABLE_SENTINEL_MODE 1269 #ifdef ENABLE_SENTINEL_MODE
1280 if(externalInterface_GetUARTProtocol() & (EXT_INTERFACE_UART_SENTINEL)) 1270 if(externalInterface_GetUARTProtocol() & (EXT_INTERFACE_UART_SENTINEL))