diff --git a/datatypes.h b/datatypes.h index b29338a01..d90ada341 100644 --- a/datatypes.h +++ b/datatypes.h @@ -15,6 +15,9 @@ #include "iio_utils.h" +#define FORCE_UPDATE TRUE +#define NORMAL_UPDATE FALSE + #ifndef MAX_MARKERS #define MAX_MARKERS 10 #endif diff --git a/osc.c b/osc.c index f5e112a82..397db4e4e 100644 --- a/osc.c +++ b/osc.c @@ -410,13 +410,6 @@ static void gfunc_update_plot(gpointer data, gpointer user_data) osc_plot_data_update(OSC_PLOT(plot)); } -static void gfunc_update_rx_lbl_plot(gpointer data, gpointer user_data) -{ - GtkWidget *plot = data; - - osc_plot_update_rx_lbl(OSC_PLOT(plot)); -} - static void gfunc_restart_plot(gpointer data, gpointer user_data) { GtkWidget *plot = data; @@ -1462,8 +1455,11 @@ void rx_update_labels(void) if (device_list[i].lo_freq) device_list[i].lo_freq /= 1000000.0; } - - g_list_foreach(plot_list, gfunc_update_rx_lbl_plot, NULL); + + GList *node; + + for (node = plot_list; node; node = g_list_next(node)) + osc_plot_update_rx_lbl(OSC_PLOT(node->data), NORMAL_UPDATE); } /* Before we really start, let's load the last saved profile */ diff --git a/oscplot.c b/oscplot.c index cdf385fac..d95945d6e 100644 --- a/oscplot.c +++ b/oscplot.c @@ -306,7 +306,7 @@ void osc_plot_data_update (OscPlot *plot) call_all_transform_functions(plot->priv); } -void osc_plot_update_rx_lbl(OscPlot *plot) +void osc_plot_update_rx_lbl(OscPlot *plot, bool force_update) { OscPlotPrivate *priv = plot->priv; TrList *tr_list = priv->transform_list; @@ -315,7 +315,7 @@ void osc_plot_update_rx_lbl(OscPlot *plot) int i; /* Skip rescaling graphs, updating labels and others if the redrawing is currently halted. */ - if (priv->redraw_function <= 0) + if (priv->redraw_function <= 0 && !force_update) return; if (priv->active_transform_type == FFT_TRANSFORM || priv->active_transform_type == COMPLEX_FFT_TRANSFORM) { @@ -328,7 +328,7 @@ void osc_plot_update_rx_lbl(OscPlot *plot) corr = priv->current_device->adc_freq / 2.0; else corr = 0; - if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->enable_auto_scale))) + if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->enable_auto_scale)) && !force_update) return; gtk_databox_set_total_limits(GTK_DATABOX(priv->databox), -5.0 - corr, priv->current_device->adc_freq / 2.0 + 5.0, 0.0, -75.0); priv->do_a_rescale_flag = 1; @@ -1710,7 +1710,13 @@ static void plot_setup(OscPlot *plot) gtk_databox_graph_add(GTK_DATABOX(priv->databox), transform->graph); gtk_databox_graph_set_hide(GTK_DATABOX_GRAPH(transform->graph), !transform->graph_active); } - osc_plot_update_rx_lbl(plot); + + if (priv->active_transform_type == TIME_TRANSFORM) + gtk_databox_set_total_limits(GTK_DATABOX(priv->databox), 0.0, max_x_axis, 1000, -1000); + else if (priv->active_transform_type == CONSTELLATION_TRANSFORM) + gtk_databox_set_total_limits(GTK_DATABOX(priv->databox), -1000.0, 1000.0, 1000, -1000); + + osc_plot_update_rx_lbl(plot, FORCE_UPDATE); } static void capture_button_clicked_cb(GtkToggleToolButton *btn, gpointer data) @@ -3500,8 +3506,8 @@ static void create_plot(OscPlot *plot) "stock-id", 0, capture_button_icon_transform, NULL, plot, NULL); g_object_bind_property_full(priv->fullscreen_button, "active", priv->fullscreen_button, "stock-id", 0, fullscreen_button_icon_transform, NULL, NULL, NULL); - g_object_bind_property(ruler_y, "lower", priv->y_axis_max, "value", G_BINDING_BIDIRECTIONAL); - g_object_bind_property(ruler_y, "upper", priv->y_axis_min, "value", G_BINDING_BIDIRECTIONAL); + g_object_bind_property(priv->y_axis_max, "value", ruler_y, "lower", G_BINDING_DEFAULT); + g_object_bind_property(priv->y_axis_min, "value", ruler_y, "upper", G_BINDING_DEFAULT); gtk_combo_box_set_active(GTK_COMBO_BOX(fft_size_widget), 0); gtk_combo_box_set_active(GTK_COMBO_BOX(priv->plot_type), 0); diff --git a/oscplot.h b/oscplot.h index 25921830c..f653ae383 100644 --- a/oscplot.h +++ b/oscplot.h @@ -41,7 +41,7 @@ GType osc_plot_get_type (void); GtkWidget* osc_plot_new (void); void osc_plot_destroy (OscPlot *plot); void osc_plot_data_update (OscPlot *plot); -void osc_plot_update_rx_lbl (OscPlot *plot); +void osc_plot_update_rx_lbl (OscPlot *plot, bool force_update); void osc_plot_restart (OscPlot *plot); void osc_plot_draw_stop (OscPlot *plot); void osc_plot_save_to_ini (OscPlot *plot, char *filename);