|
Post by topher2880 on Sept 25, 2019 0:28:30 GMT -8
I hope this isn't a repeat, but can't find it anywhere
I have the SunControl board and SkyWeather board and software.
Issue that I'm having with the watchdog is that the script isn't loading quick enough for the watchdog, so is rebooting every 2 minutes.
Unplug the watchdog and script loads etc, but occasionally hangs, so I would rather use it.
I get as far as Blynk updating before it flips it's lid and reboots, do I need another 30-60 seconds
Is there anything in the SkyWeather script to push the timer out to 3, or even 10 minutes?
|
|
|
Post by SDL on Sept 27, 2019 6:58:57 GMT -8
insert code here topher,
I can think of a couple of quick solutions. One would be to add:
patTheDog(); To line 18 of SkyWeather.py
That will call the watchdog patting very early in the program startup.
Let me know if that doesn't work. If it does, I'll just add that to the main code base.
BP
|
|
|
Post by topher2880 on Sept 28, 2019 4:03:02 GMT -8
Hi BP The most simplest things are usually the hardest  I didnt even think to shift the code lol I moved the patTheDog bock from 1486/1495 and shifted it to line 144, after importing most of the modules and before establishing WeatherSTEM and that seemed to be ok for the script to run. On plugging in the watchdog and usb power plugs the board still shuts down the power. I didnt get any Blynk message about shutting down etc, so its the board shutting it down, not the script.
|
|
|
Post by SDL on Sept 28, 2019 14:14:44 GMT -8
Hmm. SunControl right? I think that is 60 seconds. You can take the discrete watchdog to 240 seconds.
You can also put small python routine to pat the dog (same software) to be executed before you even start SkyWeather.
You do know that you have to EXECUTE the subroutine, not just move the definition right?
BP
|
|
|
Post by topher2880 on Sept 28, 2019 18:00:56 GMT -8
Yeah, SunControl board.  If I could push it out to 240s that would be awesome. Im mostly up and running within 120s and while I havent actually timed it, Blynk usually wakes up about the 90s mark, then its usually a minute or 2 until regular updates. Wait, I need to "patTheDog()" still ? hmmmm maybe I missed that haha
|
|
|
Post by topher2880 on Sept 28, 2019 18:10:40 GMT -8
I moved the entire block
def patTheDog():
# pat the dog
print "------Patting The Dog------- "
GPIO.setup(config.WATCHDOGTRIGGER, GPIO.OUT)
GPIO.output(config.WATCHDOGTRIGGER, False)
time.sleep(0.2)
GPIO.output(config.WATCHDOGTRIGGER, True)
GPIO.setup(config.WATCHDOGTRIGGER, GPIO.IN)
to line 144, so figured it was patting the dog. The only other reference I found was in line 1778, which DID state it was to reset the watchdog
scheduler.add_job(patTheDog, 'interval', seconds=10) # reset the WatchDog Timer But didnt move that... yet
|
|
|
Post by SDL on Sept 29, 2019 13:57:50 GMT -8
Topher,
That doesn't do anything. You need to stick
patTheDog()
to call the routine early in the program.
You are so close!
BP
|
|
|
Post by topher2880 on Sept 29, 2019 22:12:09 GMT -8
Hmmmm calling that threw an error and stopped the script for me That was why I shifted the entire block of code.. I will have another go at it... unless I do this maybe?? def patTheDog():
# pat the dog
print "------Patting The Dog------- "
GPIO.setup(config.WATCHDOGTRIGGER, GPIO.OUT)
GPIO.output(config.WATCHDOGTRIGGER, False)
time.sleep(0.2)
GPIO.output(config.WATCHDOGTRIGGER, True)
GPIO.setup(config.WATCHDOGTRIGGER, GPIO.IN)
scheduler.add_job(patTheDog, 'interval', seconds=10) # reset the WatchDog Timer
patTheDog()
|
|
|
Post by SDL on Sept 30, 2019 6:57:33 GMT -8
Put
scheduler.add_job(patTheDog, 'interval', seconds=10) # reset the WatchDog Timer
Back where it was. Just leave the rest where you have it.
BP
|
|
|
Post by topher2880 on Sept 30, 2019 20:22:44 GMT -8
All seems to be up and running again  Just have to wait for the script to drop out and see what happens. Thanks for your help BP
|
|
|
Post by SDL on Oct 6, 2019 16:13:09 GMT -8
You bet!
Very cool.
BP
|
|