Amélioré ma procédure wifi_init afin d'éviter qu'il parte en wifi setup si il n'y a momentamément plus de wifi
This commit is contained in:
@@ -1,18 +1,22 @@
|
||||
-- Petit script pour faire office de crontab pour les mesures
|
||||
print("\n 0_cron.lua zf200119.1436 \n")
|
||||
print("\n 0_cron.lua zf200228.1727 \n")
|
||||
|
||||
cron1=tmr.create()
|
||||
cron1:alarm(20*1000, tmr.ALARM_AUTO, function()
|
||||
if verbose then print("cron1........................") end
|
||||
if verbose then gpio.write(zLED, gpio.LOW) tmr.delay(10000) gpio.write(zLED, gpio.HIGH) end
|
||||
|
||||
f = "0_htu21d.lua" if file.exists(f) then dofile(f) end
|
||||
f = "0_zdyndns.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
--[[
|
||||
f = "0_htu21d.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
zurl = thingspeak_url.."field1="..tostring(ztemp1).."&field2="..tostring(zhum1)
|
||||
|
||||
f = "0_send_data.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
ztemp1=nil zhum1=nil
|
||||
]]
|
||||
|
||||
if verbose then print(node.heap()) end
|
||||
collectgarbage()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
-- Scripts à charger après le boot pour démarrer son projet
|
||||
|
||||
print("\n boot.lua zf200221.1133 \n")
|
||||
print("\n boot.lua zf200228.1730 \n")
|
||||
|
||||
function boot()
|
||||
verbose = true
|
||||
@@ -10,9 +10,10 @@ function boot()
|
||||
--f="0_htu21d.lua" if file.exists(f) then dofile(f) end
|
||||
--zurl=thingspeak_url.."field1="..tostring(ztemp1).."&field2="..tostring(zhum1)
|
||||
--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="0_btn_flipflop.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
f="0_cron.lua" if file.exists(f) then dofile(f) end
|
||||
f="0_tst3_socat.lua" if file.exists(f) then dofile(f) end
|
||||
--f="0_tst3_socat.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
--f = "web_ide2.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
-- Petit script pour initaliser la couche WIFI
|
||||
|
||||
function wifi_init()
|
||||
print("\n wifi_init.lua zf200216.1348 \n")
|
||||
print("\n wifi_init.lua zf200229.1438 \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
|
||||
@@ -34,6 +34,9 @@ function wifi_init()
|
||||
tmr_wifi_init4:alarm(0.1*1000, tmr.ALARM_AUTO , function()
|
||||
gpio.write(zLED, gpio.LOW) tmr.delay(10000) gpio.write(zLED, gpio.HIGH)
|
||||
end)
|
||||
tmr.create():alarm(90*1000, tmr.ALARM_SINGLE, function()
|
||||
node.restart()
|
||||
end)
|
||||
enduser_setup.start(function()
|
||||
print("on est sortit du setup wifi et on restart !")
|
||||
node.restart()
|
||||
@@ -56,9 +59,9 @@ function wifi_init()
|
||||
tmr_wifi_init1:alarm(1*1000, tmr.ALARM_AUTO , function()
|
||||
gpio.write(zLED, gpio.LOW) tmr.delay(10000) gpio.write(zLED, gpio.HIGH)
|
||||
if wifi.sta.getip() == nil then
|
||||
print("Connecting to AP...")
|
||||
print(i,"Connecting to AP...")
|
||||
i=i+1
|
||||
if i > 15 then
|
||||
if i > 20 then
|
||||
print("pas de wifi :-(")
|
||||
file.putcontents("_setup_wifi_", "toto")
|
||||
print("on restart pour le setup wifi")
|
||||
|
||||
12
rtelnet.sh
12
rtelnet.sh
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
# petit script provisoire pour se connecter sur les NodeMCU en reverse telnet
|
||||
# zf200221.1336
|
||||
# zf200228.1857
|
||||
|
||||
|
||||
#test si l'argument est vide
|
||||
@@ -10,6 +10,7 @@ if [ -z "$1" ]
|
||||
|
||||
./rtelnet.sh socket
|
||||
./rtelnet.sh 23047
|
||||
./rtelnet.sh 23056
|
||||
|
||||
"
|
||||
exit
|
||||
@@ -24,17 +25,20 @@ killall -9 ssh
|
||||
|
||||
|
||||
# on établit le serveur reverse telnet
|
||||
#
|
||||
ssh ubuntu@www.zuzutest.ml socat TCP-LISTEN:$1,reuseaddr,fork TCP-LISTEN:23000,reuseaddr,bind=127.0.0.1 &
|
||||
|
||||
watch -n 1 'ssh ubuntu@www.zuzutest.ml netstat -nat |grep 230'
|
||||
|
||||
sleep 1
|
||||
|
||||
# on crée le tunnel sur la console du NodeMCU
|
||||
ssh -N -L 23000:localhost:23000 ubuntu@www.zuzutest.ml &
|
||||
sleep 1
|
||||
|
||||
|
||||
|
||||
ça ne marche pas bien ici :-(
|
||||
|
||||
#ça ne marche pas bien ici :-(
|
||||
|
||||
|
||||
|
||||
@@ -47,5 +51,5 @@ read -p "Voulez-vous tuer la connexion ?"
|
||||
# on tue le serveur reverse telnet
|
||||
ssh ubuntu@www.zuzutest.ml killall -9 socat
|
||||
|
||||
# on tue le tunnel
|
||||
# on tue le tunnel sur sa machine (ATTENTION, tue tous les ssh !)
|
||||
killall -9 ssh
|
||||
|
||||
Reference in New Issue
Block a user