wip
This commit is contained in:
@@ -1,73 +0,0 @@
|
||||
--Script de bootstrap, test au moment du boot qui a été la cause de boot.
|
||||
|
||||
print("\n init.lua zf191021.0914 \n")
|
||||
|
||||
local bootreasons={
|
||||
[0]="power-on",
|
||||
[1]="hardware watchdog reset",
|
||||
[2]="exception reset",
|
||||
[3]="software watchdog reset",
|
||||
[4]="software restart",
|
||||
[5]="wake from deep sleep",
|
||||
[6]="external reset"
|
||||
}
|
||||
|
||||
local ip = wifi.sta.getip()
|
||||
if ip then
|
||||
print("already got:"..ip)
|
||||
else
|
||||
print("Connecting...")
|
||||
-- charge ses propres secrets
|
||||
f= "secrets_energy.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
-- configure le WIFI
|
||||
f= "wifi_ap_stop.lua" if file.exists(f) then dofile(f) end
|
||||
f= "wifi_cli_conf.lua" if file.exists(f) then dofile(f) end
|
||||
f= "wifi_cli_start.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
--[[
|
||||
wifi.setmode(wifi.STATION)
|
||||
ip_cfg={}
|
||||
ip_cfg.ip = "192.168.6.90"
|
||||
ip_cfg.netmask = "255.255.255.0"
|
||||
ip_cfg.gateway = "192.168.6.1"
|
||||
wifi.sta.setip(ip_cfg)
|
||||
station_cfg={}
|
||||
station_cfg.ssid="holternet"
|
||||
station_cfg.pwd="nemosushi_sushinemo"
|
||||
wifi.sta.sethostname("mybutton1")
|
||||
wifi.sta.config(station_cfg)
|
||||
wifi.sta.connect()
|
||||
wifi.sta.autoconnect(1)
|
||||
]]
|
||||
|
||||
plugtimer1=tmr.create()
|
||||
plugtimer1:alarm(1*1000, tmr.ALARM_AUTO, function()
|
||||
local ip = wifi.sta.getip()
|
||||
if ip then
|
||||
plugtimer1:unregister()
|
||||
print(ip)
|
||||
end
|
||||
end)
|
||||
end
|
||||
dofile("websocket.lua")
|
||||
dofile("main.lua")
|
||||
if file.exists("userinit.lua") then
|
||||
--[[
|
||||
0, power-on
|
||||
1, hardware watchdog reset
|
||||
2, exception reset
|
||||
3, software watchdog reset
|
||||
4, software restart
|
||||
5, wake from deep sleep
|
||||
6, external reset
|
||||
]]
|
||||
_ , reason = node.bootreason()
|
||||
if (reason<1 or reason > 3) then
|
||||
dofile("userinit.lua")
|
||||
else
|
||||
print ("Bootreason="..reason.." ("..bootreasons[reason].."), skipping userinit.lua")
|
||||
end
|
||||
else
|
||||
print("userinit.lua not found")
|
||||
end
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python2
|
||||
# -*- coding: utf-8 -*-
|
||||
version = "0.6.5 zf191021.1543"
|
||||
version = "0.6.5 zf191021.1558"
|
||||
|
||||
print("luatool.py ver " + version)
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
print("c'est toto")
|
||||
|
||||
--l = file.list();for k,v in pairs(l) do print('name:'..k..', size:'..v)end
|
||||
|
||||
function dir2()
|
||||
l = file.list();for k,v in pairs(l) do print('name:'..k..', size:'..v)end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function dir()
|
||||
print("\n-------------------------------")
|
||||
l=file.list() i=0
|
||||
for k,v in pairs(l) do
|
||||
i=i+v
|
||||
print(k..string.rep(" ",19-string.len(k)).." : "..v.." bytes")
|
||||
end
|
||||
print("-------------------------------")
|
||||
print('\nUsed: '..i..' bytes\nusage: dofile("file.lua")\n')
|
||||
end
|
||||
|
||||
--[[
|
||||
dir()
|
||||
dir2()
|
||||
|
||||
]]
|
||||
@@ -1,11 +1,11 @@
|
||||
#!/bin/bash
|
||||
# Petit script pour télécharger facilement tout le binz
|
||||
#zf191021.1555
|
||||
#zf191021.1608
|
||||
|
||||
# S'il y a des erreurs lors d'un téléchargement, il faut simplement augmenter un peu le délai !
|
||||
# Il est préférable de télécharger en premier les *gros* fichiers .lua !
|
||||
|
||||
#ATTENTION: cela efface tout le NodeMCU !
|
||||
# ATTENTION: cela efface tout le NodeMCU !
|
||||
|
||||
luatool_tty="/dev/cu.wchusbserial1410"
|
||||
|
||||
@@ -28,6 +28,6 @@ read -p "Est-ce bien vide ?"
|
||||
./luatool.py --port /dev/cu.wchusbserial1410 --bar --delay 0.001 -f wifi_info.lua
|
||||
|
||||
./luatool.py --port $luatool_tty -l
|
||||
read -p "Pas eu d'erreur, on redémarre et part à fond ?"
|
||||
read -p "Pas eu d'erreur, on part à fond avec le init.lua ?"
|
||||
./luatool.py --port $luatool_tty --bar --delay 0.001 -f initz.lua -t init.lua
|
||||
echo -e "\nC'est tout bon ;-)"
|
||||
|
||||
Reference in New Issue
Block a user