State change bug fix

This commit is contained in:
Mid 2025-08-31 20:10:51 +03:00
parent 862c52f567
commit 126f8d0ba6

View File

@ -189,9 +189,13 @@ static void stream_step(const uint8_t *newbuf, size_t newsz) {
Stream.state = STREAMING;
}
} else {
static const uint8_t rootEl[4] = "\x1A\x45\xDF\xA3";
int 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++;
if(Stream.stateChangeIdx == 4) {