 
 //----------------------------------------
 // The standard Arduino setup() function.
+// Called once on powerup.
 //----------------------------------------
 
 void setup(void)
 {
+  // initialize the BlankRow global to a blank string length of a display row
+  BlankRow = (char *) malloc(NUM_COLS + 1);     // size of one display row
+  for (int i = 0; i < NUM_COLS; ++i)
+    BlankRow[i] = ' ';
+  BlankRow[NUM_COLS] = '\0';
+
   // initialize the serial console
   Serial.begin(115200);
 
   // VFO wakes up in standby mode
   VfoMode = vfo_Standby;
+
+  // set brightness/contrast pin state
+  pinMode(mc_Brightness, OUTPUT);
+  pinMode(mc_Contrast, OUTPUT);
+
+  // get state back from EEPROM, set display brightness/contrast
+  restore_from_eeprom();
+  analogWrite(mc_Brightness, LcdBrightness);
+  analogWrite(mc_Contrast, LcdContrast);
 
   // initialize the display
   lcd.begin(NUM_COLS, NUM_ROWS);      // define display size
   lcd.clear();
   lcd.noCursor();
 
-  // set brightness/contrast pin state
-  pinMode(mc_Brightness, OUTPUT);
-  pinMode(mc_Contrast, OUTPUT);
-
-  // get state back from EEPROM, set display brightness/contrast
-  restore_from_eeprom();
-  analogWrite(mc_Brightness, LcdBrightness);
-  analogWrite(mc_Contrast, LcdContrast);
-
   // create underlined space for frequency display
   lcd.createChar(SPACE_CHAR, sel_digits[SPACE_INDEX]);
 
   // set up the DDS device
   dds_setup();
 
-  // set up the rotary encoder, reset a few things if RE button down
+  // set up the rotary encoder
+  // reset a few things if RE button down during powerup
+  // the aim is to get the user out of an "unusable" VFO state
   if (re_setup())
   {
     LcdBrightness = DefaultLcdBrightness;

  show_credits();
  delay(900);    // wait a bit

  // do a fade out, clear screen then full brightness
  for (int i = LcdBrightness; i; --i)
  {
    analogWrite(mc_Brightness, i);
    delay(10);
  }
  lcd.clear();
  delay(400);

struct MenuItem mi_contrast = {"Contrast", NULL, &contrast_action};
struct MenuItem mi_holdclick = {"Hold click", NULL, &holdclick_action};
struct MenuItem mi_doubleclick = {"Double click", NULL, &doubleclick_action};
struct MenuItem mi_calibrate = {"Calibrate", NULL, &calibrate_action};
struct MenuItem *mia_settings[] = {&mi_brightness, &mi_contrast, &mi_holdclick,
                                   &mi_doubleclick, &mi_calibrate};
struct Menu settings_menu = {"Settings", ALEN(mia_settings), mia_settings};

//----------------------------------------
// main menu
