File tree 1 file changed +6
-11
lines changed
1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -43,18 +43,18 @@ bool gatewayTransportInit() {
43
43
44
44
45
45
bool gatewayTransportAvailable () {
46
- bool available = false ;
47
-
48
46
while (MY_SERIALDEVICE.available ()) {
49
47
// get the new byte:
50
48
char inChar = (char ) MY_SERIALDEVICE.read ();
51
49
// if the incoming character is a newline, set a flag
52
50
// so the main loop can do something about it:
53
- if (_serialInputPos < MY_GATEWAY_MAX_RECEIVE_LENGTH - 1 && !available ) {
51
+ if (_serialInputPos < MY_GATEWAY_MAX_RECEIVE_LENGTH - 1 ) {
54
52
if (inChar == ' \n ' ) {
55
53
_serialInputString[_serialInputPos] = 0 ;
56
- available = true ;
57
- return true ;
54
+ bool ok = protocolParse (_serialMsg, _serialInputString);
55
+ if (ok)
56
+ _serialInputPos = 0 ;
57
+ return ok;
58
58
} else {
59
59
// add it to the inputString:
60
60
_serialInputString[_serialInputPos] = inChar;
@@ -65,12 +65,7 @@ bool gatewayTransportAvailable() {
65
65
_serialInputPos = 0 ;
66
66
}
67
67
}
68
- if (available) {
69
- // Parse message and return parse result
70
- available = protocolParse (_serialMsg, _serialInputString);
71
- _serialInputPos = 0 ;
72
- }
73
- return available;
68
+ return false ;
74
69
}
75
70
76
71
MyMessage & gatewayTransportReceive () {
You can’t perform that action at this time.
0 commit comments