Samstag, 30. Juli 2016

ESP8266 NodeMCU / LUA - Reprogram with init.lua and deepsleep

Adding a snippet helps re-programming a ESP with
init.lua calling deep sleep without flashing the whole
firmware again..
If you name your main program init.lua on a ESP8266 with NodeMCU firmware and it uses deep sleep, you need to flash the whole firmware again to upload a new program version. But there is a nice workaround. When using Esplorer, you can put small scripts on the buttons called "Snippets". When connecting the USB-to-serial adapter, hitting "Open", you have a short time for pressing this snippet button and the commands will be executed.

This way it's not not necessary to re-flash the whole firmware, but just upload your new version and test on.

Click on the "Snippets" tab, choose the snippet you want to add on the left side, and add these two lines:
file.remove('init.old')
file.rename('init.lua','init.old')

You can also rename the button with a text that suits the task.

Keine Kommentare: