From 1bcf459db6c93dd07913bac4f81b54205d18b0c2 Mon Sep 17 00:00:00 2001 From: Andrew-71 Date: Sat, 16 Mar 2024 15:36:42 +0300 Subject: [PATCH] Improve logging, bumb version --- GLONASS/UNS.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/GLONASS/UNS.lua b/GLONASS/UNS.lua index c867073..0137d14 100644 --- a/GLONASS/UNS.lua +++ b/GLONASS/UNS.lua @@ -7,12 +7,13 @@ It was made out of project "GLONASS Tower" I wrote back in 2022 after first disc TODO: Bring back cool logging! ]] -local UNS_VERSION = 0 +local UNS_VERSION = 1 -- Simple logging. It's not ideal but will do as a "temporary" solution local function log(message) - term.write(message) + local time_str = os.date('%H:%M ') + term.write(time_str .. message) term.setCursorPos(1, select(2, term.getCursorPos()) + 1) if select(2, term.getCursorPos()) >= select(2, term.getSize()) then term.scroll(1) @@ -46,10 +47,10 @@ else log("error: modems.info file missing") -- TODO: Automatic setup - print("Attempt automatic setup? (Y/n) : ") + print("attempt automatic setup? (Y/n) : ") local ans = read() if ans:lower() == "y" or ans == "" then - log("Not implemented yet, sorry!") + log("not implemented yet, sorry!") else log("nothing to do") os.exit() @@ -78,7 +79,7 @@ while true do event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message") until channel == gps.CHANNEL_GPS and message == "PING" - log("recieved location request, d-" .. distance) + log("recieved location request, d-" .. string.format("%.3f", distance)) for _, modem in ipairs(modems) do modem.modem.transmit(channel, replyChannel, modem.pos) log("modem <" .. modem.id .. "> transmitted location")