fix: Enhance message logging for modem events and status updates
This commit is contained in:
@@ -60,9 +60,18 @@ end
|
||||
while true do
|
||||
local event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message")
|
||||
|
||||
if channel == STATUS_CHANNEL and type(message) == "table" then
|
||||
print("Received modem message on channel " .. channel)
|
||||
|
||||
if type(message) == "table" then
|
||||
print(" Message type: " .. (message.type or "no type"))
|
||||
print(" Turtle ID: " .. tostring(message.turtleID))
|
||||
else
|
||||
print(" Message is not a table, it's: " .. type(message))
|
||||
end
|
||||
|
||||
if channel == STATUS_CHANNEL and type(message) == "table" and message.type == "status" then
|
||||
-- Status update from turtle
|
||||
print("Status from Turtle " .. (message.turtleID or "?"))
|
||||
print("✓ Valid status from Turtle " .. (message.turtleID or "?"))
|
||||
|
||||
-- Update local cache
|
||||
turtles[message.turtleID] = message
|
||||
|
||||
Reference in New Issue
Block a user