Exemplo n.º 1
0
void do_calibration (GtkWidget *widget, gpointer data)
{

	int i;

	plot_time_8ch = plugin_get_new_plot();
	plot_xcorr_4ch = plugin_get_new_plot();

	if (plot_time_8ch && plot_xcorr_4ch) {

		for (i = 0; i < 8; i++)
			osc_plot_set_channel_state(plot_time_8ch, "cf-ad9361-lpc", i, true);
		osc_plot_set_domain(plot_time_8ch, TIME_PLOT);

		osc_plot_set_channel_state(plot_xcorr_4ch, "cf-ad9361-lpc", 0, true);
		osc_plot_set_channel_state(plot_xcorr_4ch, "cf-ad9361-lpc", 1, true);
		osc_plot_set_channel_state(plot_xcorr_4ch, "cf-ad9361-lpc", 4, true);
		osc_plot_set_channel_state(plot_xcorr_4ch, "cf-ad9361-lpc", 5, true);

		osc_plot_set_domain(plot_xcorr_4ch, XCORR_PLOT);
		osc_plot_set_marker_type(plot_xcorr_4ch,  MARKER_PEAK);
	} else
		return;

	g_thread_new("Calibrate_thread", (void *) &calibrate, data);
	gtk_widget_hide(GTK_WIDGET(data));
}
Exemplo n.º 2
0
void do_calibration (GtkWidget *widget, gpointer data)
{
	GtkToggleButton *silent_calib;

	plot_xcorr_4ch = plugin_get_new_plot();

	silent_calib = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "silent_calibration"));
	if (gtk_toggle_button_get_active(silent_calib)) {
		osc_plot_set_visible(plot_xcorr_4ch, false);
	}

	if (plot_xcorr_4ch) {
		osc_plot_set_channel_state(plot_xcorr_4ch, CAP_DEVICE_ALT, 0, true);
		osc_plot_set_channel_state(plot_xcorr_4ch, CAP_DEVICE_ALT, 1, true);
		osc_plot_set_channel_state(plot_xcorr_4ch, CAP_DEVICE_ALT, 4, true);
		osc_plot_set_channel_state(plot_xcorr_4ch, CAP_DEVICE_ALT, 5, true);

		osc_plot_set_domain(plot_xcorr_4ch, XCORR_PLOT);
		osc_plot_set_marker_type(plot_xcorr_4ch,  MARKER_PEAK);
	} else
		return;

	g_thread_new("Calibrate_thread", (void *) &calibrate, data);
	gtk_widget_hide(GTK_WIDGET(data));
}
static void do_calibration (GtkWidget *widget, gpointer data)
{
	struct iio_device *iio_dev;
	unsigned num_chs, enabled_chs_mask;
	GtkToggleButton *silent_calib;

	plot_xcorr_4ch = plugin_get_new_plot();

	silent_calib = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "silent_calibration"));
	if (gtk_toggle_button_get_active(silent_calib)) {
		osc_plot_set_visible(plot_xcorr_4ch, false);
	}

	/* If channel selection of the plot used in the calibration combined
	 * with the channel selections of other existing plots is invalid then
	 * enable all channels. NOTE: remove this implementation once the dma
	 * starts working with any combination of channels.
	 */
	iio_dev = iio_context_find_device(get_context_from_osc(), CAP_DEVICE_ALT);
	if (iio_dev) {
		num_chs = iio_device_get_channels_count(iio_dev);
		enabled_chs_mask = global_enabled_channels_mask(iio_dev);
		if (!dma_valid_selection(CAP_DEVICE_ALT, enabled_chs_mask | 0x33, num_chs)) {
			cap_device_channels_enabled = true;
			iio_channels_change_shadow_of_enabled(iio_dev, true);
		}
	}

	if (plot_xcorr_4ch) {
		osc_plot_set_channel_state(plot_xcorr_4ch, CAP_DEVICE_ALT, 0, true);
		osc_plot_set_channel_state(plot_xcorr_4ch, CAP_DEVICE_ALT, 1, true);
		osc_plot_set_channel_state(plot_xcorr_4ch, CAP_DEVICE_ALT, 4, true);
		osc_plot_set_channel_state(plot_xcorr_4ch, CAP_DEVICE_ALT, 5, true);

		osc_plot_set_domain(plot_xcorr_4ch, XCORR_PLOT);
		osc_plot_set_marker_type(plot_xcorr_4ch, MARKER_PEAK);
	} else
		return;

	if (data)
		gtk_widget_hide(GTK_WIDGET(data));
	g_thread_new("Calibrate_thread", (void *) &calibrate, data);
}