 #define DEBUG_RE      (1 << 5)
 #define DEBUG_INT     (1 << 6)
 #define DEBUG_DISP    (1 << 7)
-#if INC_BATTERY
 #define DEBUG_BATT    (1 << 8)
-#endif
 
 #define DEBUG         (DEBUG_BATT)
 //#define DEBUG         0

//-----

// milliseconds delay between measuring battery voltage
//const int VoltageDelay = 1000;
const int VoltageDelay = 30000;

// stuff for the calibrate action
const int MinClockOffset = -32000;

struct MenuItem *mia_main[] = {&mi_slots, &mi_settings, &mi_reset, &mi_credits};
struct Menu menu_main = {"Menu", ALEN(mia_main), mia_main};

//----------------------------------------
// Measure the battery voltage.
// We measure every "MeasureVoltageDelay" milliseconds, update the battery symbol.
// If DEBUG reporting is turned on, we report every "ReportVoltageDelay" measurements.
//----------------------------------------

void measure_battery(void)
{
  // get the time since the last measurement
  static long last_volts_time = -MeasureVoltageDelay;    // millis() value last time we measured
  long now_milli = millis();
  if (now_milli < last_volts_time)
    last_volts_time = -MeasureVoltageDelay;    // handle wraparound of millis()

  // if not time yet, return
  if (now_milli < last_volts_time + MeasureVoltageDelay)
    return;

  // measuring, set measurement time to "now"
  last_volts_time = now_milli;
      
  // measure voltage, we will get a value of 1023 for 3.3 volts
  UINT measured = analogRead(mc_BattVolts);
  MeasuredVoltage = ((3.3 * measured) / 1023) * (32.0/10.0);

#if (DEBUG & DEBUG_BATT)
  static int batt_report_count = 0;
  if (++batt_report_count > 0)
  {
    Serial.printf(F("raw volts=%d, "), measured);
  }
#endif

  // figure out which battery symbol to use
  if (MeasuredVoltage < MinVoltage)
  {
    if (MeasuredVoltage < 1.0)
    {
      BatterySymbol = battnone;
#if (DEBUG & DEBUG_BATT)
      if (batt_report_count > 0)
        Serial.printf(F("no battery\n"));
#endif      
    }
    else
    {
      BatterySymbol = battunder;
#if (DEBUG & DEBUG_BATT)
      if (batt_report_count > 0)
        Serial.printf(F("battery under voltage\n"));
#endif      
    }
  }
  else if (MeasuredVoltage > MaxVoltage)
  {
    BatterySymbol = battover;
#if (DEBUG & DEBUG_BATT)
    if (batt_report_count > 0)
      Serial.printf(F("battery over voltage\n"));
#endif      
  }
  else
  {
    int percent = (int) ((MeasuredVoltage - MinVoltage) / (MaxVoltage - MinVoltage) * 100.0);
    int batt_bucket = (int) (percent/20);
    BatterySymbol = batt_syms[batt_bucket + 2];
#if (DEBUG & DEBUG_BATT)
    if (batt_report_count > 0)
    {
      Serial.printf(F("actual volts=%f, percent=%d, batt_bucket=%d\n"),
                      MeasuredVoltage, percent, batt_bucket);
      batt_report_count = -ReportVoltageDelay;
    }
#endif
  }
}

//----------------------------------------
// Do any commands from the external controller.
//----------------------------------------

void do_external_commands(void)
{
  // gather any commands from the external controller
  while (Serial.available()) 
  {
    char ch = Serial.read();
