 
     next_demo_loop_at = millis() + DEMO_LOOP_PERIOD;
     demo_loop_count = 0;
+
+    // OK, all done, just wait for display test to time out
+    while(millis() - dt_shown_at < DPY_TST_DURATION) {
+        // NOP
+    }
+    setMX7219Reg(MX7219_DPLY_TEST, 0x00);
 }
 
 void loop() {
-    // Display test off after DPY_TST_DURATION milliseconds
-    if(showing_dt && (millis() - dt_shown_at > DPY_TST_DURATION)) {
-        showing_dt = false;
-        setMX7219Reg(MX7219_DPLY_TEST, 0x00);
-    }
-
     // Poll switches
     mode_switch.poll();
     select_switch.poll();

// Status bits
byte status_bits;

// Showing display test and time at which test started
bool showing_dt;
unsigned long dt_shown_at;
const int DPY_TST_DURATION = 500; // milliseconds

// Is processor stopped?

    pinMode(MOSI, INPUT);   // NB: (1)
    pinMode(SCLK, OUTPUT);
    pinMode(DLOAD, OUTPUT);
    pinMode(BTN_MODE, INPUT_PULLUP);
    pinMode(BTN_SELECT, INPUT_PULLUP);

    // Set up MX7219 with display test on
    setupMX7219();
    setMX7219Reg(MX7219_SCN_LIMIT, 0x06);   // Scan digits 0-6
    setMX7219Reg(MX7219_DPLY_TEST, 0x01);   // Enable display test
    unsigned long dt_shown_at = millis();   // Record display test time

    // Initial address/data bus values
    address_bus = data_bus = 0;
