commit e5606def6b638600982feab777c2fff00b84d10f
Author: galberding <galberding@techfak.uni-bielefeld.de>
Date:   Sun Jun 21 14:24:03 2020 +0200

    Add state transition tracking, prevent overflow of tracking buffer

diff --git a/devices/DiWheelDrive/main.cpp b/devices/DiWheelDrive/main.cpp
index c7238c9..408a01b 100644
--- a/devices/DiWheelDrive/main.cpp
+++ b/devices/DiWheelDrive/main.cpp
@@ -914,58 +914,58 @@ void shellRequestErrorInfo(BaseSequentialStream *chp, int argc, char *argv[]){
   // Print out the error info collected. Clear buffer after calling
   chprintf(chp, "Error Info\n");
   chprintf(chp, "\n");
-  // uint8_t IDLE                = 0;
-  // uint8_t FOLLOW_LINE         = 1;
-  // uint8_t DETECT_STATION      = 2;
-  // uint8_t REVERSE             = 3;
-  // uint8_t PUSH_BACK           = 4;
-  // uint8_t CHECK_POSITIONING   = 5;
-  // uint8_t CHECK_VOLTAGE       = 6;
-  // uint8_t CHARGING            = 7;
-  // uint8_t RELEASE             = 8;
-  // uint8_t RELEASE_TO_CORRECT  = 9;
-  // uint8_t CORRECT_POSITIONING = 10;
-  // uint8_t TURN                = 12;
-  // uint8_t INACTIVE            = 13;
-  // uint8_t CALIBRATION         = 14;
-  // uint8_t CALIBRATION_CHECK   = 15;
-  // uint8_t DEVIATION_CORRECTION = 16;
-  // uint8_t DOCKING_ERROR       = 16+1;
-  // uint8_t REVERSE_TIMEOUT_ERROR   = 16+2;
-  // uint8_t CALIBRATION_ERROR   = 16+3;
-  // uint8_t WHITE_DETECTION_ERROR   = 16+4;
-  // uint8_t PROXY_DETECTION_ERROR   = 16+5;
-  // uint8_t NO_CHARGING_POWER_ERROR   = 16+6;
-  // uint8_t UNKNOWN_STATE_ERROR   = 16+7;
-
-  // chprintf(chp, "IDLE: %d\n", global.stateTracker[IDLE]);
-  // chprintf(chp, "FOLLOW_LINE: %d\n", global.stateTracker[FOLLOW_LINE]);
-  // chprintf(chp, "DETECT_STATION: %d\n", global.stateTracker[DETECT_STATION]);
-  // chprintf(chp, "REVERSE: %d\n", global.stateTracker[REVERSE]);
-  // chprintf(chp, "PUSH_BACK: %d\n", global.stateTracker[PUSH_BACK]);
-  // chprintf(chp, "CHECK_POSITIONING: %d\n", global.stateTracker[CHECK_POSITIONING]);
-  // chprintf(chp, "CHECK_VOLTAGE: %d\n", global.stateTracker[CHECK_VOLTAGE]);
-  // chprintf(chp, "CHARGING: %d\n", global.stateTracker[CHARGING]);
-  // chprintf(chp, "RELEASE: %d\n", global.stateTracker[RELEASE]);
-  // chprintf(chp, "RELEASE_TO_CORRECT: %d\n", global.stateTracker[RELEASE_TO_CORRECT]);
-  // chprintf(chp, "CORRECT_POSITIONING: %d\n", global.stateTracker[CORRECT_POSITIONING]);
-  // chprintf(chp, "TURN: %d\n", global.stateTracker[TURN]);
-  // chprintf(chp, "INACTIVE: %d\n", global.stateTracker[INACTIVE]);
-  // chprintf(chp, "CALIBRATION: %d\n", global.stateTracker[CALIBRATION]);
-  // chprintf(chp, "CALIBRATION_CHECK: %d\n", global.stateTracker[CALIBRATION_CHECK]);
-  // chprintf(chp, "DEVIATION_CORRECTION: %d\n", global.stateTracker[DEVIATION_CORRECTION]);
-  // chprintf(chp, "DOCKING_ERROR: %d\n", global.stateTracker[DOCKING_ERROR]);
-  // chprintf(chp, "REVERSE_TIMEOUT_ERROR: %d\n", global.stateTracker[REVERSE_TIMEOUT_ERROR]);
-  // chprintf(chp, "CALIBRATION_ERROR: %d\n", global.stateTracker[CALIBRATION_ERROR]);
-  // chprintf(chp, "WHITE_DETECTION_ERROR: %d\n", global.stateTracker[WHITE_DETECTION_ERROR]);
-  // chprintf(chp, "PROXY_DETECTION_ERROR: %d\n", global.stateTracker[PROXY_DETECTION_ERROR]);
-  // chprintf(chp, "NO_CHARGING_POWER_ERROR: %d\n", global.stateTracker[NO_CHARGING_POWER_ERROR]);
-  // chprintf(chp, "UNKNOWN_STATE_ERROR: %d\n", global.stateTracker[UNKNOWN_STATE_ERROR]);
-
-  // for (int i=0; i<24;i++){
-  //   global.stateTracker[i] = 0;
-
-  // }
+  uint8_t IDLE                = 0;
+  uint8_t FOLLOW_LINE         = 1;
+  uint8_t DETECT_STATION      = 2;
+  uint8_t REVERSE             = 3;
+  uint8_t PUSH_BACK           = 4;
+  uint8_t CHECK_POSITIONING   = 5;
+  uint8_t CHECK_VOLTAGE       = 6;
+  uint8_t CHARGING            = 7;
+  uint8_t RELEASE             = 8;
+  uint8_t RELEASE_TO_CORRECT  = 9;
+  uint8_t CORRECT_POSITIONING = 10;
+  uint8_t TURN                = 12;
+  uint8_t INACTIVE            = 13;
+  uint8_t CALIBRATION         = 14;
+  uint8_t CALIBRATION_CHECK   = 15;
+  uint8_t DEVIATION_CORRECTION = 16;
+  uint8_t DOCKING_ERROR       = 16+1;
+  uint8_t REVERSE_TIMEOUT_ERROR   = 16+2;
+  uint8_t CALIBRATION_ERROR   = 16+3;
+  uint8_t WHITE_DETECTION_ERROR   = 16+4;
+  uint8_t PROXY_DETECTION_ERROR   = 16+5;
+  uint8_t NO_CHARGING_POWER_ERROR   = 16+6;
+  uint8_t UNKNOWN_STATE_ERROR   = 16+7;
+
+  chprintf(chp, "IDLE: %d\n", global.stateTracker[IDLE]);
+  chprintf(chp, "FOLLOW_LINE: %d\n", global.stateTracker[FOLLOW_LINE]);
+  chprintf(chp, "DETECT_STATION: %d\n", global.stateTracker[DETECT_STATION]);
+  chprintf(chp, "REVERSE: %d\n", global.stateTracker[REVERSE]);
+  chprintf(chp, "PUSH_BACK: %d\n", global.stateTracker[PUSH_BACK]);
+  chprintf(chp, "CHECK_POSITIONING: %d\n", global.stateTracker[CHECK_POSITIONING]);
+  chprintf(chp, "CHECK_VOLTAGE: %d\n", global.stateTracker[CHECK_VOLTAGE]);
+  chprintf(chp, "CHARGING: %d\n", global.stateTracker[CHARGING]);
+  chprintf(chp, "RELEASE: %d\n", global.stateTracker[RELEASE]);
+  chprintf(chp, "RELEASE_TO_CORRECT: %d\n", global.stateTracker[RELEASE_TO_CORRECT]);
+  chprintf(chp, "CORRECT_POSITIONING: %d\n", global.stateTracker[CORRECT_POSITIONING]);
+  chprintf(chp, "TURN: %d\n", global.stateTracker[TURN]);
+  chprintf(chp, "INACTIVE: %d\n", global.stateTracker[INACTIVE]);
+  chprintf(chp, "CALIBRATION: %d\n", global.stateTracker[CALIBRATION]);
+  chprintf(chp, "CALIBRATION_CHECK: %d\n", global.stateTracker[CALIBRATION_CHECK]);
+  chprintf(chp, "DEVIATION_CORRECTION: %d\n", global.stateTracker[DEVIATION_CORRECTION]);
+  chprintf(chp, "DOCKING_ERROR: %d\n", global.stateTracker[DOCKING_ERROR]);
+  chprintf(chp, "REVERSE_TIMEOUT_ERROR: %d\n", global.stateTracker[REVERSE_TIMEOUT_ERROR]);
+  chprintf(chp, "CALIBRATION_ERROR: %d\n", global.stateTracker[CALIBRATION_ERROR]);
+  chprintf(chp, "WHITE_DETECTION_ERROR: %d\n", global.stateTracker[WHITE_DETECTION_ERROR]);
+  chprintf(chp, "PROXY_DETECTION_ERROR: %d\n", global.stateTracker[PROXY_DETECTION_ERROR]);
+  chprintf(chp, "NO_CHARGING_POWER_ERROR: %d\n", global.stateTracker[NO_CHARGING_POWER_ERROR]);
+  chprintf(chp, "UNKNOWN_STATE_ERROR: %d\n", global.stateTracker[UNKNOWN_STATE_ERROR]);
+
+  for (int i=0; i<24;i++){
+    global.stateTracker[i] = 0;
+
+  }
 }
 
 
