fix: Update turtle state references to use mode instead; adjust command transmission channels
This commit is contained in:
@@ -148,7 +148,7 @@ local function drawDashboard()
|
||||
monitor.write(string.format(" Turtle #%-3d", id))
|
||||
|
||||
monitor.setTextColor(colors.lightGray)
|
||||
local state = (turtle.state or "IDLE"):upper()
|
||||
local state = (turtle.mode or "IDLE"):upper()
|
||||
if #state > 12 then state = state:sub(1, 12) end
|
||||
monitor.write(" " .. state)
|
||||
|
||||
@@ -429,7 +429,7 @@ while true do
|
||||
end
|
||||
print(" Total turtles tracked: " .. count)
|
||||
|
||||
addLog("Turtle #" .. turtleID .. " - " .. (message.state or "status"), colors.lightBlue)
|
||||
addLog("Turtle #" .. turtleID .. " - " .. (message.mode or "status"), colors.lightBlue)
|
||||
|
||||
-- Forward to web server
|
||||
local success = sendToServer(message)
|
||||
@@ -458,14 +458,14 @@ while true do
|
||||
end)
|
||||
|
||||
if success and result then
|
||||
modem.transmit(CHANNEL_RECEIVE, CHANNEL_RECEIVE, {
|
||||
modem.transmit(COMMAND_CHANNEL, CHANNEL_RECEIVE, {
|
||||
type = "home_position",
|
||||
turtleID = turtleID,
|
||||
homePosition = result.homePosition
|
||||
})
|
||||
addLog(" -> Sent home position", colors.lime)
|
||||
else
|
||||
modem.transmit(CHANNEL_RECEIVE, CHANNEL_RECEIVE, {
|
||||
modem.transmit(COMMAND_CHANNEL, CHANNEL_RECEIVE, {
|
||||
type = "home_position",
|
||||
turtleID = turtleID,
|
||||
homePosition = nil
|
||||
@@ -495,14 +495,14 @@ while true do
|
||||
end)
|
||||
|
||||
if success and result and result.success then
|
||||
modem.transmit(CHANNEL_RECEIVE, CHANNEL_RECEIVE, {
|
||||
modem.transmit(COMMAND_CHANNEL, CHANNEL_RECEIVE, {
|
||||
type = "home_set_confirm",
|
||||
turtleID = turtleID,
|
||||
homePosition = result.homePosition
|
||||
})
|
||||
addLog(" -> Home saved to server", colors.lime)
|
||||
else
|
||||
modem.transmit(CHANNEL_RECEIVE, CHANNEL_RECEIVE, {
|
||||
modem.transmit(COMMAND_CHANNEL, CHANNEL_RECEIVE, {
|
||||
type = "home_set_confirm",
|
||||
turtleID = turtleID,
|
||||
homePosition = position
|
||||
|
||||
Reference in New Issue
Block a user