Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void doTuningWithThresHold(){
- int s = 0;
- unsigned long prev_freq;
- if ((vfoActive == VFO_A && ((isDialLock & 0x01) == 0x01)) ||
- (vfoActive == VFO_B && ((isDialLock & 0x02) == 0x02)))
- return;
- s = enc_read();
- //if time is exceeded, it is recognized as an error,
- //ignore exists values, because of errors
- if (s == 0) {
- if (encodedSumValue != 0 && (millis() - encodeTimeOut) > lastEncInputtime)
- encodedSumValue = 0;
- lastMovedirection = 0;
- return;
- }
- lastEncInputtime = millis();
- //for check moving direction
- encodedSumValue += (s > 0 ? 1 : -1);
- //check threshold and operator actions (hold dial speed = continous moving, skip threshold check)
- //not use continues changing by Threshold
- //if ((lastTunetime < (millis() - skipThresholdTime)) && ((encodedSumValue * encodedSumValue) <= (threshold * threshold)))
- if (((encodedSumValue * encodedSumValue) <= (threshold * threshold)))
- return;
- lastTunetime = millis();
- //Valid Action without noise
- encodedSumValue = 0;
- prev_freq = frequency;
- //incdecValue = tuningStep * s;
- //frequency += (arTuneStep[tuneStepIndex -1]
- * s * (s * s < 10 ? 1 : 3)); //appield weight (s is speed)
- frequency += (arTuneStep[tuneStepIndex -1] * s); //appield weight (s is speed) //if want need more increase size, change step size
- if (prev_freq < 10000000l && frequency > 10000000l)
- isUSB = true;
- if (prev_freq > 10000000l && frequency < 10000000l)
- isUSB = false;
- setFrequency(frequency);
- updateDisplay();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement