wip
This commit is contained in:
@@ -16,14 +16,14 @@ local ip = wifi.sta.getip()
|
||||
if ip then
|
||||
print("already got:"..ip)
|
||||
else
|
||||
-- print("Connecting...")
|
||||
print("Connecting...")
|
||||
-- charge ses propres secrets
|
||||
-- f= "secrets_energy.lua" if file.exists(f) then dofile(f) end
|
||||
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
|
||||
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)
|
||||
@@ -41,29 +41,19 @@ else
|
||||
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)
|
||||
print("> ")
|
||||
end
|
||||
end)
|
||||
]]
|
||||
|
||||
end
|
||||
|
||||
--[[
|
||||
dofile("websocket.lua")
|
||||
dofile("main.lua")
|
||||
]]
|
||||
|
||||
--[[
|
||||
|
||||
if file.exists("userinit.lua") then
|
||||
--[z[
|
||||
--[[
|
||||
0, power-on
|
||||
1, hardware watchdog reset
|
||||
2, exception reset
|
||||
@@ -71,7 +61,7 @@ if file.exists("userinit.lua") then
|
||||
4, software restart
|
||||
5, wake from deep sleep
|
||||
6, external reset
|
||||
]z]
|
||||
]]
|
||||
_ , reason = node.bootreason()
|
||||
if (reason<1 or reason > 3) then
|
||||
dofile("userinit.lua")
|
||||
@@ -81,5 +71,3 @@ if file.exists("userinit.lua") then
|
||||
else
|
||||
print("userinit.lua not found")
|
||||
end
|
||||
|
||||
]]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python2
|
||||
# -*- coding: utf-8 -*-
|
||||
version = "0.6.5 zf191021.1534"
|
||||
version = "0.6.5 zf191021.1543"
|
||||
|
||||
print("luatool.py ver " + version)
|
||||
|
||||
@@ -71,14 +71,12 @@ class AbstractTransport:
|
||||
self.writeln("file.writeline([==[" + data + "]==])\r")
|
||||
|
||||
def performcheck(self, expected):
|
||||
print("toto1434")
|
||||
line = ''
|
||||
char = ''
|
||||
i = -1
|
||||
while char != chr(62): # '>'
|
||||
char = self.read(1)
|
||||
#print("toto14491 char: ." + char + ".")
|
||||
if char == '£':
|
||||
if char == '':
|
||||
raise Exception('No proper answer from MCU')
|
||||
if char == chr(13) or char == chr(10): # LF or CR
|
||||
if line != '':
|
||||
@@ -135,20 +133,12 @@ class SerialTransport(AbstractTransport):
|
||||
line += char
|
||||
i += 1
|
||||
if args.verbose:
|
||||
print("toto1518 line: ." + line + ".")
|
||||
print("line: ." + line + ".")
|
||||
|
||||
|
||||
def writeln(self, data, check=1):
|
||||
print("toto1439 check: " + str(check))
|
||||
|
||||
# zzz191020 une petite pause après l'envoi de chaque ligne
|
||||
# zzz191020 on fait une petite pause avant l'envoi de chaque ligne
|
||||
sleep(self.delay)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if self.serial.inWaiting() > 0:
|
||||
self.serial.flushInput()
|
||||
if len(data) > 0 and not args.bar:
|
||||
@@ -158,7 +148,6 @@ class SerialTransport(AbstractTransport):
|
||||
# zzz191021 Affiche ce que l'on a envoyé au NodeMCU
|
||||
if args.verbose:
|
||||
print("\n\nzwrite0952: {" + data + "\n}\n")
|
||||
print("toto1435 check: " + str(check))
|
||||
if check > 0:
|
||||
self.performcheck(data)
|
||||
elif not args.bar:
|
||||
@@ -253,18 +242,10 @@ if __name__ == '__main__':
|
||||
|
||||
if args.list:
|
||||
# zzz191020 Amélioré la sortie du listing des fichiers
|
||||
#sleep(1)
|
||||
print("\ntoto1024\n")
|
||||
|
||||
transport.writeln("print('\\n-----');local l = file.list();for k,v in pairs(l) do print(k..', size:'..v)end;print('-----\\n')\r", 0)
|
||||
#transport.writeln("print('toto et tutu')\r", 1)
|
||||
print("\ntoto10241\n")
|
||||
while True:
|
||||
char = transport.read(1)
|
||||
#print("toto1400: ." + char + ".")
|
||||
if char == '' or char == chr(62): # '' or '>'
|
||||
#if char == chr(62): # '>'
|
||||
print("\ntoto1017: ." + char + ".")
|
||||
break
|
||||
sys.stdout.write(char)
|
||||
sys.exit(0)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
# Petit script pour télécharger facilement tout le binz
|
||||
#zf191021.1027
|
||||
#zf191021.1555
|
||||
|
||||
# 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 !
|
||||
@@ -13,9 +13,8 @@ read -p "ATTENTION, cela va effacer tout le NodeMCU !"
|
||||
read -p "Etes-vous vraiment certain ?"
|
||||
|
||||
chmod +x luatool.py
|
||||
|
||||
./luatool.py --port $luatool_tty -w
|
||||
./luatool.py --port $luatool_tty --zrestart
|
||||
sleep 0.5
|
||||
./luatool.py --port $luatool_tty -l
|
||||
read -p "Est-ce bien vide ?"
|
||||
|
||||
@@ -28,10 +27,7 @@ read -p "Est-ce bien vide ?"
|
||||
./luatool.py --port /dev/cu.wchusbserial1410 --bar --delay 0.001 -f wifi_cli_start.lua
|
||||
./luatool.py --port /dev/cu.wchusbserial1410 --bar --delay 0.001 -f wifi_info.lua
|
||||
|
||||
#./luatool.py --port $luatool_tty --bar --delay 0.001 -f initz.lua -t init.lua
|
||||
./luatool.py --port $luatool_tty --bar --delay 0.001 -f initz.lua
|
||||
./luatool.py --port $luatool_tty -l
|
||||
|
||||
read -p "Pas eu d'erreur, on redémarre et part à fond ?"
|
||||
./luatool.py --port $luatool_tty --zrestart
|
||||
./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