From 0d1e801db4dc3ac2e7cfdd212c5dcf2bd2ca7b0e Mon Sep 17 00:00:00 2001 From: Christian Zufferey Date: Fri, 14 Aug 2020 19:36:49 +0200 Subject: [PATCH] =?UTF-8?q?Maintenant=20il=20arrive=20=C3=A0=20s'arr=C3=AA?= =?UTF-8?q?ter=20quand=20il=20voir=20un=20wifi=20connu=20mais...=20Comme?= =?UTF-8?q?=20il=20peut=20d=C3=A9marrer=20maintenant=20tout=20seul=20depui?= =?UTF-8?q?s=20un=20power=20off,=20il=20n'a=20plus=20moyen=20d'aller=20che?= =?UTF-8?q?rcher=20la=20date=20sur=20Internet.=20Il=20faut=20donc=20r?= =?UTF-8?q?=C3=A9guli=C3=A8rement=20quand=20on=20est=20connect=C3=A9=20sur?= =?UTF-8?q?=20Internet,=20sauver=20la=20date=20dans=20la=20flash=20afin=20?= =?UTF-8?q?qu'il=20puisse=20au=20moins=20partir=20d'une=20date=20pas=20tro?= =?UTF-8?q?p=20fausse=20quand=20il=20d=C3=A9marre=20sans=20nternet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DeepSleep/Pet_tracker_3/0_wifi_scan.lua | 10 +++++++--- DeepSleep/Pet_tracker_3/_zlocal_cmd.txt | 6 +++++- DeepSleep/Pet_tracker_3/_zremote_cmd.txt | 9 ++++++++- DeepSleep/Pet_tracker_3/wifi_init.lua | 4 ++-- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/DeepSleep/Pet_tracker_3/0_wifi_scan.lua b/DeepSleep/Pet_tracker_3/0_wifi_scan.lua index fb9a257..0258434 100644 --- a/DeepSleep/Pet_tracker_3/0_wifi_scan.lua +++ b/DeepSleep/Pet_tracker_3/0_wifi_scan.lua @@ -1,6 +1,6 @@ -- Scripts pour tester l'écoute des AP WIFI -print("\n wifi_scan.lua zf200812.1948 \n") +print("\n wifi_scan.lua zf200814.1924 \n") f= "secrets_project.lua" if file.exists(f) then dofile(f) end @@ -25,7 +25,7 @@ function scan_wifi() if ssid == "3g-s7" then print("ah je vois que je dois m'arrêter...") - -- node.restart() + zdsleep_stop =true end print("coucou: ."..ssid..".") @@ -37,7 +37,11 @@ function scan_wifi() save_flash(zstr) end print("end display...") - dsleep_on() + if zdsleep_stop then + node.restart() + else + dsleep_on() + end end print("wifi scan...") wifi.sta.getap(1, listap) diff --git a/DeepSleep/Pet_tracker_3/_zlocal_cmd.txt b/DeepSleep/Pet_tracker_3/_zlocal_cmd.txt index 9f2c12e..4049e85 100644 --- a/DeepSleep/Pet_tracker_3/_zlocal_cmd.txt +++ b/DeepSleep/Pet_tracker_3/_zlocal_cmd.txt @@ -1,8 +1,12 @@ -zf200724.1053 +zf200814.1936 print(ztime()) dsleep_on() + f = "0_wifi_scan.lua" if file.exists(f) then dofile(f) end + wifi.setmode(wifi.STATION) + scan_wifi() + zcat_logs_ap_wifi() print(node.bootreason()) diff --git a/DeepSleep/Pet_tracker_3/_zremote_cmd.txt b/DeepSleep/Pet_tracker_3/_zremote_cmd.txt index de92b0e..249cba7 100644 --- a/DeepSleep/Pet_tracker_3/_zremote_cmd.txt +++ b/DeepSleep/Pet_tracker_3/_zremote_cmd.txt @@ -1,9 +1,16 @@ # Quelques commandes remote (luatool) à envoyer avec le plugin Atom-IDE-terminal de l'éditeur Atom -# zf200812.1928 +# zf200814.1936 Todo à faire pour ce projet ! +- il faut que quand il se réveille et que la date est en 1970, il doit alors aller +chercher la date dans un fichier sur la flash. +Et qu'à chaque fois qu'il écrit le log dans la flash il sauve aussi la date qu'il +a pour si jamais qu'il puisse repartir au moins depuis un temps connu + + + Convertisseur GPX to CSV https://mygeodata.cloud/converter/gpx-to-csv diff --git a/DeepSleep/Pet_tracker_3/wifi_init.lua b/DeepSleep/Pet_tracker_3/wifi_init.lua index 8d8e971..2a61c34 100644 --- a/DeepSleep/Pet_tracker_3/wifi_init.lua +++ b/DeepSleep/Pet_tracker_3/wifi_init.lua @@ -1,7 +1,7 @@ -- Petit script pour initaliser la couche WIFI function wifi_init() - print("\n wifi_init.lua zf200812.1938 \n") + print("\n wifi_init.lua zf200814.1917 \n") f= "secrets_wifi.lua" if file.exists(f) then dofile(f) end f= "secrets_project.lua" if file.exists(f) then dofile(f) end @@ -75,7 +75,7 @@ function wifi_init() if wifi.sta.getip() == nil then print(i,"Connecting to AP...") i=i+1 - if i > 30 then + if i > 10 then print("pas de wifi :-(") file.putcontents("_setup_wifi_", "toto") print("on restart pour le setup wifi")