Mercurial > public > ostc4
comparison Small_CPU/Src/scheduler.c @ 794:bb37d4f3e50e
Restructure UART based sensor handling:
In the previous version every UART sensor instance had its own protocol handling instance (requests, timeout, errors). With the introduction of the multiplexer these functionalities had to be harmonized. E.g. only one errorhandling which is applied to all sensors. In the new structure the sensor communication is split into one function which takes care for the control needs of a sensor and one function which handles the incoming data. The functions behalf the same independend if the sensor are connected to multiplexer or directly to the OSTC.
Second big change in the external sensor concepts is that the data processing is no longer focussed at the three existing ADC channels. Every external sensor (up to 3 ADC and 4 UART) sensor has its own instance. If the ADC slots are not in use then they may be used for visiualization of UART sensors by creating a mirror instance but this is no longer a must.
author | Ideenmodellierer |
---|---|
date | Mon, 31 Jul 2023 19:46:29 +0200 |
parents | 19ab6f3ed52a |
children | 91d5ef16f1fd |
comparison
equal
deleted
inserted
replaced
793:9da81033ad44 | 794:bb37d4f3e50e |
---|---|
514 while(global.mode == MODE_DIVE) | 514 while(global.mode == MODE_DIVE) |
515 { | 515 { |
516 lasttick = HAL_GetTick(); | 516 lasttick = HAL_GetTick(); |
517 ticksdiff = time_elapsed_ms(Scheduler.tickstart,lasttick); | 517 ticksdiff = time_elapsed_ms(Scheduler.tickstart,lasttick); |
518 | 518 |
519 #ifdef ENABLE_CO2_SUPPORT | 519 if(externalInterface_GetUARTProtocol() != 0) |
520 if(externalInterface_GetUARTProtocol() & (EXT_INTERFACE_UART_CO2 >> 8)) | 520 { |
521 { | 521 externalInterface_HandleUART(); |
522 UART_HandleCO2Data(); | |
523 } | |
524 #endif | |
525 #ifdef ENABLE_SENTINEL_MODE | |
526 if(externalInterface_GetUARTProtocol() & (EXT_INTERFACE_UART_SENTINEL >> 8)) | |
527 { | |
528 UART_HandleSentinelData(); | |
529 } | |
530 #endif | |
531 if(externalInterface_GetUARTProtocol() & (EXT_INTERFACE_UART_O2 >> 8)) | |
532 { | |
533 UART_HandleDigitalO2(); | |
534 } | 522 } |
535 | 523 |
536 if(ticksdiff >= Scheduler.counterSPIdata100msec * 100 + 10) | 524 if(ticksdiff >= Scheduler.counterSPIdata100msec * 100 + 10) |
537 { | 525 { |
538 if(SPI_Evaluate_RX_Data()!=0) /* did we receive something ? */ | 526 if(SPI_Evaluate_RX_Data()!=0) /* did we receive something ? */ |
836 { | 824 { |
837 if(scheduleSetButtonResponsiveness()) | 825 if(scheduleSetButtonResponsiveness()) |
838 setButtonsNow = 0; | 826 setButtonsNow = 0; |
839 } | 827 } |
840 | 828 |
841 #ifdef ENABLE_CO2_SUPPORT | 829 if(externalInterface_GetUARTProtocol() != 0) |
842 if(externalInterface_GetUARTProtocol() & (EXT_INTERFACE_UART_CO2 >> 8)) | 830 { |
843 { | 831 externalInterface_HandleUART(); |
844 UART_HandleCO2Data(); | |
845 } | |
846 #endif | |
847 #ifdef ENABLE_SENTINEL_MODE | |
848 if(externalInterface_GetUARTProtocol() & (EXT_INTERFACE_UART_SENTINEL >> 8)) | |
849 { | |
850 UART_HandleSentinelData(); | |
851 } | |
852 #endif | |
853 | |
854 if(externalInterface_GetUARTProtocol() & (EXT_INTERFACE_UART_O2 >> 8)) | |
855 { | |
856 UART_HandleDigitalO2(); | |
857 } | 832 } |
858 | 833 |
859 /* Evaluate received data at 10 ms, 110 ms, 210 ms,... duration ~<1ms */ | 834 /* Evaluate received data at 10 ms, 110 ms, 210 ms,... duration ~<1ms */ |
860 if(ticksdiff >= Scheduler.counterSPIdata100msec * 100 + 10) | 835 if(ticksdiff >= Scheduler.counterSPIdata100msec * 100 + 10) |
861 { | 836 { |