Hello,
I am playing with the WDT that was implement in *15 on an XBee3 Cat-m/NBIot unit. I am having trouble passing in the response parameter. I understand it should be instantiated like this:
wdt = machine.WDT(ID, timer duration, response)
where
ID = 0. Must be zero
timer duration = integer that defines the timer length. 2 mintues -> 120000
response = one of three options: SOFT_RESET, HARD_RESET, CLEAN_SHUTDOWN
I have my code set up like this:
wdt = machine.WDT(0, 120000, CLEAN_SHUTDOWN)
However PyCharm is not recognizing the CLEAN_SHUTDOWN parameter and throwing an error. I looked into the umachine file and found the definitions, but they appear to be pulled from somewhere else or are not defined. I did try a “0”, “1”, and “2” thinking they might be indexed from 0, but no luck. The compiler didn’t throw an error and it built, but the code puked.
I might be doing something really dumb here…so I would appreciate any help. This is going to be a big help to have the watchdog. For now I am simply leaving the response parameter out and it’s using the default which is a soft reset. This should work great for me, but I would like to do some testing with the others.
On a side thought, I could go into the library and re-default it to something else, but the programming gods will likely smite me for doing that.
Thanks!!
SOLVED*************
EDIT: So it turns out I was doing something silly. I had to use the full class.variable format. So use the following:
SOFT_RESET = machine.SOFT_RESET
HARD_RESET = machine.HARD_RESET
CLEAN_SHUTDOWN = machine.CLEAN_SHUTDOWN
If you are coding in PyCharm, it should start to autofill - then you know the variable is defined.