     }
 }
 
-uint8_t dispMode = 0;
+typedef enum disp_mode_t
+{
+  BATTERY, POWER, ANALOG, LED_TEST, NUM_MODES
+} DISP_MODE;
+
+#define SECONDS     10        // counts per second
+
+DISP_MODE dispMode = BATTERY;
 
 void loop()
 {

	return enc_states[old_AB & 0x0f];
}

int counter = 0;
int16_t analogin = 0;
int16_t battery = 0;

static unsigned long ten_msec = millis();

void splash()
{
    int8_t segment = counter & 7;
    int8_t digit = (counter / 8) % LED_DIGITS;

//      +-o---o---o---o---o---o---o---o---o---o---o---o---o---o---o-+
//        |   |       |   |   |  E   D  DP   C   G  D4
//        |   +--POT--+   |   |
//        |   |   A-------+   |
//        |   +-----R1--------+
//        +---------R2--------+

#define R1        4700L
#define R2        10000L

#define MAX_BATTERY   (50*(R1+R2)/R1)

const byte ledPins[] = { /*segA-F+DP=*/ 5, 9, A2, A4, A5, 6, A1, A3, /*dig1-4=*/ 4, 7, 8, A0};

void setup()
