   if (queue_fore >= EventQueueLength)
     queue_fore = 0;
 
+  interrupts();
+
   // if queue full, abort
   if (queue_aft == queue_fore)
   {
-      event_dump_queue("ERROR: event queue full:");
+      event_dump_queue("ERROR: event queue full!");
       abort("Event queue full");
   }
-
-  interrupts();
-}
+}
+
+//----------------------------------------
+// Pop next event from the queue.
+//
+// Returns vfo_None if queue is empty.
+//----------------------------------------
 
 VFOEvent event_pop(void)
 {

  show_credits();
  
  // handle events in our own little event loop
  while (true)
  {
    // handle any pending event

const byte lcd_D6 = 11;
const byte lcd_D7 = 12;

// define the display connections
LiquidCrystal lcd(lcd_RS, lcd_ENABLE, lcd_D4, lcd_D5, lcd_D6, lcd_D7);

// define microcontroller pins controlling brightness and contrast
const byte mc_Brightness = 5;
const byte mc_Contrast = 6;

// define microcontroller pins connected to the rotary encoder
const int re_pinA = 2;     // encoder A pin
const int re_pinB = 3;     // encoder B pin
const int re_pinPush = 4;  // encoder pushbutton pin

// define microcontroller pins that control the DDS-60
const byte DDS_FQ_UD = 14;    // connected to AD9851 device select pin
const byte DDS_W_CLK = 15;    // connected to AD9851 clock pin
const byte DDS_DATA = 16;     // connected to AD9851 D7 (serial data) pin 

//-----
// Data and values used by the LCD code.
//-----

// max and min frequency showable
const unsigned long MaxFreq = 30000000L;
const unsigned long MinFreq = 1000000L;

// number of digits in the frequency display
const int NumFreqChars = 8;

// address in display CGRAM for definable and other characters
