  ****************************************************************************************
  Modified to add ShowCSV and HideCSV command - DSH
  Modified EEPROM configuration to add new values and delete old ones - DSH
+ Modified to add ShowAll/HideAll command - DSH
+ Modified to let ShowInterval and ShowRPM run without ShowAngle
+ Modified to check that xv_config is not too big for EEPROM
+ Modified to delete ShowDist/HideDist commands, since that functionality is subsumed by ShowAngle(s)
  
  See README for additional information 
  

  rpmPID.SetSampleTime(xv_config.sample_time);
  rpmPID.SetTunings(xv_config.Kp, xv_config.Ki, xv_config.Kd);
  rpmPID.SetMode(AUTOMATIC);
  initSerialCommands();                             // Add commands to te 'sCmd' object
  pinMode(ledPin, OUTPUT);
  eState = _eState_Find_COMMAND;                   // Initialize the 'state' for the main loop
  for (ixPacket = 0; ixPacket < _PACKET_LENGTH; ixPacket++)  // Initialize

                oldAngle = iCurrentAngle;
                if (xv_config.aryAngles[startingAngle + ix]) {  // if we're supposed to display that angle                    
                  if (aryInvalidDataFlag[ix] == 0) {            // make sure that the 'Invalid Data' flag is clear
                    if (eShow == _eOUT_ANGLE) {                 // only display this stuff if we're specifically displaying angles
                      if (xv_config.eOUT & _OUT_MOD_SHOW_CSV) {   // Display in CSV format?
                        Serial.print(startingAngle + ix);
                        Serial.print(F(","));
                        Serial.print(int(aryDist[ix]));
                        Serial.print(F(","));
                        Serial.println(aryQuality[ix]);
                      }
                      else {
                        Serial.print(startingAngle + ix);
                        Serial.print(F(": "));
                        Serial.print(int(aryDist[ix]));
                        Serial.print(F(" ("));
                        Serial.print(aryQuality[ix]);
                        Serial.println(F(")"));                         
                      }                                            
                    } // if (eShow == _eOUT_ANGLE)
                  } // if (aryInvalidDataFlag[ix] == 0)
                  else if (xv_config.eOUT & _OUT_MOD_SHOW_ERRORS) { // If we're supposed to show errors...
                    if (xv_config.bMotorEnable) {                   // and if the motor is spinning...
                      if (eShow == _eOUT_ANGLE) {                 // only display this stuff if we're specifically displaying angles
                        if (xv_config.eOUT & _OUT_MOD_SHOW_CSV) {     // Display in CSV format?
                          Serial.print(startingAngle + ix);
                          Serial.print(F(","));
                          if (aryInvalidDataFlag[ix] & _INVALID_DATA_FLAG)
                            Serial.println(F("I,"));
                          if (aryInvalidDataFlag[ix] & _STRENGTH_WARNING_FLAG) 
                            Serial.println(F("S,"));                                                
                        }
                        else {                                        // display in normal format
                          Serial.print(startingAngle + ix);
                          Serial.print(F(": "));
                          if (aryInvalidDataFlag[ix] & _INVALID_DATA_FLAG)
                            Serial.println(F("{I}"));
                          if (aryInvalidDataFlag[ix] & _STRENGTH_WARNING_FLAG) 
                            Serial.println(F("{S}"));                        
                        }                        
                      } // if (eShow == _eOUT_ANGLE)
                    } // if (xv_config.bMotorEnable)
                  }  // else if (xv_config.eOUT & _OUT_MOD_SHOW_ERRORS)
                }  // if (xv_config.aryAngles[startingAngle + ix])
