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.write(string.format(" Turtle #%-3d", id))
|
||||||
|
|
||||||
monitor.setTextColor(colors.lightGray)
|
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
|
if #state > 12 then state = state:sub(1, 12) end
|
||||||
monitor.write(" " .. state)
|
monitor.write(" " .. state)
|
||||||
|
|
||||||
@@ -429,7 +429,7 @@ while true do
|
|||||||
end
|
end
|
||||||
print(" Total turtles tracked: " .. count)
|
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
|
-- Forward to web server
|
||||||
local success = sendToServer(message)
|
local success = sendToServer(message)
|
||||||
@@ -458,14 +458,14 @@ while true do
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
if success and result then
|
if success and result then
|
||||||
modem.transmit(CHANNEL_RECEIVE, CHANNEL_RECEIVE, {
|
modem.transmit(COMMAND_CHANNEL, CHANNEL_RECEIVE, {
|
||||||
type = "home_position",
|
type = "home_position",
|
||||||
turtleID = turtleID,
|
turtleID = turtleID,
|
||||||
homePosition = result.homePosition
|
homePosition = result.homePosition
|
||||||
})
|
})
|
||||||
addLog(" -> Sent home position", colors.lime)
|
addLog(" -> Sent home position", colors.lime)
|
||||||
else
|
else
|
||||||
modem.transmit(CHANNEL_RECEIVE, CHANNEL_RECEIVE, {
|
modem.transmit(COMMAND_CHANNEL, CHANNEL_RECEIVE, {
|
||||||
type = "home_position",
|
type = "home_position",
|
||||||
turtleID = turtleID,
|
turtleID = turtleID,
|
||||||
homePosition = nil
|
homePosition = nil
|
||||||
@@ -495,14 +495,14 @@ while true do
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
if success and result and result.success then
|
if success and result and result.success then
|
||||||
modem.transmit(CHANNEL_RECEIVE, CHANNEL_RECEIVE, {
|
modem.transmit(COMMAND_CHANNEL, CHANNEL_RECEIVE, {
|
||||||
type = "home_set_confirm",
|
type = "home_set_confirm",
|
||||||
turtleID = turtleID,
|
turtleID = turtleID,
|
||||||
homePosition = result.homePosition
|
homePosition = result.homePosition
|
||||||
})
|
})
|
||||||
addLog(" -> Home saved to server", colors.lime)
|
addLog(" -> Home saved to server", colors.lime)
|
||||||
else
|
else
|
||||||
modem.transmit(CHANNEL_RECEIVE, CHANNEL_RECEIVE, {
|
modem.transmit(COMMAND_CHANNEL, CHANNEL_RECEIVE, {
|
||||||
type = "home_set_confirm",
|
type = "home_set_confirm",
|
||||||
turtleID = turtleID,
|
turtleID = turtleID,
|
||||||
homePosition = position
|
homePosition = position
|
||||||
|
|||||||
Reference in New Issue
Block a user