feat: Enhance command processing feedback in turtle; improve sleep duration for command acknowledgment in webbridge

This commit is contained in:
MayaTheShy
2026-02-20 00:48:19 -05:00
parent 8d43c0dc99
commit 91918bd124
2 changed files with 8 additions and 3 deletions

View File

@@ -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

View File

@@ -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