Skip to content

Commit acf6061

Browse files
mdblack98csete
authored andcommitted
Add get_vfos and also reset conf2 so rig gets set up again on reopening
1 parent 2da2d20 commit acf6061

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

src/gtk-rig-ctrl.c

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,7 @@ static void rig_engaged_cb(GtkToggleButton * button, gpointer data)
10031003
ctrl->rigctl_thread = g_thread_new("rigctl_run", rigctl_run, ctrl);
10041004
setconfig(ctrl);
10051005
}
1006+
ctrl->conf2 = NULL;
10061007
}
10071008

10081009
static GtkWidget *create_target_widgets(GtkRigCtrl * ctrl)
@@ -1488,13 +1489,51 @@ static inline gboolean check_get_response(gchar * buffback, gboolean retcode,
14881489
return retcode;
14891490
}
14901491

1492+
static int get_vfos(GtkRigCtrl * ctrl, char *rx, char *tx)
1493+
{
1494+
// fill rx/tx with vfo name plus space if not empty
1495+
rx = tx = "";
1496+
switch (ctrl->conf->vfoUp)
1497+
{
1498+
case VFO_A:
1499+
if (ctrl->conf->vfo_opt)
1500+
{rx = "VFOB ";tx = "VFOA ";}
1501+
break;
1502+
1503+
case VFO_B:
1504+
if (ctrl->conf->vfo_opt)
1505+
{rx = "VFOA ";tx = "VFOB ";}
1506+
break;
1507+
1508+
case VFO_MAIN:
1509+
if (ctrl->conf->vfo_opt)
1510+
{rx = "Sub";tx = "Main";}
1511+
break;
1512+
1513+
case VFO_SUB:
1514+
if (ctrl->conf->vfo_opt)
1515+
{rx = "Main";tx = "Sub";}
1516+
break;
1517+
1518+
default:
1519+
sat_log_log(SAT_LOG_LEVEL_ERROR,
1520+
_("%s called but TX VFO is %d and we don't know how to handle it."), __func__,
1521+
ctrl->conf->vfoUp);
1522+
return 1;
1523+
}
1524+
sat_log_log(SAT_LOG_LEVEL_DEBUG, "rx=%x, tx=%s\n", rx, tx);
1525+
return 0;
1526+
}
1527+
14911528
/* Setup VFOs for split operation (simplex or duplex) */
14921529
static gboolean setup_split(GtkRigCtrl * ctrl)
14931530
{
14941531
gchar *buff;
14951532
gchar buffback[256];
14961533
gboolean retcode;
1534+
gchar *rx="", *tx="";
14971535

1536+
get_vfos(ctrl, rx, tx);
14981537
switch (ctrl->conf->vfoUp)
14991538
{
15001539
case VFO_A:
@@ -2413,7 +2452,12 @@ static gboolean set_freq_toggle(GtkRigCtrl * ctrl, gint sock, gdouble freq)
24132452
gboolean retcode;
24142453

24152454
/* send command */
2416-
buff = g_strdup_printf("I %10.0f\x0a", freq);
2455+
printf("set_freq_toggle %d\n", ctrl->conf->vfo_opt);
2456+
if (ctrl->conf->vfo_opt)
2457+
buff = g_strdup_printf("I VFOA %10.0f\x0a", freq);
2458+
else
2459+
buff = g_strdup_printf("I %10.0f\x0a", freq);
2460+
24172461
retcode = send_rigctld_command(ctrl, sock, buff, buffback, 128);
24182462
g_free(buff);
24192463

0 commit comments

Comments
 (0)