From f29c675fcc5427c70c1d909a02d6677d9bc0a762 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Sat, 2 Oct 2010 15:49:50 +0200 Subject: [PATCH] Wrap the watchdog in #ifdefs and disable it for now. My poor imagination can't think of a situation where resetting the controller in the middle of a build would be useful. Even hanging ist better :-/ The difference in program size is just 238 bytes. --- config.h.dist | 5 +++++ watchdog.c | 5 +++++ watchdog.h | 10 ++++++++++ 3 files changed, 20 insertions(+) diff --git a/config.h.dist b/config.h.dist index e4e6f6d..fb05bc5 100644 --- a/config.h.dist +++ b/config.h.dist @@ -92,6 +92,11 @@ firmware build options */ #define MOVEBUFFER_SIZE 8 +/* + FiveD on Arduino implements a watchdog, which has to be reset every 250ms or it will reboot the controller. As rebooting (and letting the GCode sending application trying to continue the build with a then different Home point) is probably even worse than just hanging, and there is no better restore code in place, this is disabled for now. +*/ +// #define USE_WATCHDOG + /* analog subsystem stuff REFERENCE - which analog reference to use. see analog.h for choices diff --git a/watchdog.c b/watchdog.c index e70edd3..28cbe32 100644 --- a/watchdog.c +++ b/watchdog.c @@ -1,5 +1,8 @@ + #include "watchdog.h" +#ifdef USE_WATCHDOG + #include #include @@ -40,3 +43,5 @@ void wd_reset() { wd_flag &= ~1; } } + +#endif /* USE_WATCHDOG */ diff --git a/watchdog.h b/watchdog.h index 6a7ed4d..bac43c9 100644 --- a/watchdog.h +++ b/watchdog.h @@ -1,6 +1,10 @@ #ifndef _WATCHDOG_H #define _WATCHDOG_H +#include "config.h" + +#ifdef USE_WATCHDOG + // initialize void wd_init(void) __attribute__ ((cold)); @@ -9,4 +13,10 @@ void wd_reset(void); // notable lack of disable function +#else /* USE_WATCHDOG */ + +#define wd_init() /* empty */ +#define wd_reset() /* empty */ + +#endif /* USE_WATCHDOG */ #endif /* _WATCHDOG_H */