The unified diff between revisions [4f22e7ef..] and [9ca449dd..] is displayed below. It can also be downloaded as a raw diff.

This diff has been restricted to the following files: 'panic.c'

#
# old_revision [4f22e7ef7d3064e3b51a5b868a4722f3f13c747b]
# new_revision [9ca449dd7941ad52e33bdcb5c28b2ba35d54219a]
#
# patch "panic.c"
#  from [d33cc5af7411880a40d87b7d56a9086705b49112]
#    to [2f700032fc2a9007e14fd1fa648575a0336ad211]
#
============================================================
--- panic.c	d33cc5af7411880a40d87b7d56a9086705b49112
+++ panic.c	2f700032fc2a9007e14fd1fa648575a0336ad211
@@ -13,17 +13,38 @@
 #include "motor.h"
 #include "led.h"
 
+#ifdef PANIC_CHECKPOINT
+unsigned int checkpoint;
+#endif
+
+#ifdef PANIC_32BIT
+#define PANIC_BITS 32
+#else
+#define PANIC_BITS 16
+#endif
+
+#ifdef PANIC_32BIT
 led_pattern led_pattern_panic[] = {100, 100, 100, 100, 100, 100, 100, 100,
 				   100, 100, 100, 100, 100, 100, 100, 100,
 				   100, 100, 100, 100, 100, 100, 100, 100,
+				   100, 100, 100, 100, 100, 100, 100, 100,
+				   100, 100, 100, 100, 100, 100, 100, 100,
+				   100, 100, 100, 100, 100, 100, 100, 100,
+				   100, 100, 100, 100, 100, 100, 100, 100,
 				   100, 100, 100, 100, 100, 100, 100, 3000, 0};
+#else
+led_pattern led_pattern_panic[] = {100, 100, 100, 100, 100, 100, 100, 100,
+				   100, 100, 100, 100, 100, 100, 100, 100,
+				   100, 100, 100, 100, 100, 100, 100, 100,
+				   100, 100, 100, 100, 100, 100, 100, 3000, 0};
+#endif
 
 /* Take the lower 16 bits and make a pattern of them, MSB first */
 static void panic_create_pattern(led_pattern *pattern, unsigned int reason)
 {
 	int i;
-	for (i = 0; i < 16; i++) {
-		if (reason & (1<<(15-i))) {
+	for (i = 0; i < PANIC_BITS; i++) {
+		if (reason & (1<<((PANIC_BITS-1)-i))) {
 			pattern[2*i] = 400;
 			pattern[2*i+1] = 100;
 		} else {
@@ -32,19 +53,16 @@ static void panic_create_pattern(led_pat
 		}
 		if ((i % 4) == 3)
 			pattern[2*i+1] += 500;
-		if (i == 15)
+		if (i == (PANIC_BITS-1))
 			pattern[2*i+1] += 2500;
 	}
 }
 
 void panic(unsigned int reason)
 {
-	/*
-	 * We may one day be able to do something with the reason, like emit
-	 * a final deathbed confession. So we'll provide the reasons in the
-	 * caller and just ignore them for now.
-	 */
-	(void)reason;
+#if PANIC_CHECKPOINT
+	reason = checkpoint;
+#endif
 
 	motor_kill();