From: Nathaniel Wesley Filardo Date: Mon, 30 Jan 2017 01:51:28 +0000 (-0500) Subject: examples/ctfws -- read LCD I2C address from fs X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=df7ad8797bc6e2afb457b1c24388ae69d7234951;p=acmetensortoys-esp-lua_ctfws examples/ctfws -- read LCD I2C address from fs --- diff --git a/init2.lua b/init2.lua index 52e8d62..5c58372 100644 --- a/init2.lua +++ b/init2.lua @@ -9,10 +9,20 @@ for k,v in pairs(file.list()) do end end +-- Grab some configuration parameters we might need, +-- notably, the LCD address +ctfwshw = {} +if file.open("ctfws-misc.conf","r") then + local conf = cjson.decode(file.read() or "") + if type(conf) == "table" + then ctfwshw = conf + else print("ctfws-misc.conf malformed") + end +end -- Hardware initialization i2c.setup(0,2,1,i2c.SLOW) -- init i2c on GPIO4 and GPIO5 -lcd = dofile("lcd1602.lc")(0x27) +lcd = dofile("lcd1602.lc")(ctfwshw.lcd or 0x27) tq = (dofile "tq.lc")(tmr.create())