From c792ff6b21d024feefde147aabf7c2d615549f71 Mon Sep 17 00:00:00 2001 From: Christian Zufferey Date: Wed, 8 Jan 2020 18:12:08 +0100 Subject: [PATCH] Cela ne fonctionne pas encore :-( --- SonOff/SonOff_2/boot.lua | 26 +++++++++++--------------- SonOff/SonOff_2/boot2.lua | 4 ++++ SonOff/SonOff_2/wifi_init.lua | 26 ++++++++++++++++++++------ 3 files changed, 35 insertions(+), 21 deletions(-) diff --git a/SonOff/SonOff_2/boot.lua b/SonOff/SonOff_2/boot.lua index 10cf1bc..a3c13f9 100644 --- a/SonOff/SonOff_2/boot.lua +++ b/SonOff/SonOff_2/boot.lua @@ -1,23 +1,19 @@ --- Scripts à charger après le boot pour démarrer le core system +-- Scripts à charger après le boot pour démarrer son projet -print("\n boot.lua zf200107.1443 \n") +print("\n boot.lua zf200108.1751 \n") function boot() + print("booooooooooot...") + print(node.heap()) collectgarbage() print(node.heap()) - initalarme2=tmr.create() - initalarme2:alarm(30*1000, tmr.ALARM_SINGLE, function() - f= "boot2.lua" if file.exists(f) then dofile(f) end - end) + --f= "0_htu21d.lua" if file.exists(f) then dofile(f) end + --f= "0_send_data.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 + + f=nil boot=nil + verbose = true - - - if zswitch ~= nill then - gpio.trig(zswitch, "none") hvbouton=nil zswitch=nil reset_reason=nil - end - f= "wifi_init.lua" if file.exists(f) then dofile(f) end - f= "telnet_srv2.lua" if file.exists(f) then dofile(f) end - f= "web_srv2.lua" if file.exists(f) then dofile(f) end - second_chance=nil initz=nil f=nil boot=nil end boot() diff --git a/SonOff/SonOff_2/boot2.lua b/SonOff/SonOff_2/boot2.lua index abe0417..4a854c0 100644 --- a/SonOff/SonOff_2/boot2.lua +++ b/SonOff/SonOff_2/boot2.lua @@ -1,5 +1,9 @@ -- Scripts à charger après le boot pour démarrer son projet + +ATTENTION: n'existe plus depuis le 190108.1747 ! + + print("\n boot2.lua zf200106.2331 \n") function boot2() diff --git a/SonOff/SonOff_2/wifi_init.lua b/SonOff/SonOff_2/wifi_init.lua index 4906229..f21b3da 100644 --- a/SonOff/SonOff_2/wifi_init.lua +++ b/SonOff/SonOff_2/wifi_init.lua @@ -1,18 +1,32 @@ -- Petit script pour initaliser la couche WIFI function wifi_init() - print("\n wifi_init.lua zf200107.1530 \n") + print("\n wifi_init.lua zf200108.1756 \n") function wifi_init_end() wifi_init1:unregister() zLED=nil i=nil f= "wifi_info.lua" if file.exists(f) then dofile(f) end f=nil secrets_wifi=nil cli_pwd=nil cli_ssid=nil wifi_init1=nil wifi_init=nil - print(node.heap()) collectgarbage() print(node.heap()) + print(node.heap()) collectgarbage() print(node.heap()) + + + + f= "telnet_srv2.lua" if file.exists(f) then dofile(f) end + f= "web_srv2.lua" if file.exists(f) then dofile(f) end + print(node.heap()) collectgarbage() print(node.heap()) + + zdelay=1 if reset_reason=="seconde_chance" then zdelay=10 end + wifi_init3=tmr.create() + wifi_init3:alarm(zdelay*1000, tmr.ALARM_SINGLE, function() + f= "boot.lua" if file.exists(f) then dofile(f) end + wifi_init3:unregister() wifi_init3=nil wifi_init_end=nil + reset_reason=nil zdelay=nil + end) + + - --boot2_go = true - wifi_init_end=nil end if file.exists("_setup_wifi_") then @@ -36,10 +50,10 @@ function wifi_init() ap_ssid=nil ap_pwd=nil wifi_init2=tmr.create() - wifi_init2:alarm(60*1000, tmr.ALARM_SINGLE, function() + wifi_init2:alarm(60*1000, tmr.ALARM_SINGLE, function() print("BOOOOUM, y'a plus de AP WIFI !") wifi.setmode(wifi.STATION,true) wifi_init2=nil - print(node.heap()) collectgarbage() print(node.heap()) + print(node.heap()) collectgarbage() print(node.heap()) end) zLED=4 -- NodeMCU