Last edited · 2 revisions  

 


Double Press routine

// is knob PRESSED
  if (digitalRead (encS) == 0) {           // encoder switch IS pressed
    while (digitalRead (encS) == 0){    // while it's held down
      ButtonDown++;                           // incriment the delay counter
      delay(100);
      if (ButtonDown == 10) {               // if button held for 1s
        eeSave();                                  // go to LONG-PRESS routine
        break; }
    }
    if (ButtonDown < 10) TuneStep();  // go to SHORT-PRESS routine
    ButtonDown = 1;
  }


Display commas for frequency


void showFreq() {
  long  MHz = int(dialVal / 1000000);
  long hkHz =   ((dialVal / 100000) % 10);
  long tkHz =   ((dialVal / 10000) % 10);
  long  kHz =   ((dialVal / 1000) % 10);
  long  hHz =   ((dialVal / 100) % 10);
  long  tHz =   ((dialVal / 10) % 10);
  long   Hz =   ((dialVal / 1) % 10);
 
  lcd.setCursor(7, 0);
  if    (MHz < 10)  lcd.print (" ") ; lcd.print (MHz); lcd.print (",");
  lcd.print (hkHz); lcd.print (tkHz); lcd.print (kHz); lcd.print (",");
  lcd.print (hHz) ; lcd.print (tHz) ; lcd.print (Hz) ; lcd.print (" Hz");
}