This commit is contained in:
Laurie Fisher 2025-06-27 14:21:57 +01:00
parent 353d13fee8
commit b8ceaf1da0
Signed by: PinkEyedOrphan
GPG Key ID: 7F827B68147AEE76
2 changed files with 6 additions and 7 deletions

View File

@ -1,5 +1,6 @@
local M = {} local M = {}
local logger = require("logger")
local currentStatus = "idle" local currentStatus = "idle"
function M.getStatus() function M.getStatus()
@ -9,12 +10,14 @@ end
function M.run() function M.run()
while true do while true do
currentStatus = "moving backward" currentStatus = "moving backward"
logger.log("Started moving backward")
for i = 1, 10 do for i = 1, 10 do
turtle.back() turtle.back()
sleep(0.5) sleep(0.5)
end end
currentStatus = "moving forward" currentStatus = "moving forward"
logger.log("Started moving forward")
for i = 1, 10 do for i = 1, 10 do
turtle.forward() turtle.forward()
sleep(0.5) sleep(0.5)

View File

@ -1,4 +1,5 @@
local M = {} local M = {}
local logger = require("logger")
local modemOpened = false local modemOpened = false
for _, side in ipairs({"top", "bottom", "left", "right", "front", "back"}) do for _, side in ipairs({"top", "bottom", "left", "right", "front", "back"}) do
@ -10,8 +11,7 @@ for _, side in ipairs({"top", "bottom", "left", "right", "front", "back"}) do
end end
if not modemOpened then if not modemOpened then
print("No modem found!") logger.log("No modem found. Cannot report status.")
end end
local id = os.getComputerID() local id = os.getComputerID()
@ -27,11 +27,7 @@ function M.reportStatus(getStatusFn)
time = os.time() time = os.time()
} }
rednet.broadcast(textutils.serialize(msg), "turtle_status") rednet.broadcast(textutils.serialize(msg), "turtle_status")
logger.log("Broadcasted status: " .. status)
-- Optional: print for debug
term.setCursorPos(1, 5)
term.clearLine()
print("Broadcasted: " .. status .. " @ " .. textutils.formatTime(os.time(), true))
sleep(2) sleep(2)
end end