From: Ramakrishnan Muthukrishnan Date: Tue, 2 Jan 2024 15:12:21 +0000 (+0530) Subject: ctune margin: moar bug fix X-Git-Url: https://git.rkrishnan.org/vdrive/%22file:/listings//%22%22.?a=commitdiff_plain;h=8645e2408e7d5a0cfda458b1a9536bd437d046c6;p=pihpsdr.git ctune margin: moar bug fix --- diff --git a/vfo.c b/vfo.c index d313b9c..1b4abfa 100644 --- a/vfo.c +++ b/vfo.c @@ -645,7 +645,7 @@ void vfo_id_step(int id, int steps) { long long freq_margin = (long long)(display_width * display_margin); if (rx_low <= (min_freq + freq_margin)) { // XXX handle ctune beyond the screen limits - long long delta_move = min_freq - rx_low; + long long delta_move = min_freq + freq_margin - rx_low; vfo[id].frequency = ((vfo[id].frequency / step + steps) * step) - delta_move; @@ -656,7 +656,7 @@ void vfo_id_step(int id, int steps) { return; } else if (rx_high >= (max_freq - freq_margin)) { // XXX: move the background - long long delta_move = rx_high - max_freq; + long long delta_move = rx_high - max_freq + freq_margin; vfo[id].frequency = ((vfo[id].frequency / step + steps) * step) + delta_move;