feat: Enhance message logging in webbridge; add detailed output for received status updates and turtle tracking

This commit is contained in:
MayaTheShy
2026-02-20 00:56:03 -05:00
parent 922e6ab25d
commit b1d68565cd

View File

@@ -387,13 +387,31 @@ while true do
stats.messagesReceived = stats.messagesReceived + 1
if type(message) == "table" then
-- Debug: log what type of message we got
print("📨 Received message on channel " .. channel)
if message.type then
print(" Type: " .. message.type)
end
if message.turtleID then
print(" From turtle: " .. message.turtleID)
end
if message.type == "status" then
local turtleID = message.turtleID
print("✅ Processing status update from Turtle #" .. turtleID)
-- Update turtle data
turtles[turtleID] = message
turtles[turtleID].lastSeen = os.epoch("utc")
-- Count turtles
local count = 0
for _ in pairs(turtles) do
count = count + 1
end
print(" Total turtles tracked: " .. count)
addLog("Turtle #" .. turtleID .. " - " .. (message.state or "status"), colors.lightBlue)
-- Forward to web server