Corrigé le port de la LED sur le SonOff et refactorisé encore une fois la procédure de boot avec le WIFI_init. Le mode AP est maintenant au tout début de la phase de boot, afin de pouvoir voir l'adresse IP avant que boot2 ne plante

This commit is contained in:
Christian Zufferey
2020-01-01 12:46:20 +01:00
parent eb7d0f8b48
commit d5f28ce7e4
8 changed files with 86 additions and 56 deletions

View File

@@ -1,28 +1,15 @@
-- Scripts à charger après le boot pour démarrer son projet
print("\n boot2.lua zf191228.2303 \n")
print("\n boot2.lua zf200101.1240 \n")
function boot2()
print("boot2 starting...")
second_chance=nil initz=nil boot=nil zLED=nil
boot2_tmr=nil secrets_wifi=nil wifi_init=nil
cli_ssid=nil cli_pwd=nil
boot2_tmr1=nil wifi_init1=nil wifi_info=nil boot2_go=nil
f= "secrets_project.lua" if file.exists(f) then dofile(f) end
f= "set_time.lua" if file.exists(f) then dofile(f) end
collectgarbage()
wifi.setmode(wifi.STATIONAP,true)
wifi.ap.config({ ssid = ap_ssid.."_"..node_id, pwd = ap_pwd, save=true })
ap_ssid=nil ap_pwd=nil
f= "web_srv2.lua" if file.exists(f) then dofile(f) end
boot2_tmr3=tmr.create()
boot2_tmr3:alarm(60*1000, tmr.ALARM_SINGLE, function()
print("BOOOOUM, y'a plus de AP WIFI !")
wifi.setmode(wifi.STATION,true) boot2_tmr3=nil
print(node.heap()) collectgarbage() print(node.heap())
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
@@ -32,7 +19,7 @@ function boot2()
verbose = true
boot2_tmr2=tmr.create()
boot2_tmr2:alarm(3*1000, tmr.ALARM_SINGLE, function()
boot2_tmr2:alarm(4*1000, tmr.ALARM_SINGLE, function()
print("BOOOOUM, y'a plus de boot2 !")
boot2=nil boot2_tmr2=nil
print(node.heap()) collectgarbage() print(node.heap())