Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit f29c675fcc5427c70c1d909a02d6677d9bc0a762 1 parent 5cb2982
@Traumflug authored
Showing with 20 additions and 0 deletions.
  1. +5 −0 config.h.dist
  2. +5 −0 watchdog.c
  3. +10 −0 watchdog.h
View
5 config.h.dist
@@ -93,6 +93,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
ANALOG_MASK - which analog inputs we will be using, bitmask. eg; #define ANALOG_MASK MASK(AIO0_PIN) | MASK(3) for AIN0 and AIN3
View
5 watchdog.c
@@ -1,5 +1,8 @@
+
#include "watchdog.h"
+#ifdef USE_WATCHDOG
+
#include <avr/wdt.h>
#include <avr/interrupt.h>
@@ -40,3 +43,5 @@ void wd_reset() {
wd_flag &= ~1;
}
}
+
+#endif /* USE_WATCHDOG */
View
10 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 */
Please sign in to comment.
Something went wrong with that request. Please try again.