The usdx 1.02 version supports continuous tuning and includes non-amateur bands. However, it is not very convenient to use because it does not meet the testing standards and adjusting frequencies is also difficult. The following code modification achieves the desired effect of skipping non-amateur bands; for example, rotating the knob can jump from 7.2MHz to 10.1MHz.
// ================= HAM RADIO BAND SUMMARY =================
`typedef struct {`
uint32_t lo;
uint32_t hi;
} ham_band_t;
// Amateur band chart (in ascending order by frequency, must maintain the order)
static const ham_band_t ham_bands[] = {
{ 3500000UL, 3900000UL } // 80m
{ 5351500UL, 5366500UL } // 60m
{ 7000000UL, 7200000UL } // 40m
{10100000UL, 10150000UL} // 30m
{14000000UL, 14350000UL} // 20m
{18068000UL, 18168000UL} // 17m
{21000000UL, 21450000UL} // 15m
{28000000UL, 29700000UL} // 10m
};
static const uint8_t HAM_BAND_CNT =
sizeof(ham_bands) / sizeof(ham_bands[0]);
// step > 0 : Increase frequency (above hi → next band, lo)
// step < 0 : Decrease frequency (below lo → previous band.hi)
static inline uint32_t wrap_to_ham(uint32_t f, int8_t steps) {
const uint8_t N = sizeof(ham_bands) / sizeof(ham_bands[0]);
for (uint8_t i = 0; i < < N; i++) {
if (f >= ham bands.lo && f <= ham bands.hi)
return f;
if (f < ham_bands[i].lo) {
// 向下调 → 跳到前一个业余波段末尾
if (steps < 0) {
if (i == 0) return ham_bands[N-1].hi; // 最前 → 跳到最后波段
return ham_bands[i-1].hi;
}
// 向上调 → 跳到该波段起始
return ham_bands[i].lo;
}
}
// Exceeding the final wave range
if (steps < 0)
return ham_bands\[N-1].hi;
return ham_bands[0].lo;
}
// ================== END HAM BAND WRAP ================
void process_encoder_tuning_step(int8_t steps)
{
int32_t stepval = stepsizes[stepsize];
//if (stepsize < STEP_100) freq = freq % 1000; // after tuning and setting the step size > 100Hz, then disregard fine-tuning details.
if (rit) {
rit = rit + steps * stepval;
rit = max(-9999, min(9999, rit));
} else {
freq = freq + steps * stepval;
freq = wrap_to_ham(freq, steps); // Original code deleted, modified to change line
}
change = true;
}

