1
0
mirror of synced 2024-11-30 18:34:38 +01:00

没意义的修改。

This commit is contained in:
Sucareto 2021-12-07 19:41:50 +08:00 committed by GitHub
parent 313e4a3648
commit 872963d9f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,12 +58,11 @@ static uint8_t packet_read() {
r = SerialDevice.read(); r = SerialDevice.read();
if (r == 0xE0) { if (r == 0xE0) {
req.frame_len = 0xFF; req.frame_len = 0xFF;
len = 0;
continue; continue;
} }
if (req.frame_len == 0xFF) { if (req.frame_len == 0xFF) {
req.frame_len = r; req.frame_len = r;
len = 1; len = 0;
checksum = r; checksum = r;
continue; continue;
} }
@ -75,10 +74,10 @@ static uint8_t packet_read() {
r++; r++;
escape = false; escape = false;
} }
req.bytes[++len] = r;
if (len == req.frame_len && checksum == r) { if (len == req.frame_len && checksum == r) {
return req.cmd; return req.cmd;
} }
req.bytes[len++] = r;
checksum += r; checksum += r;
} }
return 0; return 0;