Home/Support/Support Forum/Machine.WDT - trouble instantiating object w non-default response

Machine.WDT - trouble instantiating object w non-default response

+1 vote
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.
asked Apr 3, 2020 in XBee3 Cellular by Larry_Sellers New to the Community (10 points)

Please log in or register to answer this question.

2 Answers

+1 vote
 
Best answer
Larry,

Glad to see you figured it out.

Digi Support
answered Apr 3, 2020 by mvut Veteran of the Digi Community (14,666 points)
selected Apr 3, 2020 by Larry_Sellers
0 votes
@Larry_Sellers,

Thank you for adding the resolution to your post. I was struggling with the same issue and your "SOLVED" helped tremendously and got it working for me.

Thanks!
answered Jan 13 by backpacker87 New to the Community (49 points)
...