Skip to content

Commit 24bf0ae

Browse files
committed
Issue restart rather than second lua_main() call on LFS reload.
By the time we get informed that there's an LFS reload we've already opened all the user libraries as well, so it's not safe to simply redo that with a new lua_State. Currently that results in a hang, and a manual reset is required to progress. Doing the automatic restart is the correct approach here, even though this adds another reboot to the LFS reload process. Also fixed up a couple of minor issues when embedded-LFS is used.
1 parent 4478fe8 commit 24bf0ae

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

components/base_nodemcu/user_main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static void start_lua ()
9494
{
9595
NODE_DBG("Task task_lua started.\n");
9696
if (lua_main()) // If it returns true then LFS restart is needed
97-
lua_main();
97+
esp_restart();
9898
}
9999

100100
static void nodemcu_init(void)

components/lua/lua-5.3/lnodemcu.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -629,10 +629,9 @@ LUAI_FUNC int luaN_init (lua_State *L) {
629629
lua_getglobal(L, #t); luaL_getmetafield( L, 1, #f ); lua_remove(L, -2);
630630

631631
LUALIB_API void luaL_lfsreload (lua_State *L) {
632-
#if defined(CONFIG_NODEMCU_EMBEDDED_FLS_SIZE)
633-
(void)L;
632+
#if defined(CONFIG_NODEMCU_EMBEDDED_LFS_SIZE)
634633
lua_pushstring(L, "Not allowed to write to LFS section");
635-
return 1;
634+
return;
636635
#else
637636
#ifdef LUA_USE_ESP
638637
size_t l;

0 commit comments

Comments
 (0)