]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
first attempt at fixing ctun when it cross the display limits
authorRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Sat, 30 Dec 2023 16:08:22 +0000 (21:38 +0530)
committerRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Sat, 30 Dec 2023 16:08:22 +0000 (21:38 +0530)
screen.c
vfo.c

index 8596bb40b034b7fc893c9f75b69332872351e266..d00adadee0513f157836f0e337ba1ca257922091 100644 (file)
--- a/screen.c
+++ b/screen.c
@@ -11,7 +11,7 @@ const colour_t dark_green = { DARK_GREEN_R, DARK_GREEN_G, DARK_GREEN_B };
 
 widget_props_t default_widget_prop_table[NUM_ACTIVE_BUTTONS] = {
     // label, x, y, font_size, off_colour, on_colour
-    [SCR_VFO_A] = { 285, 95, 66, { green, white }, { "", "" } },
+    [SCR_VFO_A] = { 285, 95, 64, { green, white }, { "", "" } },
     [SCR_VFO_B] = { 285, 18, 18, { cyan, grey}, { "", "" } },
     [SCR_ACTIVE_VFO] = { 400, 20, 18, { yellow, yellow }, { "", "" } },
     [SCR_MODE] = { 70, 80, 30, { yellow, yellow }, { "MODE", "MODE" } },
diff --git a/vfo.c b/vfo.c
index 56262749da7563934eb6a6db739a17ee19ec6d80..59b4401eafe006639257cedc027aebd778b29d47 100644 (file)
--- a/vfo.c
+++ b/vfo.c
@@ -757,8 +757,25 @@ void vfo_id_move(int id, long long hz, int round) {
             long long max_freq = frequency + half;
 
             if (rx_low <= min_freq) {
+               // XXX: move the background. how do we move the
+               // background? Set the freq to the new center freq?
+               // i.e. in ctun mode, vfo[id].ctune_frequency is the
+               // vfo freq and around it is where we draw the filter
+               // band limits, but the display is centered around
+               // vfo[id].frequency. But when we want to move the
+               // background, we move the vfo[id].freq by the
+               // required offset and let ctun_freq remain as it is.
+               long long delta_move = min_freq - rx_low;
+               vfo[id].frequency = vfo[id].frequency + hz - delta_move;
+               receiver_frequency_changed(receiver[id]);
+               g_idle_add(ext_vfo_update, NULL);
                 return;
             } else if (rx_high >= max_freq) {
+               // XXX: move the background
+               long long delta_move = rx_high - max_freq;
+               vfo[id].frequency = vfo[id].frequency + hz - delta_move;
+               receiver_frequency_changed(receiver[id]);
+               g_idle_add(ext_vfo_update, NULL);
                 return;
             }