From: Nathaniel Wesley Filardo Date: Sun, 4 Nov 2018 17:16:18 +0000 (+0000) Subject: Always use a prefix tag when printing log messages X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=470295ef7f5c6580f2ac2db1ca11c52d6430a32f;p=acmetensortoys-esp-lua_ctfws Always use a prefix tag when printing log messages --- diff --git a/ctfws-lfs-strings.lua b/ctfws-lfs-strings.lua index 58fea80..392f90b 100644 --- a/ctfws-lfs-strings.lua +++ b/ctfws-lfs-strings.lua @@ -10,7 +10,8 @@ local ctfws = "ctfws", "ctfws_lcd", "ctfws_tmr", "GAME NOT CONFIGURED!", "GAME OVER @ %02d:%02d", "START TIME IN FUTURE", - "TIME IS UP" + "TIME IS UP", + "CTFWS" local lcdpreload = "define_char", diff --git a/init2.lua b/init2.lua index 5c5687b..ec0d9dc 100644 --- a/init2.lua +++ b/init2.lua @@ -8,10 +8,10 @@ end file.remove("luac.out.stage") -- remove stage file from last attempt -- Do we have a new LFS blob? If so, install it. if file.exists("luac.out") then - print("Updating LFS image. Will reboot if things go well.") + print("INIT2","Updating LFS image. Will reboot if things go well.") file.rename("luac.out", "luac.out.stage") node.flashreload("luac.out.stage") - error("Failed to update LFS!") + error("INIT2", "Failed to update LFS!") end -- It's early in boot, so we have plenty of RAM. Compile @@ -25,16 +25,16 @@ if file.open("ctfws-misc.conf","r") then local conf = sjson.decode(file.read() or "") if type(conf) == "table" then ctfwshw = conf - else print("ctfws-misc.conf malformed") + else print("INIT2", "ctfws-misc.conf malformed") end end -- Hardware initialization -print("init2 hw") +print("INIT2", "hw") wifi.sta.sleeptype(wifi.NONE_SLEEP) -- don't power down radio gpio.mode(5,gpio.OUTPUT) -- beeper on GPIO14 i2c.setup(0,2,1,i2c.SLOW) -- init i2c on GPIO4 and GPIO5 lcd = OVL.lcd1602()(ctfwshw.lcd or 0x27) -- give the LCD time to initialize properly -tmr.create():alarm(125, tmr.ALARM_SINGLE, function() print("init2 go3") OVL.init3() end) +tmr.create():alarm(125, tmr.ALARM_SINGLE, function() print("INIT2", "go3") OVL.init3() end) diff --git a/init3.lua b/init3.lua index 39cebd1..3859712 100644 --- a/init3.lua +++ b/init3.lua @@ -22,7 +22,7 @@ ctfws_lcd:drawFlagsMessage("BOOT...") -- MQTT plumbing mqc, mqttUser = OVL.nwfmqtt().mkclient("nwfmqtt.conf") if mqc == nil then - print("You forgot your MQTT configuration file") + print("CTFWS", "You forgot your MQTT configuration file") end local mqttBootTopic = string.format("ctfws/dev/%s/beat",mqttUser) mqc:lwt(mqttBootTopic,"dead",1,1) @@ -37,7 +37,7 @@ local myBSSID = "00:00:00:00:00:00" local mqtt_reconn_cronentry local function mqtt_reconn() - dprint("Trying reconn...") + dprint("CTFWS", "Trying reconn...") mqtt_reconn_cronentry = cron.schedule("* * * * *", function(e) mqc:close(); OVL.nwfmqtt().connect(mqc,"nwfmqtt.conf") end)