Oskar Weigl
/
Quadcopterv2
This is for ICRS\' second generation Quadcopter
Diff: System.h
- Revision:
- 0:0bbf2f16da9c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/System.h Fri Nov 18 18:23:33 2011 +0000 @@ -0,0 +1,32 @@ + +//General system functions + +#include <string> + +// +void kill(string reason = "Killed for no reason!") { + PWMleft = NOPOWER - 0.004; + PWMright = NOPOWER - 0.004; + PWMfront = NOPOWER - 0.004; + PWMrear = NOPOWER - 0.004; + //TODO: send this over RF as well.. + pc.printf("%s\r\n", reason.c_str()); + /*wait(0.5); + left = 0; + right = 0; + front = 0; + rear = 0; + */ + while (1); +} + +// +void wdt() { + if (!loopalive) + kill("Killed by WDT: loop has stalled"); + if (!commandsalive) + kill("Killed by WDT: command starvation"); + + loopalive = 0; + commandsalive = 0; +}