Mercurial > public > ostc4
comparison Small_CPU/Src/externalInterface.c @ 798:e9eba334b942
Migrated CO2 protocol implementation to new format:
The previous implementation was a monolithic protocol implementation which was not usable together with the multiplexer. The new implementation moves the CO2 implementation into a separate C file and decoubles the upper layer external interface, which is not able to handle DiveO2 and CO2 sensors in parallel without restriction to port assignments.
author | Ideenmodellierer |
---|---|
date | Mon, 07 Aug 2023 20:29:44 +0200 |
parents | bb37d4f3e50e |
children | 391b3d420a39 |
comparison
equal
deleted
inserted
replaced
797:acf6614dc396 | 798:e9eba334b942 |
---|---|
31 #include "scheduler.h" | 31 #include "scheduler.h" |
32 #include "uart.h" | 32 #include "uart.h" |
33 #include "data_exchange.h" | 33 #include "data_exchange.h" |
34 #include "pressure.h" | 34 #include "pressure.h" |
35 #include "uartProtocol_O2.h" | 35 #include "uartProtocol_O2.h" |
36 #include "uartProtocol_Co2.h" | |
36 | 37 |
37 extern SGlobal global; | 38 extern SGlobal global; |
38 extern UART_HandleTypeDef huart1; | 39 extern UART_HandleTypeDef huart1; |
39 | 40 |
40 #define ADC_ANSWER_LENGTH (5u) /* 3424 will provide addr + 4 data bytes */ | 41 #define ADC_ANSWER_LENGTH (5u) /* 3424 will provide addr + 4 data bytes */ |
131 | 132 |
132 for(index = 0; index < MAX_ADC_CHANNEL; index++) | 133 for(index = 0; index < MAX_ADC_CHANNEL; index++) |
133 { | 134 { |
134 externalChannel_mV[index] = 0.0; | 135 externalChannel_mV[index] = 0.0; |
135 } | 136 } |
136 memset(externalInterface_SensorState,UART_O2_INIT,sizeof(externalInterface_SensorState)); | 137 memset(externalInterface_SensorState,UART_COMMON_INIT,sizeof(externalInterface_SensorState)); |
137 } | 138 } |
138 | 139 |
139 | 140 |
140 uint8_t externalInterface_StartConversion(uint8_t channel) | 141 uint8_t externalInterface_StartConversion(uint8_t channel) |
141 { | 142 { |
361 case 0: | 362 case 0: |
362 case (EXT_INTERFACE_UART_CO2 >> 8): | 363 case (EXT_INTERFACE_UART_CO2 >> 8): |
363 case (EXT_INTERFACE_UART_O2 >> 8): | 364 case (EXT_INTERFACE_UART_O2 >> 8): |
364 case (EXT_INTERFACE_UART_SENTINEL >> 8): | 365 case (EXT_INTERFACE_UART_SENTINEL >> 8): |
365 if((externalAutoDetect <= DETECTION_START) | 366 if((externalAutoDetect <= DETECTION_START) |
366 || ((protocol == EXT_INTERFACE_UART_O2 >> 8) && (externalAutoDetect == DETECTION_DIGO2_0)) | 367 || ((protocol == EXT_INTERFACE_UART_O2 >> 8) && (externalAutoDetect >= DETECTION_UARTMUX) && (externalAutoDetect <= DETECTION_DIGO2_3)) |
367 || ((protocol == EXT_INTERFACE_UART_O2 >> 8) && (externalAutoDetect == DETECTION_DIGO2_1)) | 368 |
368 || ((protocol == EXT_INTERFACE_UART_O2 >> 8) && (externalAutoDetect == DETECTION_DIGO2_2)) | |
369 || ((protocol == EXT_INTERFACE_UART_O2 >> 8) && (externalAutoDetect == DETECTION_DIGO2_3)) | |
370 || ((protocol == EXT_INTERFACE_UART_O2 >> 8) && (externalAutoDetect == DETECTION_UARTMUX)) | |
371 #ifdef ENABLE_CO2_SUPPORT | 369 #ifdef ENABLE_CO2_SUPPORT |
372 || ((protocol == EXT_INTERFACE_UART_CO2 >> 8) && (externalAutoDetect == DETECTION_CO2)) | 370 || ((externalAutoDetect >= DETECTION_CO2_0) && (externalAutoDetect <= DETECTION_CO2_3)) |
373 #endif | 371 #endif |
374 #ifdef ENABLE_SENTINEL_MODE | 372 #ifdef ENABLE_SENTINEL_MODE |
375 || ((protocol == EXT_INTERFACE_UART_SENTINEL >> 8) && (externalAutoDetect == DETECTION_SENTINEL)) | 373 || ((protocol == EXT_INTERFACE_UART_SENTINEL >> 8) && (externalAutoDetect == DETECTION_SENTINEL)) |
376 #endif | 374 #endif |
377 ) | 375 ) |
564 static uint8_t uartMuxChannel = 0; | 562 static uint8_t uartMuxChannel = 0; |
565 uint8_t index = 0; | 563 uint8_t index = 0; |
566 uint8_t index2 = 0; | 564 uint8_t index2 = 0; |
567 uint8_t cntSensor = 0; | 565 uint8_t cntSensor = 0; |
568 uint8_t cntUARTSensor = 0; | 566 uint8_t cntUARTSensor = 0; |
567 #ifdef ENABLE_CO2_SUPPORT | |
569 uint8_t cmdString[10]; | 568 uint8_t cmdString[10]; |
570 uint8_t cmdLength = 0; | 569 uint8_t cmdLength = 0; |
570 #endif | |
571 | 571 |
572 if(externalAutoDetect != DETECTION_OFF) | 572 if(externalAutoDetect != DETECTION_OFF) |
573 { | 573 { |
574 switch(externalAutoDetect) | 574 switch(externalAutoDetect) |
575 { | 575 { |
581 tmpSensorMap[2] = SENSOR_OPTIC; | 581 tmpSensorMap[2] = SENSOR_OPTIC; |
582 tmpSensorMap[3] = SENSOR_NONE; | 582 tmpSensorMap[3] = SENSOR_NONE; |
583 tmpSensorMap[4] = SENSOR_NONE; | 583 tmpSensorMap[4] = SENSOR_NONE; |
584 | 584 |
585 memset(foundSensorMap, SENSOR_NONE, sizeof(foundSensorMap)); | 585 memset(foundSensorMap, SENSOR_NONE, sizeof(foundSensorMap)); |
586 memset(externalInterface_SensorState,UART_O2_INIT,sizeof(externalInterface_SensorState)); | 586 memset(externalInterface_SensorState,UART_COMMON_INIT,sizeof(externalInterface_SensorState)); |
587 memset(Mux2ADCMap,0, sizeof(Mux2ADCMap)); | 587 memset(Mux2ADCMap,0, sizeof(Mux2ADCMap)); |
588 | 588 |
589 if(externalInterfacePresent) | 589 if(externalInterfacePresent) |
590 { | 590 { |
591 externalInterface_SwitchPower33(0); | 591 externalInterface_SwitchPower33(0); |
638 else | 638 else |
639 { | 639 { |
640 tmpSensorMap[EXT_INTERFACE_SENSOR_CNT-1] = SENSOR_NONE; | 640 tmpSensorMap[EXT_INTERFACE_SENSOR_CNT-1] = SENSOR_NONE; |
641 } | 641 } |
642 externalAutoDetect = DETECTION_DIGO2_0; | 642 externalAutoDetect = DETECTION_DIGO2_0; |
643 externalInterface_SwitchUART(EXT_INTERFACE_UART_O2 >> 8); | |
644 UART_MUX_SelectAddress(0); | 643 UART_MUX_SelectAddress(0); |
645 uartO2_SetChannel(0); | 644 uartO2_SetChannel(0); |
646 activeUartChannel = 0; | 645 activeUartChannel = 0; |
647 tmpSensorMap[EXT_INTERFACE_MUX_OFFSET] = SENSOR_DIGO2; | 646 tmpSensorMap[EXT_INTERFACE_MUX_OFFSET] = SENSOR_DIGO2; |
648 externalInterface_SensorState[EXT_INTERFACE_MUX_OFFSET] = UART_O2_INIT; | 647 externalInterface_SensorState[EXT_INTERFACE_MUX_OFFSET] = UART_COMMON_INIT; |
649 externalInterface_SwitchUART(EXT_INTERFACE_UART_O2 >> 8); | 648 externalInterface_SwitchUART(EXT_INTERFACE_UART_O2 >> 8); |
650 break; | 649 break; |
651 case DETECTION_DIGO2_0: | 650 case DETECTION_DIGO2_0: |
652 case DETECTION_DIGO2_1: | 651 case DETECTION_DIGO2_1: |
653 case DETECTION_DIGO2_2: | 652 case DETECTION_DIGO2_2: |
659 | 658 |
660 if(uartMuxChannel) | 659 if(uartMuxChannel) |
661 { | 660 { |
662 externalInterface_SwitchUART(EXT_INTERFACE_UART_O2 >> 8); | 661 externalInterface_SwitchUART(EXT_INTERFACE_UART_O2 >> 8); |
663 UART_MUX_SelectAddress(uartMuxChannel); | 662 UART_MUX_SelectAddress(uartMuxChannel); |
664 externalInterface_SensorState[uartMuxChannel + EXT_INTERFACE_MUX_OFFSET] = UART_O2_INIT; | 663 externalInterface_SensorState[uartMuxChannel + EXT_INTERFACE_MUX_OFFSET] = UART_COMMON_INIT; |
665 uartO2_SetChannel(uartMuxChannel); | 664 uartO2_SetChannel(uartMuxChannel); |
666 activeUartChannel = uartMuxChannel; | 665 activeUartChannel = uartMuxChannel; |
667 tmpSensorMap[uartMuxChannel - 1 + EXT_INTERFACE_MUX_OFFSET] = SENSOR_NONE; | 666 tmpSensorMap[uartMuxChannel - 1 + EXT_INTERFACE_MUX_OFFSET] = SENSOR_NONE; |
668 tmpSensorMap[uartMuxChannel + EXT_INTERFACE_MUX_OFFSET] = SENSOR_DIGO2; | 667 tmpSensorMap[uartMuxChannel + EXT_INTERFACE_MUX_OFFSET] = SENSOR_DIGO2; |
669 | 668 |
676 { | 675 { |
677 externalAutoDetect = DETECTION_DIGO2_3; /* skip detection of other serial sensors */ | 676 externalAutoDetect = DETECTION_DIGO2_3; /* skip detection of other serial sensors */ |
678 } | 677 } |
679 externalAutoDetect++; | 678 externalAutoDetect++; |
680 #ifdef ENABLE_CO2_SUPPORT | 679 #ifdef ENABLE_CO2_SUPPORT |
681 if(externalAutoDetect == DETECTION_CO2) | 680 if(externalAutoDetect == DETECTION_CO2_0) |
682 { | 681 { |
682 UART_MUX_SelectAddress(0); | |
683 activeUartChannel = 0; | |
684 tmpSensorMap[uartMuxChannel - 1 + EXT_INTERFACE_MUX_OFFSET] = SENSOR_NONE; | |
685 uartMuxChannel = 1; | |
686 tmpSensorMap[EXT_INTERFACE_MUX_OFFSET] = SENSOR_CO2; | |
687 externalInterface_SensorState[EXT_INTERFACE_MUX_OFFSET] = UART_COMMON_INIT; | |
683 externalInterface_SwitchUART(EXT_INTERFACE_UART_CO2 >> 8); | 688 externalInterface_SwitchUART(EXT_INTERFACE_UART_CO2 >> 8); |
684 if(tmpSensorMap[EXT_INTERFACE_SENSOR_CNT-1] == SENSOR_MUX) /* switch sensor operation mode depending on HW config */ | 689 if(tmpSensorMap[EXT_INTERFACE_SENSOR_CNT-1] == SENSOR_MUX) /* switch sensor operation mode depending on HW config */ |
685 { | 690 { |
686 DigitalCO2_SendCmd(CO2CMD_MODE_POLL, cmdString, &cmdLength); | 691 uartCo2_SendCmd(CO2CMD_MODE_POLL, cmdString, &cmdLength); |
687 } | 692 } |
688 else | 693 else |
689 { | 694 { |
690 DigitalCO2_SendCmd(CO2CMD_MODE_STREAM, cmdString, &cmdLength); | 695 uartCo2_SendCmd(CO2CMD_MODE_STREAM, cmdString, &cmdLength); |
691 } | 696 } |
692 } | 697 } |
693 break; | 698 break; |
694 case DETECTION_CO2: if(UART_isCO2Connected()) | 699 case DETECTION_CO2_0: |
695 { | 700 case DETECTION_CO2_1: |
696 for(index = 0; index < 3; index++) /* lookup a channel which may be used by CO2*/ | 701 case DETECTION_CO2_2: |
697 { | 702 case DETECTION_CO2_3: if(uartCo2_isSensorConnected()) |
698 if(tmpSensorMap[index] == SENSOR_NONE) | 703 { |
699 { | 704 foundSensorMap[EXT_INTERFACE_MUX_OFFSET + activeUartChannel] = SENSOR_CO2; |
700 break; | 705 externalAutoDetect = DETECTION_DONE; /* only one CO2 sensor supported */ |
701 } | 706 } |
702 } | 707 else if(foundSensorMap[EXT_INTERFACE_SENSOR_CNT-1] == SENSOR_MUX) |
703 if(index == 3) | 708 { |
704 { | 709 externalInterface_SwitchUART(EXT_INTERFACE_UART_O2 >> 8); |
705 tmpSensorMap[sensorIndex++] = SENSOR_CO2; /* place Co2 sensor behind O2 sensors (not visible) */ | 710 UART_MUX_SelectAddress(uartMuxChannel); |
706 } | 711 activeUartChannel = uartMuxChannel; |
707 else | 712 tmpSensorMap[uartMuxChannel - 1 + EXT_INTERFACE_MUX_OFFSET] = SENSOR_NONE; |
708 { | 713 tmpSensorMap[EXT_INTERFACE_MUX_OFFSET + uartMuxChannel] = SENSOR_CO2; |
709 tmpSensorMap[index] = SENSOR_CO2; | 714 externalInterface_SensorState[EXT_INTERFACE_MUX_OFFSET + uartMuxChannel] = UART_COMMON_INIT; |
710 } | 715 externalInterface_SwitchUART(EXT_INTERFACE_UART_CO2 >> 8); |
711 | 716 uartCo2_SendCmd(CO2CMD_MODE_POLL, cmdString, &cmdLength); |
712 } | 717 externalAutoDetect++; |
713 externalAutoDetect++; | 718 uartMuxChannel++; |
719 } | |
720 else | |
721 { | |
722 externalAutoDetect = DETECTION_DONE; | |
723 } | |
714 #endif | 724 #endif |
715 #ifdef ENABLE_SENTINEL_MODE | 725 #ifdef ENABLE_SENTINEL_MODE |
716 if(externalAutoDetect == DETECTION_SENTINEL) | 726 if(externalAutoDetect == DETECTION_SENTINEL) |
717 { | 727 { |
718 externalInterface_SwitchUART(EXT_INTERFACE_UART_SENTINEL >> 8); | 728 externalInterface_SwitchUART(EXT_INTERFACE_UART_SENTINEL >> 8); |
738 activeUartChannel = 0xFF; | 748 activeUartChannel = 0xFF; |
739 cntSensor = 0; | 749 cntSensor = 0; |
740 cntUARTSensor = 0; | 750 cntUARTSensor = 0; |
741 for(index = 0; index < EXT_INTERFACE_SENSOR_CNT-1; index++) | 751 for(index = 0; index < EXT_INTERFACE_SENSOR_CNT-1; index++) |
742 { | 752 { |
743 if((foundSensorMap[index] >= SENSOR_ANALOG) && (foundSensorMap[index] < SENSOR_TYPE_O2_END)) | 753 if((foundSensorMap[index] >= SENSOR_ANALOG) && (foundSensorMap[index] < SENSOR_MUX)) |
744 { | 754 { |
745 cntSensor++; | 755 cntSensor++; |
746 } | 756 } |
747 | 757 |
748 if((foundSensorMap[index] == SENSOR_DIGO2) || (foundSensorMap[index] == SENSOR_CO2)) | 758 if((foundSensorMap[index] == SENSOR_DIGO2) || (foundSensorMap[index] == SENSOR_CO2)) |
762 break; | 772 break; |
763 } | 773 } |
764 } | 774 } |
765 } | 775 } |
766 } | 776 } |
777 for(index = 0; index < EXT_INTERFACE_SENSOR_CNT-1; index++) | |
778 { | |
779 if(foundSensorMap[index] == SENSOR_CO2) | |
780 { | |
781 for(index2 = 0; index2 < MAX_ADC_CHANNEL; index2++) | |
782 { | |
783 if(foundSensorMap[index2] == SENSOR_NONE) | |
784 { | |
785 foundSensorMap[index2] = SENSOR_CO2M; /* store a mirror instance needed for visualization */ | |
786 Mux2ADCMap[index2] = index; | |
787 break; | |
788 } | |
789 } | |
790 } | |
791 } | |
767 externalInterfaceMuxReqIntervall = 0xFFFF; | 792 externalInterfaceMuxReqIntervall = 0xFFFF; |
768 if(cntSensor == 0) /* return default sensor map if no sensor at all has been detected */ | 793 if(cntSensor == 0) /* return default sensor map if no sensor at all has been detected */ |
769 { | 794 { |
770 foundSensorMap[0] = SENSOR_OPTIC; | 795 foundSensorMap[0] = SENSOR_OPTIC; |
771 foundSensorMap[1] = SENSOR_OPTIC; | 796 foundSensorMap[1] = SENSOR_OPTIC; |
777 { | 802 { |
778 externalInterfaceMuxReqIntervall = REQUEST_INT_SENSOR_MS / cntUARTSensor; | 803 externalInterfaceMuxReqIntervall = REQUEST_INT_SENSOR_MS / cntUARTSensor; |
779 } | 804 } |
780 } | 805 } |
781 memcpy(SensorMap, foundSensorMap, sizeof(foundSensorMap)); | 806 memcpy(SensorMap, foundSensorMap, sizeof(foundSensorMap)); |
782 memset(externalInterface_SensorState,UART_O2_INIT,sizeof(externalInterface_SensorState)); | 807 memset(externalInterface_SensorState, UART_COMMON_INIT, sizeof(externalInterface_SensorState)); |
783 break; | 808 break; |
784 default: | 809 default: |
785 break; | 810 break; |
786 } | 811 } |
787 } | 812 } |
803 for(index = 0; index < 3; index++) | 828 for(index = 0; index < 3; index++) |
804 { | 829 { |
805 SensorMap[index] = SENSOR_SEARCH; | 830 SensorMap[index] = SENSOR_SEARCH; |
806 } | 831 } |
807 break; | 832 break; |
808 case EXT_INTERFACE_CO2_CALIB: cmdLength = snprintf(cmdString, 10, "G\r\n"); | 833 case EXT_INTERFACE_CO2_CALIB: for(index = 0; index < EXT_INTERFACE_SENSOR_CNT; index++) |
834 { | |
835 if(SensorMap[index] == SENSOR_CO2) | |
836 { | |
837 externalInterface_SensorState[index] = UART_CO2_CALIBRATE; | |
838 break; | |
839 } | |
840 } | |
809 break; | 841 break; |
810 case EXT_INTERFACE_COPY_SENSORMAP: if(externalAutoDetect == DETECTION_OFF) | 842 case EXT_INTERFACE_COPY_SENSORMAP: if(externalAutoDetect == DETECTION_OFF) |
811 { | 843 { |
812 memcpy(SensorMap, MasterSensorMap, sizeof(MasterSensorMap)); | 844 memcpy(SensorMap, MasterSensorMap, sizeof(MasterSensorMap)); |
813 for(index = 0; index < EXT_INTERFACE_SENSOR_CNT; index++) | 845 for(index = 0; index < EXT_INTERFACE_SENSOR_CNT; index++) |
875 } while(index != currentChannel); | 907 } while(index != currentChannel); |
876 | 908 |
877 return newChannel; | 909 return newChannel; |
878 } | 910 } |
879 | 911 |
912 void externalInterface_CheckBaudrate(uint8_t sensorType) | |
913 { | |
914 static uint32_t lastBaudRate = 0; | |
915 uint32_t newBaudrate = 0; | |
916 | |
917 switch(sensorType) | |
918 { | |
919 case SENSOR_CO2: newBaudrate = 9600; | |
920 break; | |
921 case SENSOR_DIGO2: | |
922 default: newBaudrate = 19200; | |
923 break; | |
924 } | |
925 if(lastBaudRate != newBaudrate) | |
926 { | |
927 UART_ChangeBaudrate(newBaudrate); | |
928 lastBaudRate = newBaudrate; | |
929 } | |
930 } | |
931 | |
880 void externalInterface_HandleUART() | 932 void externalInterface_HandleUART() |
881 { | 933 { |
882 static uint8_t retryRequest = 0; | 934 static uint8_t retryRequest = 0; |
883 static uint32_t lastRequestTick = 0; | 935 static uint32_t lastRequestTick = 0; |
884 static uint32_t TriggerTick = 0; | 936 static uint32_t TriggerTick = 0; |
896 uartO2_SetChannel(activeUartChannel); | 948 uartO2_SetChannel(activeUartChannel); |
897 if(pmap[EXT_INTERFACE_SENSOR_CNT-1] == SENSOR_MUX) | 949 if(pmap[EXT_INTERFACE_SENSOR_CNT-1] == SENSOR_MUX) |
898 { | 950 { |
899 UART_MUX_SelectAddress(activeUartChannel); | 951 UART_MUX_SelectAddress(activeUartChannel); |
900 } | 952 } |
953 externalInterface_CheckBaudrate(pmap[activeUartChannel + EXT_INTERFACE_MUX_OFFSET]); | |
901 UART_FlushRxBuffer(); | 954 UART_FlushRxBuffer(); |
902 } | 955 } |
903 | 956 |
904 if(externalInterfaceMuxReqIntervall != 0xFFFF) | 957 if(externalInterfaceMuxReqIntervall != 0xFFFF) |
905 { | 958 { |
906 if(externalInterface_SensorState[activeSensorId] == UART_O2_INIT) | 959 if(externalInterface_SensorState[activeSensorId] == UART_COMMON_INIT) |
907 { | 960 { |
908 lastRequestTick = tick; | 961 lastRequestTick = tick; |
909 TriggerTick = tick - 10; /* just to make sure control is triggered */ | 962 TriggerTick = tick - 10; /* just to make sure control is triggered */ |
910 timeToTrigger = 1; | 963 timeToTrigger = 1; |
911 retryRequest = 0; | 964 retryRequest = 0; |
928 TriggerTick = tick; | 981 TriggerTick = tick; |
929 retryRequest = 0; | 982 retryRequest = 0; |
930 timeToTrigger = 1; | 983 timeToTrigger = 1; |
931 | 984 |
932 if((externalInterface_SensorState[activeSensorId] == UART_O2_REQ_O2) /* timeout */ | 985 if((externalInterface_SensorState[activeSensorId] == UART_O2_REQ_O2) /* timeout */ |
933 || (externalInterface_SensorState[activeSensorId] == UART_O2_REQ_RAW)) | 986 || (externalInterface_SensorState[activeSensorId] == UART_O2_REQ_RAW) |
934 { | 987 || (externalInterface_SensorState[activeSensorId] == UART_CO2_OPERATING)) |
935 setExternalInterfaceChannel(activeSensorId,0.0); | 988 { |
989 switch(pmap[activeSensorId]) | |
990 { | |
991 case SENSOR_DIGO2: setExternalInterfaceChannel(activeSensorId,0.0); | |
992 break; | |
993 case SENSOR_CO2: externalInterface_SetCO2Value(0.0); | |
994 externalInterface_SetCO2State(0); | |
995 break; | |
996 default: | |
997 break; | |
998 } | |
936 } | 999 } |
937 | 1000 |
938 if(pmap[EXT_INTERFACE_SENSOR_CNT-1] == SENSOR_MUX) /* select next sensor if mux is connected */ | 1001 if(pmap[EXT_INTERFACE_SENSOR_CNT-1] == SENSOR_MUX) /* select next sensor if mux is connected */ |
939 { | 1002 { |
940 if(activeUartChannel < MAX_MUX_CHANNEL) | 1003 if(activeUartChannel < MAX_MUX_CHANNEL) |
942 index = ExternalInterface_SelectUsedMuxChannel(activeUartChannel); | 1005 index = ExternalInterface_SelectUsedMuxChannel(activeUartChannel); |
943 if(index != activeUartChannel) | 1006 if(index != activeUartChannel) |
944 { | 1007 { |
945 timeToTrigger = 100; | 1008 timeToTrigger = 100; |
946 activeUartChannel = index; | 1009 activeUartChannel = index; |
947 if(pmap[index + EXT_INTERFACE_MUX_OFFSET] == SENSOR_DIGO2) | 1010 if((pmap[index + EXT_INTERFACE_MUX_OFFSET] == SENSOR_DIGO2) |
1011 || (pmap[index + EXT_INTERFACE_MUX_OFFSET] == SENSOR_CO2)) | |
948 { | 1012 { |
949 uartO2_SetChannel(activeUartChannel); | 1013 uartO2_SetChannel(activeUartChannel); |
1014 externalInterface_CheckBaudrate(SENSOR_MUX); | |
950 UART_MUX_SelectAddress(activeUartChannel); | 1015 UART_MUX_SelectAddress(activeUartChannel); |
1016 externalInterface_CheckBaudrate(pmap[activeUartChannel + EXT_INTERFACE_MUX_OFFSET]); | |
951 } | 1017 } |
952 } | 1018 } |
953 } | 1019 } |
954 } | 1020 } |
955 else | 1021 else |
963 switch (pmap[activeSensorId]) | 1029 switch (pmap[activeSensorId]) |
964 { | 1030 { |
965 case SENSOR_MUX: | 1031 case SENSOR_MUX: |
966 case SENSOR_DIGO2: uartO2_Control(); | 1032 case SENSOR_DIGO2: uartO2_Control(); |
967 break; | 1033 break; |
968 // case SENSOR_CO2: uartCO2_Control(); | 1034 #ifdef ENABLE_CO2_SUPPORT |
1035 case SENSOR_CO2: uartCo2_Control(); | |
969 break; | 1036 break; |
1037 #endif | |
970 default: | 1038 default: |
971 break; | 1039 break; |
972 } | 1040 } |
973 } | 1041 } |
974 } | 1042 } |
975 | 1043 |
976 | 1044 |
977 | 1045 |
978 #if 0 | 1046 #if 0 |
979 #ifdef ENABLE_CO2_SUPPORT | |
980 if(externalInterface_GetUARTProtocol() & (EXT_INTERFACE_UART_CO2 >> 8)) | |
981 { | |
982 UART_HandleCO2Data(); | |
983 } | |
984 #endif | |
985 #ifdef ENABLE_SENTINEL_MODE | 1047 #ifdef ENABLE_SENTINEL_MODE |
986 if(externalInterface_GetUARTProtocol() & (EXT_INTERFACE_UART_SENTINEL >> 8)) | 1048 if(externalInterface_GetUARTProtocol() & (EXT_INTERFACE_UART_SENTINEL >> 8)) |
987 { | 1049 { |
988 UART_HandleSentinelData(); | 1050 UART_HandleSentinelData(); |
989 } | 1051 } |
990 #endif | 1052 #endif |
991 if(externalInterface_GetUARTProtocol() & (EXT_INTERFACE_UART_O2 >> 8)) | |
992 { | |
993 UART_HandleDigitalO2(); | |
994 } | |
995 #endif | 1053 #endif |
996 | 1054 |
997 | 1055 |
998 } | 1056 } |