cold boot / reset detection with dummydevice not working

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
_Cyber_
Normal user
Posts: 115
Joined: 20 Oct 2019, 09:46

cold boot / reset detection with dummydevice not working

#1 Post by _Cyber_ » 01 Feb 2021, 22:00

Hi,

I am using ESP_Easy_mega_20210114_normal_ESP32_4M316k on a ESP32

I am trying to determine, if a boot is a cold boot (where all dummydevices come with 0 values) or a reboot (where the dummydevices are preserved).

Code: Select all

on System#Boot do
 if [Boot#Watcher] = 0
  TaskValueSet,1,1,-1
  TaskValueSet,2,1,-1
  TaskValueSet,3,1,-1
  TaskValueSet,4,1,-1
 else
  TaskValueSet,1,1,-2
  TaskValueSet,2,1,-2
  TaskValueSet,3,1,-2
  TaskValueSet,4,1,-2
 endif
endon
Boot#Watcher is a dummydevice with Taskvalue,5, and is set later in code to "-1" as soon as the ESP did some action.

but, altough this dummydevice has -1 before I reboot the ESP with reboot button, I always get the dummydevices 1-4 set to "-1", so it seems like the dummydevice is not filled at the time where the code runs?

Thanks! :-)

BR
Alois

TD-er
Core team member
Posts: 8752
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: cold boot / reset detection with dummydevice not working

#2 Post by TD-er » 01 Feb 2021, 22:12

What is the task nr of [Boot#watcher] ?
And why do you try to set 4 dummy tasks to these check values?

_Cyber_
Normal user
Posts: 115
Joined: 20 Oct 2019, 09:46

Re: cold boot / reset detection with dummydevice not working

#3 Post by _Cyber_ » 01 Feb 2021, 22:21

Boot#watcher is device 5.

I want to determine if the values were preserved and therefore I can trust them (values 0-100 on device 1 to 4) or if there was a boot and reset of all dummydevice values.

TD-er
Core team member
Posts: 8752
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: cold boot / reset detection with dummydevice not working

#4 Post by TD-er » 01 Feb 2021, 22:30

But you're not setting the value of this one.
Or do you set it manually to task 5 in the command textbox (tools page) for testing?

_Cyber_
Normal user
Posts: 115
Joined: 20 Oct 2019, 09:46

Re: cold boot / reset detection with dummydevice not working

#5 Post by _Cyber_ » 02 Feb 2021, 06:11

not in this one, I set it in another part of the rules, as soon as I did some action and I am sure I know the state of the dummydevices:

Code: Select all

on Rules#Timer=8 do
 if [Z1#M] = 0 and [Z2#M] = 0 and [Z3#M] = 0 and [SZ#M] = 0
  logentry,"No Movement, Power off"
  gpio,2,1
  TaskValueSet,5,1,-1
 else
  logentry,"Power still needed (SZ#M=[SZ#M] Z1#M=[Z1#M] Z2#M=[Z2#M] Z3#M=[Z3#M])"
  TimerSet,8,1
 endif
endon
so, after all dummydevices are set, Boot#watcher is -1 and I should not match in the if - but I do.

TD-er
Core team member
Posts: 8752
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: cold boot / reset detection with dummydevice not working

#6 Post by TD-er » 02 Feb 2021, 10:59

Just as a test, can you log the value of this boot watcher at boot?
This means you need to watch the logs from boot via serial.

Code: Select all

on System#Boot do
  logentry,"Boot#Watcher: [Boot#Watcher]"
  if [Boot#Watcher] = 0
 ....
 

_Cyber_
Normal user
Posts: 115
Joined: 20 Oct 2019, 09:46

Re: cold boot / reset detection with dummydevice not working

#7 Post by _Cyber_ » 04 Feb 2021, 21:36

have tried now several times - it always says " INIT : Cold Boot", it doesnt matter if i reboot it with the button in web interface or I reboot it with the EN button on the device.

here is a hardware button "EN" push log:

Code: Select all

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (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:1
load:0x3fff0010,len:4
load:0x3fff0014,len:812
load:0x40078000,len:0
load:0x40078000,len:10164
entry 0x400789f8
▒U38 : Info   :

INIT : Booting version:  (ESP32 SDK v3.2.3-14-gd3e562907)
39 : Info   : INIT : Free RAM:290940
39 : Info   : INIT : Cold Boot - Restart Reason: CPU0: Vbat power on reset CPU1: for APP CPU, reseted by PRO CPU
40 : Info   : FS   : Mounting...
82 : Info   : CRC  : SecuritySettings CRC   ...OK
149 : Info   : INIT : Free RAM:284920
151 : Info   : INIT : SPI not enabled
295 : Info   : INFO : Plugins: 47 [Normal] (ESP32 SDK v3.2.3-14-gd3e562907)
297 : Info   : EVENT: System#Wake
572 : Info   : WIFI : Set WiFi to STA
807 : Info   ▒▒▒▒▒▒▒x▒▒ ▒▒х▒сnetwork scan
2316 : Info   : WIF▒▒▒▒x▒x▒x▒▒ѥ▒▒▒<blanked> attempt #1
2318 : Info   : WIFI  : Arduino wifi status: WL_DISCONNECTED ESPeasy internal wifi status: DISCONNECTED
2322 : Info   : Webserver: start
2323 : Info   : WIFI : Starting mDNS...
2324 : Info   : WIFI : mDNS started, with name: RolloBackup.local
2329 : Info   : OTA  : Arduino OTA enabled on port 3232
2342 : Info   : EVENT: System#Boot
2434 : Info   : ACT  : logentry,"Boot#Watcher: 0"
2437 : Info   : Boot#Watcher: 0
2445 : Info   : ACT  : TaskValueSet,1,1,-1
2451 : Info   : ACT  : TaskValueSet,2,1,-1
2457 : Info   : ACT  : TaskValueSet,3,1,-1
2463 : Info   : ACT  : TaskValueSet,4,1,-1

boot with reboot button via GUI: (before I did set boot#watcher to -1, verified in gui before rebooting!

Code: Select all

30457 : Info   : EVENT: Z1#All=100.00,0.00,0.00,0
30577 : Info   : Dummy: value 1: 100.00
30579 : Info   : Dummy: value 2: 0.00
30580 : Info   : Dummy: value 3: 0.00
30582 : Info   : Dummy: value 4: 0
30593 : Info   : EVENT: Z2#All=100.00,0.00,0.00,0
30700 : Info   : EVENT: Z3#All=100.00,0.00,0.00,0
31680 : Info   :  Webserver args: 0: 'cmd' length: 6
31681 : Info   :      : Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (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:1
load:0x3fff0010,len:4
load:0x3fff0014,len:812
load:0x40078000,len:0
load:0x40078000,len:10164
entry 0x400789f8
▒U39 : Info   :

INIT : Booting version:  (ESP32 SDK v3.2.3-14-gd3e562907)
40 : Info   : INIT : Free RAM:290908
40 : Info   : INIT : Cold Boot - Restart Reason: CPU0: Software reset CPU CPU1: Software reset CPU
41 : Info   : FS   : Mounting...
83 : Info   : CRC  : SecuritySettings CRC   ...OK
150 : Info   : INIT : Free RAM:284956
152 : Info   : INIT : SPI not enabled
296 : Info   : INFO : Plugins: 47 [Normal] (ESP32 SDK v3.2.3-14-gd3e562907)
298 : Info   : EVENT: System#Wake
573 : Info   : WIFI : Set WiFi to STA
764 : Info   : WIFI  : Start network scan
2474 : Info   : WIFI : Connecting <blanked> attempt #1
2476 : Info   : WIFI  : Arduino wifi status: WL_DISCONNECTED ESPeasy internal wifi status: DISCONNECTED
2479 : Info   : Webserver: start
2480 : Info   : WIFI : Starting mDNS...
2481 : Info   : WIFI : mDNS started, with name: RolloBackup.local
2486 : Info   : OTA  : Arduino OTA enabled on port 3232
2499 : Info   : EVENT: System#Boot
2590 : Info   : ACT  : logentry,"Boot#Watcher: 0"
2593 : Info   : Boot#Watcher: 0
2602 : Info   : ACT  : TaskValueSet,1,1,-1
2608 : Info   : ACT  : TaskValueSet,2,1,-1
2613 : Info   : ACT  : TaskValueSet,3,1,-1
2619 : Info   : ACT  : TaskValueSet,4,1,-1
2799 : Info   : WIFI  : Scan finished, found: 4
2847 : Info   : Dummy: value 1: -1.00

TD-er
Core team member
Posts: 8752
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: cold boot / reset detection with dummydevice not working

#8 Post by TD-er » 04 Feb 2021, 22:32

Ah I now notice you are running on ESP32.
The RTC is not yet been implemented on ESP32 in ESPEasy.

I totally missed the ESP32 you mentioned in the start post.

_Cyber_
Normal user
Posts: 115
Joined: 20 Oct 2019, 09:46

Re: cold boot / reset detection with dummydevice not working

#9 Post by _Cyber_ » 06 Feb 2021, 10:23

thanks, that explains it. :D

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 117 guests