           menu_flash();
           break;
         case vfo_HoldClick:
-          flush_events();
+          event_flush();
           return;
         default:
           // ignored events we don't handle

    // this pin's rising edge
    if (re_down)
    {
      push_event(vfo_DnRLeft);
      re_rotation = true;
    }
    else
    {
      push_event(vfo_RLeft);
    }
    bFlag = 0; //reset flags for the next turn
    aFlag = 0; //reset flags for the next turn

}

//----------------------------------------
// Draw a click hold time in milliseconds on row 1 of LCD.
//----------------------------------------

void draw_row1_time(int msec)
{
  Serial.print("draw_row1_time: msec="); Serial.print(msec);
  Serial.print(", ReHoldClickTime="); Serial.println(ReHoldClickTime);
  
  lcd.setCursor(0, 1);
  lcd.print(BlankRow);
  
  if (msec == ReHoldClickTime)
  {
    Serial.println("draw_row1_time: drawing *");
    lcd.setCursor(0, 1);
    lcd.write(IN_USE_CHAR);
  }
  
  lcd.setCursor(8, 1);
  if (msec < 1000)
    lcd.setCursor(9, 1);
  lcd.print(msec);
  lcd.print("msec");
}

//----------------------------------------
// Set the current 'hold click' time and save to EEPROM if 'actioned'.
//   menu      address of 'calling' menu
//   item_num  index of MenuItem we were actioned from
// This works differently from brightness/contrast.  We show menuitems
// of the time to use.
//----------------------------------------

void holdclick_action(struct Menu *menu, int item_num)
{
  Serial.println("holdclick_action: entered");

  int holdtime = ReHoldClickTime;
  
// the step time for hold click
#define HOLD_STEP   100

  // get rid of any stray events to this point
  event_flush();

  // draw row 0 of menu, get heading from MenuItem
  lcd.clear();
  lcd.print(menu->items[item_num]->title);
  
  // show row slot info on row 1
  draw_row1_time(holdtime);

  // handle events in our own little event loop
  while (true)
  {
    // handle any pending event
    if (event_pending() > 0)
    {
      byte event = event_pop(); // get next event and handle it

      switch (event)
      {
        case vfo_RLeft:
          holdtime -= HOLD_STEP;
          if (holdtime < MinHoldClickTime)
            holdtime = MinHoldClickTime;
          Serial.print("holdclick_action: vfo_RLeft, after holdtime=");
          Serial.println(holdtime);
          break;
        case vfo_RRight:
          holdtime += HOLD_STEP;
          if (holdtime > MaxHoldClickTime)
            holdtime = MaxHoldClickTime;
          Serial.print("holdclick_action: vfo_RRight, after holdtime=");
          Serial.println(holdtime);
          break;
        case vfo_Click:
          ReHoldClickTime = holdtime;
          save_to_eeprom();
          menu_flash();
          break;
        case vfo_HoldClick:
          event_flush();
          return;
        default:
          // ignored events we don't handle
          break;
      }

      // show hold time value in row 1
      draw_row1_time(holdtime);
    }
  }
}


//----------------------------------------
// Settings menu
//----------------------------------------

struct MenuItem mi_brightness = {"Brightness", NULL, &brightness_action};
struct MenuItem mi_contrast = {"Contrast", NULL, &contrast_action};
struct MenuItem mi_holdclick = {"Hold click", NULL, &holdclick_action};
struct MenuItem *mia_settings[] = {&mi_brightness, &mi_contrast, &mi_holdclick};
struct Menu settings_menu = {"Settings", ARRAY_LEN(mia_settings), mia_settings};

//----------------------------------------
