La routine set_time consomme trop de ram, j'utilise donc maintenant tmr.now() comme time_stamp. Socat est aussi démarré !
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
-- https://github.com/zuzu59/NodeMCU_Lua/tree/master/Mesures/humidity/bolo-thingspeak/docu/HTU21D.txt
|
||||
|
||||
function readHTU21D()
|
||||
if verbose then print("\n 0_1_htu21d.lua zf200524.1915 \n") end
|
||||
if verbose then print("\n 0_1_htu21d.lua zf200525.1153 \n") end
|
||||
if verbose then print("1readHTU21D: "..ztime_stamp()) end
|
||||
|
||||
id = 0 sda = 5 scl = 6 addr = 0x40
|
||||
@@ -37,6 +37,7 @@ function readHTU21D()
|
||||
id=nil addr=nil HUMIDITY=nil TEMPERATURE=nil r=nil
|
||||
read_HTU21D=nil readTemp=nil readHumi=nil readHTU21D=nil
|
||||
if verbose then print("End 1_htu21d:\n"..node.heap()) end
|
||||
if verbose then print("1readHTU21D: "..ztime_stamp()) end
|
||||
collectgarbage()
|
||||
if verbose then print(node.heap()) end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
-- https://github.com/zuzu59/NodeMCU_Lua/tree/master/Mesures/humidity/bolo-thingspeak/docu/HTU21D.txt
|
||||
|
||||
function readHTU21D()
|
||||
if verbose then print("\n 0_2_htu21d.lua zf200524.1915 \n") end
|
||||
if verbose then print("\n 0_2_htu21d.lua zf200525.1154 \n") end
|
||||
if verbose then print("2readHTU21D: "..ztime_stamp()) end
|
||||
|
||||
id = 0 sda = 5 scl = 7 addr = 0x40
|
||||
@@ -37,6 +37,7 @@ function readHTU21D()
|
||||
id=nil addr=nil HUMIDITY=nil TEMPERATURE=nil r=nil
|
||||
read_HTU21D=nil readTemp=nil readHumi=nil readHTU21D=nil
|
||||
if verbose then print("End 2_htu21d:\n"..node.heap()) end
|
||||
if verbose then print("2readHTU21D: "..ztime_stamp()) end
|
||||
collectgarbage()
|
||||
if verbose then print(node.heap()) end
|
||||
end
|
||||
|
||||
@@ -29,9 +29,10 @@ cron1:alarm(10*1000, tmr.ALARM_AUTO, function()
|
||||
|
||||
ztemp1=nil zhum1=nil ztemp2=nil zhum2=nil
|
||||
|
||||
--f = "0_zdyndns.lua" if file.exists(f) then dofile(f) end
|
||||
f = "0_zdyndns.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
if verbose then print("End cron:\n"..node.heap()) end
|
||||
if verbose then print("cron1: "..ztime_stamp()) end
|
||||
collectgarbage()
|
||||
if verbose then print(node.heap()) end
|
||||
end)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
-- Petit script pour envoyer en // es valeurs sur un serveur WEB (InfluxDB)
|
||||
-- via un http POST à travers un FIFO
|
||||
|
||||
if verbose then print("\n 0_http_post.lua zf200524.1915 \n") end
|
||||
if verbose then print("\n 0_http_post.lua zf200525.1153 \n") end
|
||||
|
||||
t_zurl={} t_zarg={} f_zpost=false
|
||||
|
||||
@@ -25,6 +25,7 @@ function zpost()
|
||||
zpost()
|
||||
end
|
||||
if verbose then print("End zpost:\n"..node.heap()) end
|
||||
if verbose then print("zpost: "..ztime_stamp()) end
|
||||
collectgarbage()
|
||||
if verbose then print(node.heap()) end
|
||||
|
||||
@@ -38,6 +39,7 @@ function http_post(zurl,zarg)
|
||||
print("t_zurl:") tprint(t_zurl) print("t_zarg:") tprint(t_zarg)
|
||||
if f_zpost==false then zpost() end
|
||||
if verbose then print("End http_post:\n"..node.heap()) end
|
||||
if verbose then print("http_post: "..ztime_stamp()) end
|
||||
collectgarbage()
|
||||
if verbose then print(node.heap()) end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
-- Petit script pour s'inregistrer sur zdyndns
|
||||
|
||||
function send_zdyndns()
|
||||
if verbose then print("\n 0_zdyndns.lua zf200229.1816 \n") end
|
||||
if verbose then print("\n 0_zdyndns.lua zf200525.1237 \n") end
|
||||
if verbose then print("send_zdyndns: "..ztime_stamp()) end
|
||||
|
||||
zip = wifi.sta.getip()
|
||||
zdyndns_str = "s "..node_id..","..console_host..":"..tostring(console_port).." "..zip.."\n"
|
||||
@@ -21,6 +22,7 @@ function send_zdyndns()
|
||||
if verbose then print("close...") end
|
||||
zdyndns_str=nil zip=nil srv_zdyndns=nil send_zdyndns=nil
|
||||
if verbose then print("End zdyndns:\n"..node.heap()) end
|
||||
if verbose then print("send_zdyndns: "..ztime_stamp()) end
|
||||
collectgarbage()
|
||||
if verbose then print(node.heap()) end
|
||||
end)
|
||||
|
||||
@@ -1,24 +1,32 @@
|
||||
-- Scripts à charger après le boot pour démarrer son projet
|
||||
|
||||
print("\n boot.lua zf200524.1922 \n")
|
||||
print("\n boot.lua zf200525.1229 \n")
|
||||
|
||||
function ztime_stamp() return tmr.now()/1000000 end
|
||||
|
||||
function boot()
|
||||
verbose = true
|
||||
print("On lance le boot...")
|
||||
print("boot: "..ztime_stamp())
|
||||
print(node.heap()) collectgarbage() print(node.heap())
|
||||
|
||||
f = "set_time.lua" if file.exists(f) then dofile(f) end
|
||||
f="0_tst3_socat.lua" if file.exists(f) then dofile(f) end
|
||||
print(node.heap()) collectgarbage() print(node.heap())
|
||||
|
||||
f = "0_http_post.lua" if file.exists(f) then dofile(f) end
|
||||
print(node.heap()) collectgarbage() print(node.heap())
|
||||
|
||||
--f="0_tst3_socat.lua" if file.exists(f) then dofile(f) end
|
||||
f="0_btn_flipflop.lua" if file.exists(f) then dofile(f) end
|
||||
print(node.heap()) collectgarbage() print(node.heap())
|
||||
|
||||
f="0_cron.lua" if file.exists(f) then dofile(f) end
|
||||
print(node.heap()) collectgarbage() print(node.heap())
|
||||
|
||||
--f = "web_ide2.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
print("verbose:",verbose)
|
||||
print("boot lancé...")
|
||||
print("boot: "..ztime_stamp())
|
||||
print(node.heap()) collectgarbage() print(node.heap())
|
||||
f=nil boot=nil
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
-- Scripts pour régler l'horloge quand on est connecté en WIFI
|
||||
-- Permet aussi de 'compresser' le unix time afin de prendre moins de place dans les strings
|
||||
|
||||
print("\n set_time.lua zf200524.1914 \n")
|
||||
print("\n set_time.lua zf200525.1147 \n")
|
||||
|
||||
--source: https://www.freeformatter.com/epoch-timestamp-to-date-converter.html
|
||||
|
||||
@@ -26,21 +26,12 @@ end
|
||||
|
||||
function ztime_stamp()
|
||||
sec, usec = rtctime.get()
|
||||
return (ztime_format(sec).."."..usec)
|
||||
return (ztime_format(sec)..string.format(".%06d", usec))
|
||||
end
|
||||
|
||||
|
||||
set_time()
|
||||
|
||||
tmr.create():alarm(2*1000, tmr.ALARM_SINGLE, function()
|
||||
print(ztime_format(rtctime.get()))
|
||||
tmr.create():alarm(3*1000, tmr.ALARM_SINGLE, function()
|
||||
print("ztime_stamp: "..ztime_stamp())
|
||||
end)
|
||||
|
||||
|
||||
--[[
|
||||
sec, usec = rtctime.get() print(ztime_format(sec).."."..usec)
|
||||
|
||||
|
||||
]]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user