No it's not.
Initialize watchdog timer from function
-
- Posts: 59
- Joined: Mon Mar 29, 2021 1:36 am
- Location: Brisbane Australia
-
- Posts: 59
- Joined: Mon Mar 29, 2021 1:36 am
- Location: Brisbane Australia
Re: Initialize watchdog timer from function
The error you report here shows that `wdt.feed()` is being called at startup *before* `wdt = WDT(timeout=120_000)`.
Re: Initialize watchdog timer from function
Code: Select all
from machine import WDT
def start_up(): # This is run FIRST... init wifi ble etc
global wdt
other stuff....
wdt = WDT(timeout=120_000) # 2min
def run_ing(): # This is run AFTER start_up and is run every min.
global wdt
wdt.feed()
other stuff....
not start_up()
Re: Initialize watchdog timer from function
Nobody cares how you name the functions where WDT() and wdt.feed() get called.PM-TPI wrote: ↑Thu Jun 30, 2022 3:09 pmwdt.feed() is in... run_ing()Code: Select all
from machine import WDT def start_up(): # This is run FIRST... init wifi ble etc global wdt other stuff.... wdt = WDT(timeout=120_000) # 2min def run_ing(): # This is run AFTER start_up and is run every min. global wdt wdt.feed() other stuff....
not start_up()
In your case, run_ing() is (obviously) called somewhere before the Watchdog object instance (=wdt) gets created.
Also note that you need to declare the global variable near the beginning of your file ("wdt = None" like in a previous post).
A few hours of debugging might save you from minutes of reading the documentation!
My repositories: https://github.com/karfas
My repositories: https://github.com/karfas