From 3e49d1ae43ddd9342016d157259583d59a011a27 Mon Sep 17 00:00:00 2001 From: John Melton G0ORX Date: Fri, 8 Nov 2019 17:53:34 +0000 Subject: [PATCH] No rounding of frequency moves when in CW modes. Removed Discovery from Exit Menu. --- exit_menu.c | 23 ++++++++++++++++++----- receiver.c | 6 ++++-- vfo.c | 17 ++++++++++------- 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/exit_menu.c b/exit_menu.c index 52dc79b..a0d8c22 100644 --- a/exit_menu.c +++ b/exit_menu.c @@ -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); diff --git a/receiver.c b/receiver.c index defeb36..d428dfa 100644 --- a/receiver.c +++ b/receiver.c @@ -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 d5259fb..a480cef 100644 --- 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; -- 2.45.2