diff --git a/turtle.lua b/turtle.lua index db32c7d..95aa52e 100644 --- a/turtle.lua +++ b/turtle.lua @@ -903,11 +903,13 @@ local function processMessage(message) if message.command then print(" Command: " .. message.command) + print(" Available handlers: " .. textutils.serialize(table.keys or function(t) local k={} for n in pairs(t) do table.insert(k,n) end return k end)(commands)) local handler = commands[message.command] if handler then - print(" Executing command...") + print(" ✅ Executing command: " .. message.command) local success, result = handler(message.param) + print(" Result: success=" .. tostring(success) .. ", msg=" .. tostring(result)) modem.transmit(CHANNEL_SEND, CHANNEL_RECEIVE, { status = success and "ok" or "error", @@ -917,8 +919,10 @@ local function processMessage(message) broadcastStatus() else - print(" No handler found for command: " .. message.command) + print(" ❌ No handler found for command: " .. message.command) end + else + print(" ❌ No command in message") end end diff --git a/webbridge.lua b/webbridge.lua index d2b6a2a..38d54c4 100644 --- a/webbridge.lua +++ b/webbridge.lua @@ -335,7 +335,8 @@ while true do end -- Acknowledge that we sent the commands - os.sleep(0.5) -- Give turtle time to receive + -- Wait longer to ensure turtle has received them + os.sleep(1.5) -- Give turtle time to receive and process if acknowledgeCommands(turtleID) then addLog(" ACK: Commands acknowledged", colors.lime) else