I assume by "dead band fix" you mean this: ?/g/BITX20/message/22349 Well worth doing. ?Gives the tuning pot a bit of hysterisis. ?Does away with the constant flicker between adjacent frequencies due to noise in the ADC when the knob is not being rotated, but otherwise leaves functionality and feel exactly as Ashhar had coded it. ?t works by inhibiting a reverse in direction of the tuning pot until that reversal has traveled through what would normally be 5 steps in frequency of 50hz each. ?For example, assume we have been tuning up in frequency and stop the knob at 7200.000 khz. ?A bit of noise comes in from the ADC, and the frequency pops up to 7200.050 khz. ?Another bit of noise comes in that would normally bring it back down to 7200.000 khz, but this is ignored because it does not reach the 5 tick threshold. ?A light touch on the knob might bring it a bit further up to 7200.100 khz. ?Reversing the direction of the knob, it travels through 5 steps before any change in frequency occurs, on the 6'th step the frequency goes back down to 7200.050 khz. ?If we leave the knob in that position, a bit of ADC noise might lower it further to 7200.000 khz, but noise will not raise the frequency. ?I recommend operating with the original code at first until the noise at the pot has been evaluated and minimized with bypass caps and perhaps short shielded wiring. ?Then enable this new code by recompiling the sketch. ?The frequency will still move a little bit after taking your hand off the knob, but can only move in one direction. To implement the change, replace this part of the code as posted by Ashhar on github: // the tuning knob is at neither extremities, tune the signals as usual else if (knob != old_knob){ frequency = baseTune + (50l * knob); old_knob = knob; setFrequency(frequency); updateDisplay(); } with this: // the tuning knob is at neither extremities, tune the signals as usual else if (knob != old_knob){ static char dir_knob; if ( (knob>old_knob) && ((dir_knob==1) || ((knob-old_knob) >5)) || (knob<old_knob) && ((dir_knob==0) || ((old_knob-knob) >5)) ) { if (knob>old_knob) { dir_knob=1; frequency = baseTune + (50l * (knob-5)); } else { dir_knob=0; frequency = baseTune + (50l * knob); } old_knob = knob; setFrequency(frequency); updateDisplay(); } } Note that there is one more "}" not included in the code snippets above to close out the function doTuning(). ?I chose to represent the complete "else" clause with balanced parenthesis, that final "}" is not part of the else clause. I'm on the road, won't be updating the file myself. ?But the above change does work. Jerry, KE7ER ? On Fri, Mar 10, 2017 at 08:58 am, <jmlynesjr@...> wrote: Does this version also include the tuning dead band fix? ? |