Giter Club home page Giter Club logo

luatool's People

Contributors

4refr0nt avatar andrewgho avatar anujdas avatar bryant1410 avatar ceremcem avatar gitter-badger avatar groupsky avatar jesstr avatar jlloyola avatar jlusiardi avatar jonte avatar makiolo avatar mfa avatar nati0n avatar neuralfirings avatar trilader avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

luatool's Issues

Failure to compile code

An upload appears to go ok, but the compile fails with:
ERRORTraceback (most recent call last):
File "./luat", line 298, in
transport.writeln("node.compile("" + args.dest + "")\r")
File "./luat", line 106, in writeln
self.performcheck(data)
File "./luat", line 73, in performcheck
sys.stdout.write("\r\n send string : '%s'" % data)
NameError: global name 'data' is not defined
While I'm aware that node.compile due to out of memory, this appears to be a code error?

Error message missing when node.compile fails

around line 82, i will be larger than len(expected) and throw an IndexError if there's a compiler error message.
I hacked a change like this:
if i > len(expected): sys.stdout.write(char) elif char == chr(62) and expected[i] == char: char = ''

Binary uploads

This is a feature request. As it stands, luatool works for text files. It would be great to have it work with binary files as well. As it stands, I'm not even sure nodemcu firmware provides the facilities to do this.

Add delete commands.

I know it's a simple command but being able to delete files from the command would be useful.

  • delete specified file (or wild card?)
  • delete all files

Should higher baud rate be faster? code bottleneck?

I successfully placed the board into 115200 baud, and luatool will then only connect at that rate, as I would expect. However, I was initially surprised to find that it made no difference to the upload speed. Is the python code (or error checking) a bottleneck here?

default lua files can not be found if symlinked under linux

If I try to use luatool by creating a symlink to path/to/luatool/luatool.py, then it can not find main.lua file:

ceremcem@cca-erik:bin$ ls -l luatool.py 
lrwxrwxrwx 1 ceremcem ceremcem 26 Mar 30 02:23 luatool.py -> luatool/luatool/luatool.py

Deadlock when serial not flushed.

I ran in an issue that my Prolific PL-2303/X USB UART adaptor was not responsive.
I appears under OSX 10.10.1 and Version V1.5.1 of the Prolific Driver.

A bugfix for me was to add an s.flush() before closing the serial connection.

Greetings Max

Fails to upload

Hi,

First time using a nodemcu, so excuse me if I did this wrong. Host is OpenBSD, board is the new nodemcu amica.

$ sudo python2.7 luatool/luatool.py -p /dev/cuaU0

->file.open("main.lua", "w") -> ok
->file.close() -> ok
->file.remove("main.lua") -> ok
->file.open("main.lua", "w+")

ERROR
 send string    : 'file.open("main.lua", "w+")'
 expected echo  : 'file.open("main.lua", "w+")'
 but got answer : ' file.open("main.lua", "w+")'

Traceback (most recent call last):
  File "luatool/luatool.py", line 143, in <module>
    writeln("file.open(\""+args.dest+"\", \"w+\")\r")
  File "luatool/luatool.py", line 58, in writeln
    raise Exception('Error sending data to MCU\r\n\r\n')
Exception: Error sending data to MCU

Looks like just an extra space was received.

A string in lua script makes upload to fail

Noticed a weird uploader behaviour..
second line in following lua script (even when commented) breaks the upload process:

DHT_PIN = 7
-- if current_buffer_length > 2 and is_valid_sequence == false then
LED_PIN=4
->file.writeline([==[DHT_PIN = 7]==]) -> ok
->file.writeline([==[-- if current_buffer_length > 2 and is_valid_sequence == false then]==])
->file.writeline([==[LED_PIN=4]==])

ERROR
 send string    : 'file.writeline([==[LED_PIN=4]==])'
 expected echo  : 'file.writeline([==[LED_PIN=4]==])'
 but got answer : 'sequence == false then]==])'

Traceback (most recent call last):
  File "./luatool.py", line 322, in <module>
    transport.writer(line.strip())
  File "./luatool.py", line 63, in writer
    self.writeln("file.writeline([==[" + data + "]==])\r")
  File "./luatool.py", line 122, in writeln
    self.performcheck(data)
  File "./luatool.py", line 89, in performcheck
    raise Exception('Error sending data to MCU\r\n\r\n')
Exception: Error sending data to MCU

run command (first part is for syntax validation):

luac -p ~/mqtt.lua && ./luatool.py --port /dev/cu.wchusbserial1420 --src ~/mqtt.lua --dest  mqtt.lua --baud 1200 --verbose

No proper answer from MCU

version mismatch issue!!!

root@kali:~# sudo python '/root/Desktop/luatool-master/luatool/luatool.py' --port /dev/ttyUSB0 --src '/root/Desktop/experimental/init.lua' --dest init.lua --verbose
Set timeout None
Set interCharTimeout None
Upload starting
Stage 1. Deleting old file from flash memory
->file.open("init.lua", "w")Traceback (most recent call last):
File "/root/Desktop/luatool-master/luatool/luatool.py", line 170, in
writeln("file.open("" + args.dest + "", "w")\r")
File "/root/Desktop/luatool-master/luatool/luatool.py", line 44, in writeln
raise Exception('No proper answer from MCU')
Exception: No proper answer from MCU

Better serial/port error message

In a first use, lost some minutes figuring out this error... Thought it was some OS issue.

Traceback (most recent call last):
  File "/usr/bin/luatool.py", line 192, in <module>
    transport = decidetransport(args)
  File "/usr/bin/luatool.py", line 168, in decidetransport
    return SerialTransport(cliargs.port, cliargs.baud, cliargs.delay)
  File "/usr/bin/luatool.py", line 97, in __init__
    raise TransportError(e.strerror)
__main__.TransportError

Suggestion:

NO TTY: Please provide --port. Eg: /dev/ttyUSB*

PS.: A nice bet to detect tty is check for platform, linux: /dev/ttyUSB* mac: /dev/tty.usbmodel*
Thanks for the gem!
PS2: Thank you for this, great tool!

When sending data containing '>', unable to verify response

The check in writeln looks for '>' to detect a prompt (end of response). Unfortunately, it just takes the first '>' that appears instead of checking only the beginning of a new line. It doesn't seem to affect the written data, though.

Example output with this problem:

->file.writeline([==[handler["/"] = function(c, params)]==]) -> ok
->file.writeline([==[local buf = "<h1>ESP8266 Web Server</h1>"]==])
->file.writeline([==[buf = buf .. "<p>GPIO0 <a href=\"?gpio0=1\"><button>ON</button></a>&nbsp;<a href=\"?gpio0=0\"><button>OFF</button></a>"]==])
->file.writeline([==[buf = buf .. "<form action=\"\" method=\"GET\">"]==])
->file.writeline([==[buf = buf .. "<label>ON for (milliseconds)</label><input name=\"gpio0_time\" type=\"number\" min=\"100\" max=\"10000\" default=\"1000\"/>"]==])
->file.writeline([==[buf = buf .. "<input type=\"submit\"/></form></p>"]==])
->file.writeline([==[if params.gpio0 == "1" then]==]) -> ok
->file.writeline([==[gpio.write(gpio0, gpio.HIGH)]==]) -> ok
->file.writeline([==[elseif params.gpio0 == "0" then]==]) -> ok

Notice the missing -> ok for the lines containing the '>' character.

Upload via TCP and restart results in ugly python exception

Many thanks for adding upload via TCP. Unfortunately a triggered restart of the NodeMCU will cause the script to hang until the module is online again and then throw an exception.

->node.restart()Traceback (most recent call last):
  File "./luatool.py", line 310, in <module>
    transport.writeln("node.restart()\r")
  File "./luatool.py", line 147, in writeln
    self.performcheck(data)
  File "./luatool.py", line 59, in performcheck
    char = self.read(1)
  File "./luatool.py", line 152, in read
    return self.socket.recv(length)
socket.error: [Errno 104] Connection reset by peer

Let restart be called on it's own.

I invoke luatool from a script that only uploads files that have changed. I would like to be able to restart the my nodeMCU after the last file has been uploaded, no matter what it is.

No proper answer from MCU

I'm trying to upload a file to my ESP8266 with nodeMCU 0.9.5 (build 20150213) and luatool raises No proper answer from MCU. I can connect to the ESP8266 via Stino's serial monitor and screen command. Any idea about what is happening?

req: read lua file from ESP8211

it is possible to read out lua files from the ESP8266? that would be nice, because so you can read log files without always sending print.readline() :)

No proper answer from MCU on ESP8266 ESP-12E and raspberry Pi 3 B

Hello I flashed my ESP8266 ESP-12E with NodeMCU by raspberry Pi 3 B. All was okay. On minicom -b 115200 -o -D /dev/ttyS0 I can normally connect but if I want to upload some files by exec command: python luatool.py --port /dev/ttyS0 --src init.lua --dest init.lua --verbose --baud 115200 then I get:

Stage 1. Deleting old file from flash memory
->file.open("init.lua", "w")Traceback (most recent call last):
File "luatool.py", line 272, in <module>
 transport.writeln("file.open(\"" + args.dest + "\", \"w\")\r")
File "luatool.py", line 111, in writeln
self.performcheck(data)
File "luatool.py", line 61, in performcheck
raise Exception('No proper answer from MCU')
Exception: No proper answer from MCU

I have connect only RXD and TXD pins, when I'm connecting GPIO0 to GND and run it by baud 9600 its the same, please help me. When I try to the same on ESPlorer then I get double sending a command but not all command. Something like this:

print('TEST')
print('TES

Guys please help me!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.