]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
ctune margin: moar bug fix
authorRamakrishnan Muthukrishnan <ram@leastauthority.com>
Tue, 2 Jan 2024 15:12:21 +0000 (20:42 +0530)
committerRamakrishnan Muthukrishnan <ram@leastauthority.com>
Tue, 2 Jan 2024 15:12:21 +0000 (20:42 +0530)
vfo.c

diff --git a/vfo.c b/vfo.c
index d313b9c0b877c6569d1287ee415febcbb656d033..1b4abfa0ddb82cbbc910ab2a0a2a42bd12fea15e 100644 (file)
--- 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;