feat: Enhance command processing feedback in turtle; improve sleep duration for command acknowledgment in webbridge
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user