comparison Small_CPU/Src/uartProtocol_Sentinel.c @ 860:3e499569baf3 Evo_2_23

Code cleanup
author Ideenmodellierer
date Tue, 07 May 2024 21:20:56 +0200
parents c3dd461ca3f9
children effadaa3a1f7
comparison
equal deleted inserted replaced
859:d32901746950 860:3e499569baf3
70 { 70 {
71 static uint8_t dataType = 0; 71 static uint8_t dataType = 0;
72 static uint32_t dataValue[3]; 72 static uint32_t dataValue[3];
73 static uint8_t dataValueIdx = 0; 73 static uint8_t dataValueIdx = 0;
74 74
75 static uint8_t lastAlive = 0;
76 static uint8_t curAlive = 0;
77 static uint8_t checksum = 0; 75 static uint8_t checksum = 0;
78 static char checksum_str[]="00"; 76 static char checksum_str[]="00";
79 77
80 uint8_t activeSensor = externalInterface_GetActiveUartSensor(); 78 uint8_t activeSensor = externalInterface_GetActiveUartSensor();
81 uartSentinelStatus_t localComState = externalInterface_GetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET); 79 uartSentinelStatus_t localComState = externalInterface_GetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET);
83 switch(rxState) 81 switch(rxState)
84 { 82 {
85 case SENTRX_Ready: if((data >= 'a') && (data <= 'z')) 83 case SENTRX_Ready: if((data >= 'a') && (data <= 'z'))
86 { 84 {
87 rxState = SENTRX_DetectStart; 85 rxState = SENTRX_DetectStart;
88 curAlive = data;
89 checksum = 0; 86 checksum = 0;
90 } 87 }
91 break; 88 break;
92 89
93 case SENTRX_DetectStart: checksum += data; 90 case SENTRX_DetectStart: checksum += data;
174 { 171 {
175 setExternalInterfaceChannel(0,(float)(dataValue[0] / 10.0)); 172 setExternalInterfaceChannel(0,(float)(dataValue[0] / 10.0));
176 setExternalInterfaceChannel(1,(float)(dataValue[1] / 10.0)); 173 setExternalInterfaceChannel(1,(float)(dataValue[1] / 10.0));
177 setExternalInterfaceChannel(2,(float)(dataValue[2] / 10.0)); 174 setExternalInterfaceChannel(2,(float)(dataValue[2] / 10.0));
178 SentinelConnected = 1; 175 SentinelConnected = 1;
179 lastAlive = curAlive;
180 localComState = UART_SENTINEL_OPERATING; 176 localComState = UART_SENTINEL_OPERATING;
181 } 177 }
182 rxState = SENTRX_Ready; 178 rxState = SENTRX_Ready;
183 break; 179 break;
184 180