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,