EMONGLCD: workaround for lockups

My Emonglcd regularly locked up every week. 

I made some debugging and I found that the code always halted on one of these two instructions:
rf12_sendStart(0, &emonglcd, sizeof emonglcd);
rf12_sendWait(0);

Did not investigate deeper into the sommunication library, but I found that the watchdog code being used on EmonTX is valid also for Emonglcd

Here are the lines I added to the code. With these modifications I had 2 months of operation without problems

#include <avr/wdt.h>
...
#include "EmonLib.h"
ISR(WDT_vect) { Sleepy::watchdogEvent(); }ISR(WDT_vect) { Sleepy::watchdogEvent(); }
... ...

wdt_enable(WDTO_8S); //before start of main loop: enable a 8s based watchdog
...
wdt_reset(); //on end of main loop

---------

Hope this could help others in my same situation.

Best regards

mharizanov's picture

Re: EMONGLCD: workaround for lockups

That has been discussed before, the problem is that you lose daily stats. Anyway better this than frozen unit.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.