4refr0nt / luatool

Small python script for loading init.lua to ESP8266 nodemcu firmware
http://esp8266.ru/
GNU Lesser General Public License v3.0
310 stars 96 forks source link

A string in lua script makes upload to fail #56

Open fedulovivan opened 4 years ago

fedulovivan commented 4 years ago

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
fedulovivan commented 4 years ago

For anyone, who may face with similar issues: Give a try NodeMCU-Tool project. Its works with nodemcu 3.0, uploads scripts mush faster and overall works more stable.