From ea90a860e9ebe694ae63df0022582eb03a0b3ddc Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Thu, 26 Mar 2026 16:19:25 -0400 Subject: [PATCH] refactor: enhance channel message handling with dual-mode support for legacy and target channels --- pocketcontrol.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pocketcontrol.lua b/pocketcontrol.lua index edb9fe8..bedfad8 100644 --- a/pocketcontrol.lua +++ b/pocketcontrol.lua @@ -579,7 +579,9 @@ parallel.waitForAny( while true do local event, side, channel, replyChannel, message = os.pullEvent("modem_message") - if channel == STATUS_CHANNEL and type(message) == "table" then + -- Uses Channels.match() for dual-mode safety: accepts messages on + -- both legacy (102/103) and target (4212/4213) channels during migration. + if Channels.match('remoteturtle.status', channel) and type(message) == "table" then if message.type == "status" then -- Update turtle list local found = false @@ -595,7 +597,7 @@ parallel.waitForAny( addLog("Turtle #" .. message.turtleID .. " connected", colors.lime) end end - elseif channel == POCKET_CHANNEL and type(message) == "table" then + elseif Channels.match('remoteturtle.pocket', channel) and type(message) == "table" then -- Handle responses from webbridge if message.type == "webbridge_status" then webbridgeStatus = message.data