refactor: optimize polling interval and command transmission for improved responsiveness

This commit is contained in:
MayaTheShy
2026-02-20 03:53:40 -05:00
parent 7da9c1d0d8
commit 53ae92a184

View File

@@ -305,7 +305,7 @@ for i = 0, 65535 do
end
-- Start polling timer
local POLL_INTERVAL = 2 -- Poll every 2 seconds (reduced frequency for better reliability)
local POLL_INTERVAL = 1 -- Poll every 1 second for responsive command execution
os.startTimer(POLL_INTERVAL)
-- Track which turtles we've sent commands to recently
@@ -360,15 +360,15 @@ while true do
addLog(" CMD: " .. cmd.command .. " -> T#" .. turtleID, colors.yellow)
end
-- Send command multiple times for reliability
for i = 1, 3 do
-- Send command twice for reliability
for i = 1, 2 do
modem.transmit(COMMAND_CHANNEL, CHANNEL_RECEIVE, commandPacket)
os.sleep(0.05)
end
end
-- Acknowledge that we sent the commands
os.sleep(1.5)
os.sleep(0.3)
if acknowledgeCommands(turtleID) then
addLog(" ACK: Commands acknowledged", colors.lime)
else