       }
     }
     // If we are at the end, move on to state 2.
-    else if (selector_pos < 0 && last_selector_pos == 6)
+    else if (selector_pos < 0 && last_selector_pos == 6 && photoresistor_counts[0][6] > 5)
     {
       // This fills in gear_types and gear_orientations.
       // We check that it passes each time, and that

// How many frames to wait before toggling blinking lights
int BLINK_SPEED = 50; // 0.5s
// How many frames to wait before logging debug data, or 0 for never
int DEBUG_FREQ = 10000; // 2s

// MAIN TOPLEVEL STUFF


  if (state == 2)
  {
    setCalibration(true);
    if (selector_pos >= 0)
    {
      // Fill in new connection states.
      // Usually a noop.
