whitecatboard / Lua-RTOS-ESP32

Lua RTOS for ESP32
Other
1.2k stars 221 forks source link

crash on os.sleep() #223

Closed hsteinhaus closed 5 years ago

hsteinhaus commented 5 years ago

Lua RTOS crashes instantly on Wemos board with OLED when calling os.sleep(). Some (unwanted) kind of watchdog active in the background?

  /\       /\
 /  \_____/  \
/_____________\
W H I T E C A T

Lua RTOS beta 0.1. Copyright (C) 2015 - 2018 whitecatboard.org

build 1544487159
commit 54a2b1b22b0bbfab6f873c561c2d4ae4682f4026
Running from factory partition
board type WEMOS-ESP32-OLED
cpu ESP32 rev 1 at 240 Mhz
spiffs start address at 0xf000, size 512 Kb
spiffs mounted on /

Lua RTOS beta 0.1 powered by Lua 5.3.4

/ > os.sleep(1)
ets Jun  8 2016 00:22:57

rst:0x5 (DEEPSLEEP_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:3948
load:0x40078000,len:8336
load:0x40080400,len:5836
entry 0x400806bc
jolivepetrus commented 5 years ago

@hsteinhaus,

This is the expected behaviour of this function. os.sleep(time) puts the CPU into deep sleep mode, and after the time is elapsed, the CPU reboots.

See the wiki:

https://github.com/whitecatboard/Lua-RTOS-ESP32/wiki/Sleep#ossleepseconds

If you want, for example to sleep the current thread you can use the Thread module functions.

See the wiki:

https://github.com/whitecatboard/Lua-RTOS-ESP32/wiki/Thread-Module#threadsleepseconds