The counter variable in cmd_proc() must be static (to persist its value across method invocations.) This won't necessarily manifest itself as an issue all the while serial data is being streamed fast enough to keep it in the inner "while(Serial.available())" loop. However, when this is not the case (which happened with us) the counter resets itself to 0 on every repeat of the cmd_proc() method. This then overwrites the contents of the buffer from 0, resulting in no valid commands (potentially in rare cases, corrupted but syntactically valid commands could also manifest.)
parent
4ee5c3223d
commit
1d74f24528
|
@ -154,7 +154,7 @@ void cmd_proc(int &stepAz, int &stepEl)
|
|||
char incomingByte;
|
||||
char *p=buffer;
|
||||
char *str;
|
||||
int counter=0;
|
||||
static int counter=0;
|
||||
char data[100];
|
||||
|
||||
double angleAz,angleEl;
|
||||
|
|
Loading…
Reference in New Issue