Ajouté un time stamp aux routines principales pour le profiling, ne marche pas encore !
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
-- 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 zf200523.1816 \n") end
|
||||
if verbose then print("\n 0_1_htu21d.lua zf200524.1656 \n") end
|
||||
if verbose then print("1readHTU21D: "..ztime_format(rtctime.get())) end
|
||||
|
||||
id = 0 sda = 5 scl = 6 addr = 0x40
|
||||
HUMIDITY = 0xE5 TEMPERATURE = 0xE3
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
-- 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 zf200523.1839 \n") end
|
||||
if verbose then print("\n 0_2_htu21d.lua zf200524.1657 \n") end
|
||||
if verbose then print("2readHTU21D: "..ztime_format(rtctime.get())) end
|
||||
|
||||
id = 0 sda = 5 scl = 7 addr = 0x40
|
||||
HUMIDITY = 0xE5 TEMPERATURE = 0xE3
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
-- Petit script pour faire office de crontab pour les mesures
|
||||
print("\n 0_cron.lua zf200524.1416 \n")
|
||||
print("\n 0_cron.lua zf200524.1728 \n")
|
||||
|
||||
|
||||
function tprint(t)
|
||||
@@ -14,6 +14,7 @@ ztemp1=20 zhum1=40 ztemp2=20 zhum2=40
|
||||
cron1=tmr.create()
|
||||
cron1:alarm(10*1000, tmr.ALARM_AUTO, function()
|
||||
if verbose then print("cron1........................") end
|
||||
if verbose then print("cron1: "..ztime_format(rtctime.get())) end
|
||||
if verbose then gpio.write(zLED, gpio.LOW) tmr.delay(10000) gpio.write(zLED, gpio.HIGH) end
|
||||
|
||||
http_post(influxdb_url,"energy,memory=cron1 ram="..node.heap())
|
||||
@@ -38,4 +39,12 @@ end)
|
||||
--[[
|
||||
cron1:stop()
|
||||
cron1:start()
|
||||
|
||||
sec, usec = rtctime.get()
|
||||
print(sec,usec)
|
||||
|
||||
print(ztime_format(rtctime.get()))
|
||||
|
||||
|
||||
|
||||
]]
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
-- 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.1336 \n") end
|
||||
if verbose then print("\n 0_http_post.lua zf200524.1656 \n") end
|
||||
|
||||
t_zurl={} t_zarg={} f_zpost=false
|
||||
|
||||
function zpost()
|
||||
f_zpost=true zurl=t_zurl[1] zarg=t_zarg[1]
|
||||
if verbose then print("zpost: "..ztime_format(rtctime.get())) end
|
||||
if verbose then print("zurl: "..zurl) end if verbose then print("zarg: "..zarg) end
|
||||
|
||||
http.post(zurl, 'Content-Type: application/x-www-form-urlencoded\r\n', zarg, function(code, data)
|
||||
@@ -32,6 +33,7 @@ end
|
||||
|
||||
|
||||
function http_post(zurl,zarg)
|
||||
if verbose then print("http_post: "..ztime_format(rtctime.get())) end
|
||||
table.insert(t_zurl, zurl) table.insert(t_zarg, zarg)
|
||||
print("t_zurl:") tprint(t_zurl) print("t_zarg:") tprint(t_zarg)
|
||||
if f_zpost==false then zpost() end
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
-- Scripts à charger après le boot pour démarrer son projet
|
||||
|
||||
print("\n boot.lua zf200524.1357 \n")
|
||||
print("\n boot.lua zf200524.1712 \n")
|
||||
|
||||
function boot()
|
||||
verbose = true
|
||||
print("On lance le boot...")
|
||||
print(node.heap()) collectgarbage() print(node.heap())
|
||||
|
||||
f = "set_time.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
f = "0_http_post.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
--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
|
||||
f="0_cron.lua" if file.exists(f) then dofile(f) end
|
||||
--f="0_cron.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
--f = "web_ide2.lua" if file.exists(f) then dofile(f) 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 zf191030.2026 \n")
|
||||
print("\n set_time.lua zf200524.1711 \n")
|
||||
|
||||
--source: https://www.freeformatter.com/epoch-timestamp-to-date-converter.html
|
||||
|
||||
@@ -31,6 +31,10 @@ tmr.create():alarm(2*1000, tmr.ALARM_SINGLE, function()
|
||||
end)
|
||||
|
||||
|
||||
--[[
|
||||
sec, usec = rtctime.get() print(ztime_format(sec).."."..usec)
|
||||
|
||||
|
||||
]]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user