State change bug fix
This commit is contained in:
parent
862c52f567
commit
126f8d0ba6
6
main2.c
6
main2.c
@ -189,9 +189,13 @@ static void stream_step(const uint8_t *newbuf, size_t newsz) {
|
|||||||
Stream.state = STREAMING;
|
Stream.state = STREAMING;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
static const uint8_t rootEl[4] = "\x1A\x45\xDF\xA3";
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < newsz; i++) {
|
for(i = 0; i < newsz; i++) {
|
||||||
if(newbuf[i] == "\x1A\x45\xDF\xA3"[Stream.stateChangeIdx]) {
|
if(newbuf[i] == rootEl[0]) {
|
||||||
|
Stream.stateChangeIdx = 1;
|
||||||
|
} else if(newbuf[i] == rootEl[Stream.stateChangeIdx]) {
|
||||||
Stream.stateChangeIdx++;
|
Stream.stateChangeIdx++;
|
||||||
|
|
||||||
if(Stream.stateChangeIdx == 4) {
|
if(Stream.stateChangeIdx == 4) {
|
||||||
|
Loading…
Reference in New Issue
Block a user