Files
NodeMCU_Lua/DeepSleep/ESP-M3/set_time.lua
Christian Zufferey a59ac6602c Super bien avancé sur mon tracker WPS
* complètement changé le telnet serveur, pris la nouvelle version sur NodeMCU. Ne plante plus maintenant
* commencé à tester l'écoute des AP WIFI qui sont dans le parage du NodeMCU
* règle l'horloge RTC via SNMP
* amélioré le mode dsleep afin de ne pas perdre l'horloge RTC
2018-12-11 00:20:58 +01:00

25 lines
740 B
Lua

-- Scripts pour régler l'horloge quand on est connecté en WIFI
print("\n set_time.lua zf181211.0010 \n")
--f= "wifi_ap_stop.lua" if file.exists(f) then dofile(f) end
--f= "wifi_cli_conf.lua" if file.exists(f) then dofile(f) end
--f= "wifi_cli_start.lua" if file.exists(f) then dofile(f) end
--f= "telnet_srv.lua" if file.exists(f) then dofile(f) end
--f= "web_ide2.lua" if file.exists(f) then dofile(f) end
--f= "dsleep.lua" if file.exists(f) then dofile(f) end
function set_time()
sntp.sync(nil, nil, nil, 1)
end
function ztime()
tm = rtctime.epoch2cal(rtctime.get())
print(string.format("%04d/%02d/%02d %02d:%02d:%02d", tm["year"], tm["mon"], tm["day"], tm["hour"], tm["min"], tm["sec"]))
end
set_time()