Skip to content

Commit 09b5d4d

Browse files
committed
plugins: adrv9002: improve init on port_en_mode
Check, at the plugin initialization, if the port enable mode is set to pin. If it is, change the ensm widget sensitivity in the same way we do it in save_port_en(). Signed-off-by: Nuno Sa <[email protected]>
1 parent 8f60cc3 commit 09b5d4d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

plugins/adrv9002.c

+14
Original file line numberDiff line numberDiff line change
@@ -2929,6 +2929,18 @@ static int adrv9002_dds_init(struct plugin_private *priv)
29292929
return ret;
29302930
}
29312931

2932+
static void adrv9002_update_port_en_mode(const struct plugin_private *priv, const struct adrv9002_common *chan)
2933+
{
2934+
gchar *port_en = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(chan->port_en.widget));
2935+
2936+
if (!port_en)
2937+
return;
2938+
if (!strcmp(port_en, "pin"))
2939+
gtk_widget_set_sensitive(chan->ensm.widget, false);
2940+
2941+
g_free(port_en);
2942+
}
2943+
29322944
static void adrv9002_api_version_report(struct plugin_private *priv)
29332945
{
29342946
GtkWidget *api_frame = GTK_WIDGET(gtk_builder_get_object(priv->builder, "frame_api"));
@@ -3166,8 +3178,10 @@ static GtkWidget *adrv9002_init(struct osc_plugin *plugin, GtkWidget *notebook,
31663178
for (i = 0; i < ADRV9002_NUM_CHANNELS; i++) {
31673179
connect_special_signal_widgets(priv, i);
31683180
adrv9002_update_rx_widgets(priv, i);
3181+
adrv9002_update_port_en_mode(priv, &priv->rx_widgets[i].rx);
31693182
adrv9002_update_orx_widgets(priv, i);
31703183
adrv9002_update_tx_widgets(priv, i);
3184+
adrv9002_update_port_en_mode(priv, &priv->tx_widgets[i]);
31713185
iio_make_widgets_update_signal_based(priv->rx_widgets[i].rx.w,
31723186
priv->rx_widgets[i].rx.num_widgets,
31733187
G_CALLBACK(iio_widget_save_block_signals_by_data_cb));

0 commit comments

Comments
 (0)