]> hydra-www.ietfng.org Git - acmetensortoys-esp-lua_ctfws/commitdiff
Always use a prefix tag when printing log messages
authorNathaniel Wesley Filardo <nwfilardo@gmail.com>
Sun, 4 Nov 2018 17:16:18 +0000 (17:16 +0000)
committerNathaniel Wesley Filardo <nwfilardo@gmail.com>
Sun, 11 Nov 2018 10:46:34 +0000 (10:46 +0000)
ctfws-lfs-strings.lua
init2.lua
init3.lua

index 58fea800ce5d77e7f098192c4b148706ec42b0dd..392f90bcc258d59ef6c15cb08215b9d2deae5ede 100644 (file)
@@ -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",
index 5c5687b69f02e555bc7ea0b000e7b0efe53c56a2..ec0d9dc058320bbec4a1d18db8a147437b1a707d 100644 (file)
--- 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)
index 39cebd13051cdd132e28b8a0f281c05e7bed45f9..3859712015b90a2422b45f6e9467a9e0e19c1b7c 100644 (file)
--- 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)