@@ -95,7 +95,6 @@ static void start_timer(GtkRigCtrl * data);
9595
9696static GtkBoxClass * parent_class = NULL ;
9797
98-
9998static void gtk_rig_ctrl_destroy (GtkWidget * widget )
10099{
101100 GtkRigCtrl * ctrl = GTK_RIG_CTRL (widget );
@@ -1499,19 +1498,31 @@ static gboolean setup_split(GtkRigCtrl * ctrl)
14991498 switch (ctrl -> conf -> vfoUp )
15001499 {
15011500 case VFO_A :
1502- buff = g_strdup ("S 1 VFOA\x0a" );
1501+ if (ctrl -> conf -> vfo_opt )
1502+ buff = g_strdup ("S VFOB 1 VFOA\x0a" );
1503+ else
1504+ buff = g_strdup ("S 1 VFOA\x0a" );
15031505 break ;
15041506
15051507 case VFO_B :
1506- buff = g_strdup ("S 1 VFOB\x0a" );
1508+ if (ctrl -> conf -> vfo_opt )
1509+ buff = g_strdup ("S VFOA 1 VFOB\x0a" );
1510+ else
1511+ buff = g_strdup ("S 1 VFOB\x0a" );
15071512 break ;
15081513
15091514 case VFO_MAIN :
1510- buff = g_strdup ("S 1 Main\x0a" );
1515+ if (ctrl -> conf -> vfo_opt )
1516+ buff = g_strdup ("S Sub 1 Main\x0a" );
1517+ else
1518+ buff = g_strdup ("S 1 Main\x0a" );
15111519 break ;
15121520
15131521 case VFO_SUB :
1514- buff = g_strdup ("S 1 Sub\x0a" );
1522+ if (ctrl -> conf -> vfo_opt )
1523+ buff = g_strdup ("S Main 1 Sub\x0a" );
1524+ else
1525+ buff = g_strdup ("S 1 Sub\x0a" );
15151526 break ;
15161527
15171528 default :
@@ -2253,12 +2264,18 @@ static gboolean get_ptt(GtkRigCtrl * ctrl, gint sock)
22532264 if (ctrl -> conf -> ptt == PTT_TYPE_CAT )
22542265 {
22552266 /* send command get_ptt (t) */
2256- buff = g_strdup_printf ("t\x0a" );
2267+ if (ctrl -> conf -> vfo_opt )
2268+ buff = g_strdup_printf ("t vfoCurr\x0a" );
2269+ else
2270+ buff = g_strdup_printf ("t\x0a" );
22572271 }
22582272 else
22592273 {
22602274 /* send command \get_dcd */
2261- buff = g_strdup_printf ("%c\x0a" , 0x8b );
2275+ if (ctrl -> conf -> vfo_opt )
2276+ buff = g_strdup_printf ("%c vfoCurr\x0a" , 0x8b );
2277+ else
2278+ buff = g_strdup_printf ("%c\x0a" , 0x8b );
22622279 }
22632280
22642281 retcode = send_rigctld_command (ctrl , sock , buff , buffback , 128 );
@@ -2282,10 +2299,20 @@ static gboolean set_ptt(GtkRigCtrl * ctrl, gint sock, gboolean ptt)
22822299 gboolean retcode ;
22832300
22842301 /* send command */
2285- if (ptt == TRUE)
2286- buff = g_strdup_printf ("T 1\x0aq\x0a" );
2302+ if (ptt == TRUE)
2303+ {
2304+ if (ctrl -> conf -> vfo_opt )
2305+ buff = g_strdup_printf ("T vfoCurr 1\x0aq\x0a" );
2306+ else
2307+ buff = g_strdup_printf ("T 1\x0aq\x0a" );
2308+ }
22872309 else
2288- buff = g_strdup_printf ("T 0\x0aq\x0a" );
2310+ {
2311+ if (ctrl -> conf -> vfo_opt )
2312+ buff = g_strdup_printf ("T vfoCurr 0\x0aq\x0a" );
2313+ else
2314+ buff = g_strdup_printf ("T 0\x0aq\x0a" );
2315+ }
22892316
22902317 retcode = send_rigctld_command (ctrl , sock , buff , buffback , 128 );
22912318 g_free (buff );
@@ -2363,7 +2390,10 @@ static gboolean set_freq_simplex(GtkRigCtrl * ctrl, gint sock, gdouble freq)
23632390 gchar buffback [128 ];
23642391 gboolean retcode ;
23652392
2366- buff = g_strdup_printf ("F %10.0f\x0a" , freq );
2393+ if (ctrl -> conf -> vfo_opt )
2394+ buff = g_strdup_printf ("F currVFO %10.0f\x0a" , freq );
2395+ else
2396+ buff = g_strdup_printf ("F %10.0f\x0a" , freq );
23672397 retcode = send_rigctld_command (ctrl , sock , buff , buffback , 128 );
23682398 g_free (buff );
23692399
@@ -2402,6 +2432,9 @@ static gboolean set_toggle(GtkRigCtrl * ctrl, gint sock)
24022432 gchar buffback [128 ];
24032433 gboolean retcode ;
24042434
2435+ if (ctrl -> conf -> vfo_opt )
2436+ buff = g_strdup_printf ("S %s 1 %d\x0a" , ctrl -> conf -> vfoDown == VFO_A ?"VFOA" :"VFOB" , ctrl -> conf -> vfoDown );
2437+ else
24052438 buff = g_strdup_printf ("S 1 %d\x0a" , ctrl -> conf -> vfoDown );
24062439 retcode = send_rigctld_command (ctrl , sock , buff , buffback , 128 );
24072440 g_free (buff );
@@ -2421,7 +2454,10 @@ static gboolean unset_toggle(GtkRigCtrl * ctrl, gint sock)
24212454 gboolean retcode ;
24222455
24232456 /* send command */
2424- buff = g_strdup_printf ("S 0 %d\x0a" , ctrl -> conf -> vfoDown );
2457+ if (ctrl -> conf -> vfo_opt )
2458+ buff = g_strdup_printf ("S VFOA 0 %d\x0a" , ctrl -> conf -> vfoDown );
2459+ else
2460+ buff = g_strdup_printf ("S 0 %d\x0a" , ctrl -> conf -> vfoDown );
24252461 retcode = send_rigctld_command (ctrl , sock , buff , buffback , 128 );
24262462 g_free (buff );
24272463
@@ -2440,7 +2476,10 @@ static gboolean get_freq_simplex(GtkRigCtrl * ctrl, gint sock, gdouble * freq)
24402476 gboolean retcode ;
24412477 gboolean retval = TRUE;
24422478
2443- buff = g_strdup_printf ("f\x0a" );
2479+ if (ctrl -> conf -> vfo_opt )
2480+ buff = g_strdup_printf ("f currVFO\x0a" );
2481+ else
2482+ buff = g_strdup_printf ("f\x0a" );
24442483 retcode = send_rigctld_command (ctrl , sock , buff , buffback , 128 );
24452484 retcode = check_get_response (buffback , retcode , __func__ );
24462485 if (retcode )
@@ -2461,6 +2500,39 @@ static gboolean get_freq_simplex(GtkRigCtrl * ctrl, gint sock, gdouble * freq)
24612500 return retval ;
24622501}
24632502
2503+ /*
2504+ * Get vfo option
2505+ *
2506+ * Returns TRUE if the vfo option enabled was successful, FALSE otherwise
2507+ */
2508+ static gboolean get_vfo_opt (GtkRigCtrl * ctrl , gint sock )
2509+ {
2510+ gchar * buff ;
2511+ gchar buffback [128 ];
2512+ gboolean retcode ;
2513+ gboolean retval = TRUE;
2514+
2515+ buff = g_strdup_printf ("\\set_vfo_opt 1\x0a" );
2516+ send_rigctld_command (ctrl , sock , buff , buffback , 128 );
2517+ // we don't really care about the return from set_vto_opt
2518+ // we'll check to see if it worked next
2519+ buff = g_strdup_printf ("\\chk_vfo\x0a" );
2520+ retcode = send_rigctld_command (ctrl , sock , buff , buffback , 128 );
2521+ retcode = check_get_response (buffback , retcode , __func__ );
2522+ if (retcode )
2523+ {
2524+ if (buffback [0 ]== '1' ) return TRUE;
2525+ else return FALSE;
2526+ }
2527+ else
2528+ {
2529+ retval = FALSE;
2530+ }
2531+
2532+ g_free (buff );
2533+ return retval ;
2534+ }
2535+
24642536/*
24652537 * Get frequency when the radio is working toggle
24662538 *
@@ -2481,7 +2553,10 @@ static gboolean get_freq_toggle(GtkRigCtrl * ctrl, gint sock, gdouble * freq)
24812553 }
24822554
24832555 /* send command */
2484- buff = g_strdup_printf ("i\x0a" );
2556+ if (ctrl -> conf -> vfo_opt )
2557+ buff = g_strdup_printf ("i currVFO\x0a" );
2558+ else
2559+ buff = g_strdup_printf ("i\x0a" );
24852560 retcode = send_rigctld_command (ctrl , sock , buff , buffback , 128 );
24862561 retcode = check_get_response (buffback , retcode , __func__ );
24872562 if (retcode )
@@ -2730,11 +2805,22 @@ static void rigctrl_open(GtkRigCtrl * data)
27302805
27312806 open_rigctld_socket (ctrl -> conf , & (ctrl -> sock ));
27322807
2808+ // check to see if vfo option is enabled
2809+ ctrl -> conf -> vfo_opt = get_vfo_opt (ctrl , ctrl -> sock );
2810+ sat_log_log (SAT_LOG_LEVEL_DEBUG ,
2811+ _ ("%s:%s: VFO opt=%d" ), __FILE__ ,
2812+ __func__ , ctrl -> conf -> vfo_opt );
2813+
27332814 /* set initial frequency */
27342815 if (ctrl -> conf2 != NULL )
27352816 {
27362817 open_rigctld_socket (ctrl -> conf2 , & (ctrl -> sock2 ));
27372818 /* set initial dual mode */
2819+ ctrl -> conf2 -> vfo_opt = get_vfo_opt (ctrl , ctrl -> sock );
2820+ sat_log_log (SAT_LOG_LEVEL_DEBUG ,
2821+ _ ("%s:%s: VFO opt2=%d" ), __FILE__ ,
2822+ __func__ , ctrl -> conf2 -> vfo_opt );
2823+
27382824 exec_dual_rig_cycle (ctrl );
27392825 }
27402826 else
0 commit comments