Current Lua downloadable firmware will be posted here

User avatar
By aribi
#90013 When doing a firmware build for esp32 the image does not contain an entry for bootreason() in the "node" table
Code: Select all> print(node.bootreason())
stdin:1: attempt to call field 'bootreason' (a nil value)
stack traceback:
        stdin:1: in main chunk

This seems to be inline with the github repo of the firmware; file components/modules/node.c does not contain an LROT_FUNCENTRY for this function.
Yet, the docs do mention this functionality (docs/modules/
Functionality is basically there in sdk/esp32-esp-idf/components/esp32/reset_reason.c as esp_reset_reason().

Are there any hints or patches to get this working?
User avatar
By aribi
#90162 Well, seems I need to do this myself.
Attached is a patch to the firmware that will implement a working node.bootreason()
Probably not ready for commit, but it works for me.
This implementation of node.bootreason will distinguish a panic on the lua level from other types of reboot.
It can be used to intelligently handle a panic situation in init.lua (see demo-init.lua)

Hope this might be useful for someone - it helped me to workout my rather complex system setup
zip contains patch and demo
(3.53 KiB) Downloaded 41 times