Page 1 of 1
System event that is only triggered by coldboot
Posted: 22 Jul 2022, 21:58
by chromo23
Is there a way to determine whenever there is a wake from sleep or a coldboot?
It seems that system#wake and system#boot are triggered either way.
I wanted to prevent a deepsleep via rules by setting a variable only after a coldboot instead of using a pin.
I thought about something like this:
Code: Select all
On System#Wake Do
Let,1,0
Endon
On Rules#Timer=1 Do
If [var#1]=1
DeepSleep,60
Else
TimerSet,1,30
Let,3,1
Endif
Endon
Re: System event that is only triggered by coldboot
Posted: 22 Jul 2022, 22:02
by chromo23
When i look at this event it seems counterintuitive to use it but it is triggered before System#Boot right?
Re: System event that is only triggered by coldboot
Posted: 22 Jul 2022, 22:06
by TD-er
You can add a dummy task and set a value in that dummy using taskvalueset.
Since it is a task value, it will be kept in RTC memory and restored on a warm boot.
Re: System event that is only triggered by coldboot
Posted: 22 Jul 2022, 22:16
by chromo23
Of course...had a knot in my head...
Working code:
Code: Select all
On Rules#Timer=1 do
If [boot#isboot]=1
DeepSleep,30
Else
TimerSet,1,30
TaskValueSet,boot,1,1
Endif
Endon
Re: System event that is only triggered by coldboot
Posted: 22 Jul 2022, 23:28
by Ath
Setting var#1 to zero on wake isn't any helpful, as it will also be 0 on system#boot/cold boot
Re: System event that is only triggered by coldboot
Posted: 23 Jul 2022, 00:02
by chromo23
I knooooow but i didn´t want to take any chances to mess up with deepsleep and i somehow was afraid, that if i don´t declare it, i will be in a undefined state
(It´s a kind of hardwarethinking where a pin behaves unpredictable when you don’t pull it up or down)...