From f1c8f082726340195d5fb0a7cc0e5bdb89bb268a Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Thu, 26 Mar 2026 16:19:33 -0400 Subject: [PATCH] refactor: enhance status message handling for dual-mode channel compatibility --- pocketremote.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pocketremote.lua b/pocketremote.lua index bca8fdd..660b9a5 100644 --- a/pocketremote.lua +++ b/pocketremote.lua @@ -631,10 +631,12 @@ parallel.waitForAny( end, function() -- Status receiver + -- Uses Channels.match() for dual-mode safety: accepts status on + -- both legacy (102) and target (4212) channels during migration. while true do local event, side, channel, replyChannel, message = os.pullEvent("modem_message") - if channel == STATUS_CHANNEL and type(message) == "table" and message.type == "status" then + if Channels.match('remoteturtle.status', channel) and type(message) == "table" and message.type == "status" then -- Update or add turtle local found = false for i, t in ipairs(turtles) do @@ -660,7 +662,7 @@ parallel.waitForAny( end draw() - elseif channel == CHANNEL_RECEIVE and type(message) == "table" then + elseif Channels.match('remoteturtle.response', channel) and type(message) == "table" then -- State change confirmation or other response if message.type == "state_changed" and message.turtleID then for i, t in ipairs(turtles) do