]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
fix the problem with displaying nb
authorRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Thu, 30 Nov 2023 13:54:09 +0000 (19:24 +0530)
committerRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Thu, 30 Nov 2023 13:54:09 +0000 (19:24 +0530)
vfo.c

diff --git a/vfo.c b/vfo.c
index 3236ca98cb46ae1183ec215c1946f3393f8c4f78..1ad35b93f8d8521f8030e1f72359b6ef76907e51 100644 (file)
--- a/vfo.c
+++ b/vfo.c
@@ -1041,6 +1041,21 @@ int get_nr(RECEIVER *rx)
     return -1;
 }
 
+int get_nb(RECEIVER *rx)
+{
+    if (rx->nb == 0 && rx->nb2 == 0) {
+       return 0;
+    }
+    if (rx->nb == 1 && rx->nb2 == 0) {
+       return 1;
+    }
+    if (rx->nb == 0 && rx->nb2 == 1) {
+       return 2;
+    }
+
+    return -1;
+}
+
 void vfo_update(void) {
     int id = active_receiver->id;
     int txvfo = get_tx_vfo();
@@ -1236,7 +1251,12 @@ void vfo_update(void) {
         // NB and NB2 are mutually exclusive, therefore
         // they are put to the same place in order to save
         // some space
-       draw_item(cr, SCR_NB, active_receiver->nb);
+       int which_nb = get_nb(active_receiver);
+       if (which_nb < 0) {
+           g_print("RIGCTL: ERROR in NR determination used for display\n");
+           which_nb = 0;
+       }
+       draw_item(cr, SCR_NB, which_nb);
 
        // NR
         // NR, NR2, NR3 and NR4 are mutually exclusive