From e3a47884407f33487a670d25ade2d5764c018457 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Mon, 16 Feb 2026 01:15:08 -0500 Subject: [PATCH] fix: Enhance message processing with detailed logging for incoming commands --- turtle.lua | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/turtle.lua b/turtle.lua index 2fdc8a9..d667855 100644 --- a/turtle.lua +++ b/turtle.lua @@ -534,8 +534,18 @@ local commands = { -- Process incoming messages local function processMessage(message) + print("Received message on modem") + print(" Type: " .. type(message)) + + if type(message) == "table" then + print(" Has command: " .. tostring(message.command ~= nil)) + if message.command then + print(" Command: " .. message.command) + end + end + if type(message) == "table" and message.command then - print("Command: " .. message.command) + print("Processing command: " .. message.command) local handler = commands[message.command] if handler then @@ -548,6 +558,8 @@ local function processMessage(message) }) broadcastStatus() + else + print(" No handler found for command: " .. message.command) end end end @@ -595,7 +607,10 @@ parallel.waitForAny( local event, side, channel, replyChannel, message = os.pullEvent() if event == "modem_message" then - processMessage(message) + print("Modem message on channel " .. channel) + if channel == CHANNEL_RECEIVE then + processMessage(message) + end end end end,