From a9d016422e21debcdf0e4a319e73b2fe20489560 Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Wed, 22 Apr 2026 20:14:06 +0200 Subject: [PATCH] dont find 0xff --- scripts/98-uecp.lua | 8 +------- src/udp_server.c | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/scripts/98-uecp.lua b/scripts/98-uecp.lua index d86357c..b04d4e9 100644 --- a/scripts/98-uecp.lua +++ b/scripts/98-uecp.lua @@ -236,13 +236,7 @@ end ---@param packet string function uecp.parse_uecp(packet) - local end_i = string.find(packet, "\xff", 1, true) - if not end_i then - print("could not find 0xff") - return - end - - local unstuffed = undo_byte_stuff(string.sub(packet, 2, end_i - 1)) + local unstuffed = undo_byte_stuff(string.sub(packet, 2, #packet - 1)) local addr1 = string.byte(unstuffed, 1) local addr2 = string.byte(unstuffed, 2) diff --git a/src/udp_server.c b/src/udp_server.c index aed40b1..ea7a123 100644 --- a/src/udp_server.c +++ b/src/udp_server.c @@ -49,7 +49,6 @@ void poll_udp_server() { for (ssize_t i = 0; i < bytes_read; i++) { if (buf[i] == '\n' || (unsigned char)buf[i] == 0xFF) { size_t len = i - start; - if((unsigned char)buf[i] == 0xFF) len += 1; if (len > 0 && len < BUF_SIZE) { memset(cmd_buf, 0, BUF_SIZE);