From 91918bd124758bdf2b1514039918840c2f2f626d Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Fri, 20 Feb 2026 00:48:19 -0500 Subject: [PATCH] feat: Enhance command processing feedback in turtle; improve sleep duration for command acknowledgment in webbridge --- turtle.lua | 8 ++++++-- webbridge.lua | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) 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