Need to start wdt after all other settings are complete.
I tried this, no go
Code: Select all
def start_up():
global wdt
other stuff....
wdt = WDT(timeout=120_000) # 2min
Code: Select all
def start_up():
global wdt
other stuff....
wdt = WDT(timeout=120_000) # 2min
Code: Select all
from machine import WDT
You'll need to post more of your code. Something else is accessing the wdt variable.
Code: Select all
from machine import WDT
def start_up():
global wdt
other stuff....
wdt = WDT(timeout=120_000) # 2min
def run_ing(): # this is hit every min
global wdt
wdt.feed()
other stuff....
Code: Select all
from machine import WDT
wdt = 0
Code: Select all
from machine import WDT
wdt = WDT(timeout=120_000) # 2min
Code: Select all
from machine import WDT
wdt = 0
def start_up():
global wdt
other stuff....
wdt = WDT(timeout=120_000) # 2min
def run_ing(): # this is hit every min
global wdt
wdt.feed()
other stuff....
Code: Select all
from machine import WDT
wdt = WDT(timeout=120000) # 2min
Code: Select all
from machine import WDT
wdt = WDT(timeout=120_000) # 2min
Code: Select all
from machine import WDT
shaft_interrupt = False
def handle_interrupt(xyz): # needs something
global shaft_interrupt
shaft_interrupt = True
pir = Pin(33, Pin.IN, Pin.PULL_UP)
pir.irq(trigger=Pin.IRQ_FALLING, handler=handle_interrupt)
The only thing wrong with your above code is that you can't `feed()` the WDT until it has been initialized. So just change the feed line to:PM-TPI wrote: ↑Wed Jun 29, 2022 12:49 amCode: Select all
from machine import WDT wdt = 0 def start_up(): global wdt other stuff.... wdt = WDT(timeout=120_000) # 2min def run_ing(): # this is hit every min global wdt wdt.feed() other stuff....
Code: Select all
if wdt:
wdt.feed()
I thought... wdt = WDT(timeout=120_000) in start_up() did the initializing Note: start_up() is run before run_ing()The only thing wrong with your above code is that you can't `feed()` the WDT until it has been initialized. So just change the feed line to: