]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
No rounding of frequency moves when in CW modes. Removed Discovery from Exit Menu.
authorJohn Melton G0ORX <john.d.melton@googlemail.com>
Fri, 8 Nov 2019 17:53:34 +0000 (17:53 +0000)
committerJohn Melton G0ORX <john.d.melton@googlemail.com>
Fri, 8 Nov 2019 17:53:34 +0000 (17:53 +0000)
exit_menu.c
receiver.c
vfo.c

index 52dc79b675f328dc0a9db5cbef31a84e2963aa85..a0d8c22f80628365922e1bd1c48fb3d57f0505d9 100644 (file)
@@ -178,25 +178,38 @@ void exit_menu(GtkWidget *parent) {
   gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
   gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
 
+  int row=0;
+  int col=0;
+
   GtkWidget *close_b=gtk_button_new_with_label("Close");
   g_signal_connect (close_b, "pressed", G_CALLBACK(close_cb), NULL);
-  gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
+  gtk_grid_attach(GTK_GRID(grid),close_b,col,row,1,1);
+
+  row++;
+  col=0;
 
+/*
   GtkWidget *discovery_b=gtk_button_new_with_label("Discovery");
   g_signal_connect (discovery_b, "pressed", G_CALLBACK(discovery_cb), NULL);
-  gtk_grid_attach(GTK_GRID(grid),discovery_b,0,1,1,1);
+  gtk_grid_attach(GTK_GRID(grid),discovery_b,col,row,1,1);
 
+  col++;
+*/
   GtkWidget *exit_b=gtk_button_new_with_label("Exit");
   g_signal_connect (exit_b, "pressed", G_CALLBACK(exit_cb), NULL);
-  gtk_grid_attach(GTK_GRID(grid),exit_b,1,1,1,1);
+  gtk_grid_attach(GTK_GRID(grid),exit_b,col,row,1,1);
+
+  col++;
 
   GtkWidget *reboot_b=gtk_button_new_with_label("Reboot");
   g_signal_connect (reboot_b, "pressed", G_CALLBACK(reboot_cb), NULL);
-  gtk_grid_attach(GTK_GRID(grid),reboot_b,2,1,1,1);
+  gtk_grid_attach(GTK_GRID(grid),reboot_b,col,row,1,1);
+
+  col++;
 
   GtkWidget *shutdown_b=gtk_button_new_with_label("Shutdown");
   g_signal_connect (shutdown_b, "pressed", G_CALLBACK(shutdown_cb), NULL);
-  gtk_grid_attach(GTK_GRID(grid),shutdown_b,3,1,1,1);
+  gtk_grid_attach(GTK_GRID(grid),shutdown_b,col,row,1,1);
 
   gtk_container_add(GTK_CONTAINER(content),grid);
 
index defeb36f4eed73280ff373284f08290cbfedcd4e..d428dfac2c7ed8483820297f8bbd7c3e7379a97c 100644 (file)
@@ -153,9 +153,11 @@ gboolean receiver_motion_notify_event(GtkWidget *widget, GdkEventMotion *event,
 
 gboolean receiver_scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer data) {
   if(event->direction==GDK_SCROLL_UP) {
-    vfo_move(step,TRUE);
+    //vfo_move(step,TRUE);
+    vfo_step(1);
   } else {
-    vfo_move(-step,TRUE);
+    //vfo_move(-step,TRUE);
+    vfo_step(-1);
   }
   return TRUE;
 }
diff --git a/vfo.c b/vfo.c
index d5259fbd8a7791b451399decd255b928d1056134..a480cef42d810fc770146a38b59c3596dbf0dea6 100644 (file)
--- a/vfo.c
+++ b/vfo.c
@@ -590,12 +590,12 @@ g_print("vfo_move: id=%d hz=%lld\n",id,hz);
   if(!locked) {
     if(vfo[id].ctun) {
       vfo[id].ctun_frequency=vfo[id].ctun_frequency+hz;
-      if(round) {
+      if(round && (vfo[id].mode!=modeCWL && vfo[id].mode!=modeCWU)) {
          vfo[id].ctun_frequency=((vfo[id].ctun_frequency+(step/2))/step)*step;
       }
     } else {
       vfo[id].frequency=vfo[id].frequency-hz;
-      if(round) {
+      if(round && (vfo[id].mode!=modeCWL && vfo[id].mode!=modeCWU)) {
          vfo[id].frequency=((vfo[id].frequency-(step/2))/step)*step;
       }
     }
@@ -607,12 +607,12 @@ g_print("vfo_move: id=%d hz=%lld\n",id,hz);
         // A and B increment and decrement together
         if(vfo[sid].ctun) {
           vfo[sid].ctun_frequency=vfo[sid].ctun_frequency+hz;
-          if(round) {
+          if(round && (vfo[id].mode!=modeCWL && vfo[id].mode!=modeCWU)) {
              vfo[sid].ctun_frequency=((vfo[sid].ctun_frequency+(step/2))/step)*step;
           }
         } else {
           vfo[sid].frequency=vfo[sid].frequency-hz;
-          if(round) {
+          if(round && (vfo[id].mode!=modeCWL && vfo[id].mode!=modeCWU)) {
              vfo[sid].frequency=((vfo[sid].frequency-(step/2))/step)*step;
           }
         }
@@ -621,12 +621,12 @@ g_print("vfo_move: id=%d hz=%lld\n",id,hz);
         // A increments and B decrements or A decrments and B increments
         if(vfo[sid].ctun) {
           vfo[sid].ctun_frequency=vfo[sid].ctun_frequency-hz;
-          if(round) {
+          if(round && (vfo[id].mode!=modeCWL && vfo[id].mode!=modeCWU)) {
              vfo[sid].ctun_frequency=((vfo[sid].ctun_frequency-(step/2))/step)*step;
           }
         } else {
           vfo[sid].frequency=vfo[sid].frequency+hz;
-          if(round) {
+          if(round && (vfo[id].mode!=modeCWL && vfo[id].mode!=modeCWU)) {
              vfo[sid].ctun_frequency=((vfo[sid].ctun_frequency+(step/2))/step)*step;
           }
         }
@@ -640,13 +640,16 @@ g_print("vfo_move: id=%d hz=%lld\n",id,hz);
 void vfo_move_to(long long hz) {
   // hz is the offset from the min frequency
   int id=active_receiver->id;
-  long long offset=(hz/step)*step;
+  long long offset=hz;
   long long half=(long long)(active_receiver->sample_rate/2);
   long long f=vfo[id].frequency-half+offset;
   long long diff; 
 
 g_print("vfo_move_to: id=%d hz=%lld f=%lld\n",id,hz,f);
 
+  if(vfo[id].mode!=modeCWL && vfo[id].mode!=modeCWU) {
+    offset=(hz/step)*step;
+  }
   if(!locked) {
     if(vfo[id].ctun) {
       diff=f-vfo[id].ctun_frequency;