Voilà, il est maintenant capable de repartir sur une ancienne heure après un power boot
Bien qu'il n'a pas de connexion réseau au moment du power boot, il peut retrouver une ancienne heure sauvegardée dans la flash et continuer à enregistrer. Il faut maintenant qu'il voit que quand il a un wifi connu qu'il se connecte sur Internet pour se resynchroniser avec la bonne heure
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
-- ATTENTION: il faut connecter la pin 0 à la pin RESET avec une résistance de 1k !
|
||||
|
||||
print("\n dsleep2.lua zf200815.1245 \n")
|
||||
print("\n dsleep2.lua zf200815.1430 \n")
|
||||
|
||||
zLED=4
|
||||
f= "flash_led_xfois.lua" if file.exists(f) then dofile(f) end
|
||||
@@ -32,6 +32,12 @@ end
|
||||
-- on se réveil, vérifie si on peut avoir du réseau autrement on va redormir
|
||||
function dsleep_wake_up()
|
||||
print("Coucou, je suis réveillé... et il est "..ztime())
|
||||
if rtctime.get() < 1597494477 then
|
||||
print("oups je n'ai pas la bonne heure...")
|
||||
rtctime.set(file.getcontents("_ztime_"))
|
||||
print("voilà j'ai retrouvé une ancienne heure "..ztime())
|
||||
|
||||
end
|
||||
if wifi.sta.getip() == nil then
|
||||
print("Pas de réseau donc je scan le wifi...")
|
||||
f = "0_wifi_scan.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
-- Scripts pour tester l'écoute des AP WIFI
|
||||
|
||||
print("\n wifi_scan.lua zf200814.1924 \n")
|
||||
print("\n wifi_scan.lua zf200815.1454 \n")
|
||||
|
||||
f= "secrets_project.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
@@ -37,6 +37,9 @@ function scan_wifi()
|
||||
save_flash(zstr)
|
||||
end
|
||||
print("end display...")
|
||||
-- sauve l'heure sur la flash pour si jamais il y a un boot power on sans Internet
|
||||
file.putcontents("_ztime_", rtctime.get())
|
||||
|
||||
if zdsleep_stop then
|
||||
node.restart()
|
||||
else
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
-- Scripts à charger après le boot pour démarrer son projet
|
||||
|
||||
function boot()
|
||||
print("\n boot.lua zf200815.1358 \n")
|
||||
print("\n boot.lua zf200815.1436 \n")
|
||||
print("On lance le boot...")
|
||||
collectgarbage() print(node.heap())
|
||||
local f
|
||||
@@ -16,8 +16,8 @@ function boot()
|
||||
f = "set_time2.lua" if file.exists(f) then dofile(f) end
|
||||
print(node.heap()) collectgarbage() print(node.heap())
|
||||
|
||||
f = "0_dsleep2.lua" if file.exists(f) then dofile(f) end
|
||||
print(node.heap()) collectgarbage() print(node.heap())
|
||||
-- f = "0_dsleep2.lua" if file.exists(f) then dofile(f) end
|
||||
-- print(node.heap()) collectgarbage() print(node.heap())
|
||||
|
||||
-- f = "0_wifi_scan.lua" if file.exists(f) then dofile(f) end
|
||||
-- print(node.heap()) collectgarbage() print(node.heap())
|
||||
|
||||
Reference in New Issue
Block a user