     if(!result) {
       Serial.println("FAIL");
       Serial.println(err);
-      return i + 1;
+      if(first_failure == 0)
+        first_failure = i + 1;
     } else {
       Serial.println("OK");
     }
   }
-  return 0;
+  return first_failure;
 }
 
 void error_code(int code) {

  // Temporary values until we get production boards
  assert_nearly_equal("input_amp_6", Tsunami.measurePeakVoltage(), 3300, 100);

  Tsunami.setAmplitude(1000);
  delay(500);
  assert_nearly_equal("input_amp_1", Tsunami.measurePeakVoltage(), -1150, 100);

  Tsunami.setAmplitude(0);
  delay(500);

#include <tsunami.h>

#define LED_PIN 13
#define RUN_REPEATEDLY true

char err[255];

