Mercurial > public > ostc4
annotate Small_CPU/Src/uartProtocol_Sentinel.c @ 1065:1f2067cad41b Icon_Integration
Mixed sensor operation improvment:
A peak detector has been added to the adc measurement to avoid interferance while UART sensor are taking measurement while adc is active. The previous approach to shift adc into time windows where no UART were active had to be replaced because for the CO2 sensor is continously taking samples without providing a sync signal.
In addition the UART MUX switching behavior has been improved (potential rx data received from previous sensor is discarded during channel switch etc.)
| author | Ideenmodellierer |
|---|---|
| date | Mon, 16 Feb 2026 21:27:26 +0100 |
| parents | 785772303f9c |
| children |
| rev | line source |
|---|---|
|
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
1 /** |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
2 ****************************************************************************** |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
3 * @file uartProtocol_Co2.c |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
4 * @author heinrichs weikamp gmbh |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
5 * @version V0.0.1 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
6 * @date 15-Jan-2024 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
7 * @brief Interface functionality to read data from Sentinel rebreather |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
8 * |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
9 @verbatim |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
10 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
11 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
12 @endverbatim |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
13 ****************************************************************************** |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
14 * @attention |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
15 * |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
16 * <h2><center>© COPYRIGHT(c) 2024 heinrichs weikamp</center></h2> |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
17 * |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
18 ****************************************************************************** |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
19 */ |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
20 /* Includes ------------------------------------------------------------------*/ |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
21 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
22 #include <string.h> |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
23 #include <uartProtocol_Sentinel.h> |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
24 #include "uart.h" |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
25 #include "externalInterface.h" |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
26 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
27 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
28 #ifdef ENABLE_SENTINEL_MODE |
| 1062 | 29 static uint8_t SentinelConnected = 0; /* Binary indicator if a sensor (and what type of subsensor) is connected or not */ |
|
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
30 static receiveStateSentinel_t rxState = SENTRX_Ready; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
31 |
| 932 | 32 extern sUartComCtrl Uart1Ctrl; |
| 33 | |
|
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
34 void ConvertByteToHexString(uint8_t byte, char* str) |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
35 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
36 uint8_t worker = 0; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
37 uint8_t digit = 0; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
38 uint8_t digitCnt = 1; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
39 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
40 worker = byte; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
41 while((worker!=0) && (digitCnt != 255)) |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
42 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
43 digit = worker % 16; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
44 if( digit < 10) |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
45 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
46 digit += '0'; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
47 } |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
48 else |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
49 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
50 digit += 'A' - 10; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
51 } |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
52 str[digitCnt--]= digit; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
53 worker = worker / 16; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
54 } |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
55 } |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
56 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
57 void uartSentinel_Control(void) |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
58 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
59 uint8_t activeSensor = externalInterface_GetActiveUartSensor(); |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
60 uartSentinelStatus_t localComState = externalInterface_GetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET); |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
61 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
62 if(localComState == UART_SENTINEL_INIT) |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
63 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
64 SentinelConnected = 0; |
| 932 | 65 UART_StartDMA_Receiption(&Uart1Ctrl); |
|
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
66 localComState = UART_SENTINEL_IDLE; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
67 } |
| 1062 | 68 if(localComState == UART_SENTINEL_IDLE) |
| 69 { | |
| 70 localComState = UART_SENTINEL_OPERATING; /* state is only used for timeout detection */ | |
| 71 } | |
|
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
72 externalInterface_SetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET,localComState); |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
73 } |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
74 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
75 void uartSentinel_ProcessData(uint8_t data) |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
76 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
77 static uint8_t dataType = 0; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
78 static uint32_t dataValue[3]; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
79 static uint8_t dataValueIdx = 0; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
80 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
81 static uint8_t checksum = 0; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
82 static char checksum_str[]="00"; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
83 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
84 uint8_t activeSensor = externalInterface_GetActiveUartSensor(); |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
85 uartSentinelStatus_t localComState = externalInterface_GetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET); |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
86 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
87 switch(rxState) |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
88 { |
| 1062 | 89 case SENTRX_Ready: if((data >= 'a') && (data <= 'z')) /* Alive byte */ |
|
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
90 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
91 rxState = SENTRX_DetectStart; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
92 checksum = 0; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
93 } |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
94 break; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
95 |
| 1062 | 96 case SENTRX_DetectStart: checksum += data; /* data available */ |
|
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
97 if(data == '1') |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
98 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
99 rxState = SENTRX_SelectData; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
100 dataType = 0xFF; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
101 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
102 } |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
103 else |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
104 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
105 rxState = SENTRX_Ready; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
106 } |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
107 break; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
108 |
| 1062 | 109 case SENTRX_SelectData: checksum += data; /* data type */ |
|
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
110 switch(data) |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
111 { |
| 1062 | 112 case UART_SENTINEL_PRESSURE_O2: /* no '0' spacing for pressure sensors */ |
| 113 case UART_SENTINEL_PRESSURE_D: dataType = data; | |
| 114 rxState = SENTRX_Data0; | |
| 115 dataValueIdx = 0; | |
| 116 dataValue[0] = 0; | |
|
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
117 break; |
| 1062 | 118 case UART_SENTINEL_O2_P: |
| 119 case UART_SENTINEL_O2_S: | |
| 120 case UART_SENTINEL_TEMPSTICK: dataType = data; | |
| 121 break; | |
| 122 | |
|
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
123 case '0': if(dataType != 0xff) |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
124 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
125 rxState = SENTRX_Data0; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
126 dataValueIdx = 0; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
127 dataValue[0] = 0; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
128 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
129 } |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
130 else |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
131 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
132 rxState = SENTRX_Ready; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
133 } |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
134 break; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
135 default: rxState = SENTRX_Ready; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
136 } |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
137 break; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
138 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
139 case SENTRX_Data0: |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
140 case SENTRX_Data1: |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
141 case SENTRX_Data2: |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
142 case SENTRX_Data4: |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
143 case SENTRX_Data5: |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
144 case SENTRX_Data6: |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
145 case SENTRX_Data8: |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
146 case SENTRX_Data9: |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
147 case SENTRX_Data10: checksum += data; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
148 if((data >= '0') && (data <= '9')) |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
149 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
150 dataValue[dataValueIdx] = dataValue[dataValueIdx] * 10 + (data - '0'); |
| 1062 | 151 if((rxState == SENTRX_Data2) && ((dataType == UART_SENTINEL_PRESSURE_O2) || (dataType == UART_SENTINEL_PRESSURE_D))) |
| 152 { | |
| 153 rxState = SENTRX_CheckSum; | |
| 154 } | |
| 155 else | |
| 156 { | |
| 157 rxState++; | |
| 158 } | |
|
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
159 } |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
160 else |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
161 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
162 rxState = SENTRX_Ready; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
163 } |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
164 break; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
165 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
166 case SENTRX_Data3: |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
167 case SENTRX_Data7: checksum += data; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
168 if(data == '0') |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
169 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
170 dataValueIdx++; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
171 dataValue[dataValueIdx] = 0; |
| 1062 | 172 rxState++; |
|
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
173 } |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
174 else |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
175 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
176 rxState = SENTRX_Ready; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
177 } |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
178 break; |
| 1062 | 179 case SENTRX_CheckSum: ConvertByteToHexString(checksum,checksum_str); |
| 180 if(data == checksum_str[0]) | |
| 181 { | |
| 182 rxState = SENTRX_DataComplete; | |
| 183 } | |
| 184 else | |
| 185 { | |
| 186 rxState = SENTRX_Ready; | |
| 187 } | |
|
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
188 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
189 break; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
190 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
191 case SENTRX_DataComplete: if(data == checksum_str[1]) |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
192 { |
| 1062 | 193 switch(dataType) |
| 194 { | |
| 195 case UART_SENTINEL_O2_P: setExternalInterfaceChannel(0,(float)(dataValue[0] / 10.0)); | |
| 196 setExternalInterfaceChannel(1,(float)(dataValue[1] / 10.0)); | |
| 197 setExternalInterfaceChannel(2,(float)(dataValue[2] / 10.0)); | |
| 198 SentinelConnected |= SENTINEL_O2; | |
| 199 break; | |
| 200 case UART_SENTINEL_PRESSURE_O2: externalInterface_SetBottlePressure(0,dataValue[0]); | |
| 201 SentinelConnected |= SENTINEL_PRESSURE; | |
| 202 break; | |
| 203 case UART_SENTINEL_PRESSURE_D: externalInterface_SetBottlePressure(1,dataValue[0]); | |
| 204 SentinelConnected |= SENTINEL_PRESSURE; | |
| 205 break; | |
| 206 case UART_SENTINEL_TEMPSTICK: SentinelConnected |= SENTINEL_TEMPSTICK; | |
| 207 } | |
| 208 localComState = UART_SENTINEL_IDLE; | |
|
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
209 } |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
210 rxState = SENTRX_Ready; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
211 break; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
212 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
213 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
214 default: rxState = SENTRX_Ready; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
215 break; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
216 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
217 } |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
218 externalInterface_SetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET,localComState); |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
219 } |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
220 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
221 uint8_t uartSentinel_isSensorConnected() |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
222 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
223 return SentinelConnected; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
224 } |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
225 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
226 #endif |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
227 |
