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.
This commit is contained in:
parent
7c5bb15154
commit
a3212b29ac
|
@ -120,7 +120,7 @@ static void start_lua ()
|
|||
{
|
||||
NODE_DBG("Task task_lua started.\n");
|
||||
if (lua_main()) // If it returns true then LFS restart is needed
|
||||
lua_main();
|
||||
esp_restart();
|
||||
}
|
||||
|
||||
static void nodemcu_init(void)
|
||||
|
|
|
@ -629,10 +629,9 @@ LUAI_FUNC int luaN_init (lua_State *L) {
|
|||
lua_getglobal(L, #t); luaL_getmetafield( L, 1, #f ); lua_remove(L, -2);
|
||||
|
||||
LUALIB_API void luaL_lfsreload (lua_State *L) {
|
||||
#if defined(CONFIG_NODEMCU_EMBEDDED_FLS_SIZE)
|
||||
(void)L;
|
||||
#if defined(CONFIG_NODEMCU_EMBEDDED_LFS_SIZE)
|
||||
lua_pushstring(L, "Not allowed to write to LFS section");
|
||||
return 1;
|
||||
return;
|
||||
#else
|
||||
#ifdef LUA_USE_ESP
|
||||
size_t l;
|
||||
|
|
Loading…
Reference in New Issue