Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

DL5SMB Aug 23rd, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void doTuningWithThresHold(){
  2.   int s = 0;
  3.   unsigned long prev_freq;
  4.  
  5.   if ((vfoActive == VFO_A && ((isDialLock & 0x01) == 0x01)) ||
  6.     (vfoActive == VFO_B && ((isDialLock & 0x02) == 0x02)))
  7.     return;
  8.  
  9.   s = enc_read();
  10.  
  11.   //if time is exceeded, it is recognized as an error,
  12.   //ignore exists values, because of errors
  13.   if (s == 0) {
  14.     if (encodedSumValue != 0 && (millis() - encodeTimeOut) > lastEncInputtime)
  15.       encodedSumValue = 0;
  16.  
  17.     lastMovedirection = 0;
  18.     return;
  19.   }
  20.   lastEncInputtime = millis();
  21.  
  22.   //for check moving direction
  23.   encodedSumValue += (s > 0 ? 1 : -1);
  24.  
  25.   //check threshold and operator actions (hold dial speed = continous moving, skip threshold check)
  26.   //not use continues changing by Threshold
  27.   //if ((lastTunetime < (millis() - skipThresholdTime)) && ((encodedSumValue *  encodedSumValue) <= (threshold * threshold)))
  28.   if (((encodedSumValue *  encodedSumValue) <= (threshold * threshold)))
  29.     return;
  30.  
  31.   lastTunetime = millis();
  32.  
  33.   //Valid Action without noise
  34.   encodedSumValue = 0;
  35.  
  36.   prev_freq = frequency;
  37.   //incdecValue = tuningStep * s;
  38.   //frequency += (arTuneStep[tuneStepIndex -1]
  39.   * s * (s * s < 10 ? 1 : 3));  //appield weight (s is speed)
  40.   frequency += (arTuneStep[tuneStepIndex -1] * s);  //appield weight (s is speed) //if want need more increase size, change step size
  41.    
  42.   if (prev_freq < 10000000l && frequency > 10000000l)
  43.     isUSB = true;
  44.    
  45.   if (prev_freq > 10000000l && frequency < 10000000l)
  46.     isUSB = false;
  47.    
  48.   setFrequency(frequency);
  49.   updateDisplay();
  50. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top