gpredict-svn Mailing List for Gpredict (Page 30)
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
You can subscribe to this list here.
2008 |
Jan
(24) |
Feb
|
Mar
(6) |
Apr
(14) |
May
(9) |
Jun
|
Jul
|
Aug
(25) |
Sep
(60) |
Oct
(26) |
Nov
|
Dec
(20) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
|
Feb
(2) |
Mar
(22) |
Apr
(61) |
May
(57) |
Jun
|
Jul
(3) |
Aug
(83) |
Sep
(35) |
Oct
(50) |
Nov
(28) |
Dec
(34) |
2010 |
Jan
(29) |
Feb
(15) |
Mar
(2) |
Apr
|
May
(6) |
Jun
(2) |
Jul
(24) |
Aug
(2) |
Sep
(9) |
Oct
(43) |
Nov
(22) |
Dec
(6) |
2011 |
Jan
(24) |
Feb
(22) |
Mar
(31) |
Apr
(13) |
May
(10) |
Jun
(10) |
Jul
(43) |
Aug
(12) |
Sep
(18) |
Oct
(33) |
Nov
(18) |
Dec
(4) |
From: <cs...@us...> - 2009-04-11 19:24:52
|
Revision: 241 http://gpredict.svn.sourceforge.net/gpredict/?rev=241&view=rev Author: csete Date: 2009-04-11 19:24:42 +0000 (Sat, 11 Apr 2009) Log Message: ----------- Added check for rig engaged in simplex mode. Modified Paths: -------------- trunk/src/gtk-rig-ctrl.c Modified: trunk/src/gtk-rig-ctrl.c =================================================================== --- trunk/src/gtk-rig-ctrl.c 2009-04-11 16:45:09 UTC (rev 240) +++ trunk/src/gtk-rig-ctrl.c 2009-04-11 19:24:42 UTC (rev 241) @@ -34,7 +34,6 @@ * attached to it. Note, however, that current implementation only * allows one control window per module. * - * TODO Simplex TRX * TODO Duplex TRX * TODO Separate uplink rig * TODO Transponder passband display somewhere @@ -1516,12 +1515,14 @@ */ static void exec_trx_cycle (GtkRigCtrl *ctrl) { - if (get_ptt (ctrl, ctrl->conf) == TRUE) { - exec_tx_cycle (ctrl); + if (ctrl->engaged) { + if (get_ptt (ctrl, ctrl->conf) == TRUE) { + exec_tx_cycle (ctrl); + } + else { + exec_rx_cycle (ctrl); + } } - else { - exec_rx_cycle (ctrl); - } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-11 16:45:18
|
Revision: 240 http://gpredict.svn.sourceforge.net/gpredict/?rev=240&view=rev Author: csete Date: 2009-04-11 16:45:09 +0000 (Sat, 11 Apr 2009) Log Message: ----------- TX controller should initialize PTT to TRUE, otherwise it won't work with transmitters that don't have read_ptt via CAT. Modified Paths: -------------- trunk/src/gtk-rig-ctrl.c Modified: trunk/src/gtk-rig-ctrl.c =================================================================== --- trunk/src/gtk-rig-ctrl.c 2009-04-11 15:19:41 UTC (rev 239) +++ trunk/src/gtk-rig-ctrl.c 2009-04-11 16:45:09 UTC (rev 240) @@ -1392,7 +1392,7 @@ static void exec_tx_cycle (GtkRigCtrl *ctrl) { gdouble readfreq=0.0, tmpfreq, satfreqd, satfrequ, doppler; - gboolean ptt = FALSE; + gboolean ptt = TRUE; gboolean dialchanged = FALSE; /* get PTT status */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-11 15:19:44
|
Revision: 239 http://gpredict.svn.sourceforge.net/gpredict/?rev=239&view=rev Author: csete Date: 2009-04-11 15:19:41 +0000 (Sat, 11 Apr 2009) Log Message: ----------- Also applied tuning step fixes to TX mode controller. Modified Paths: -------------- trunk/src/gtk-rig-ctrl.c Modified: trunk/src/gtk-rig-ctrl.c =================================================================== --- trunk/src/gtk-rig-ctrl.c 2009-04-11 15:10:54 UTC (rev 238) +++ trunk/src/gtk-rig-ctrl.c 2009-04-11 15:19:41 UTC (rev 239) @@ -1395,7 +1395,10 @@ gboolean ptt = FALSE; gboolean dialchanged = FALSE; - + /* get PTT status */ + if (ctrl->engaged && ctrl->conf->ptt) + ptt = get_ptt (ctrl, ctrl->conf); + /* Dial feedback: If radio device is engaged read frequency from radio and compare it to the last set frequency. If different, it means that user has changed frequency @@ -1405,12 +1408,7 @@ and no need to execute the dial feedback. */ if ((ctrl->engaged) && (ctrl->lasttxf > 0.0)) { - // This is no good because it gets out of sync while PTT = ON - //lastfreq = gtk_freq_knob_get_value (GTK_FREQ_KNOB (ctrl->RigFreqDown)); - /* check whether PTT is ON */ - ptt = ctrl->conf->ptt ? get_ptt (ctrl, ctrl->conf) : FALSE; - if (ptt == TRUE) { if (!get_freq_simplex (ctrl, ctrl->conf, &readfreq)) { /* error => use a passive value */ @@ -1422,11 +1420,12 @@ readfreq = ctrl->lasttxf; } - if (fabs (readfreq - ctrl->lasttxf) > 0.99) { + if (fabs (readfreq - ctrl->lasttxf) >= 1.0) { dialchanged = TRUE; /* user might have altered radio frequency => update transponder knob */ gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->RigFreqUp), readfreq); + ctrl->lasttxf = readfreq; /* doppler shift; only if we are tracking */ if (ctrl->tracking) { @@ -1476,10 +1475,16 @@ tmpfreq = gtk_freq_knob_get_value(GTK_FREQ_KNOB(ctrl->RigFreqUp)); /* if device is engaged, send freq command to radio */ - if ((ctrl->engaged) && (ptt == TRUE) && (fabs(ctrl->lasttxf - tmpfreq) > 0.99)) { + if ((ctrl->engaged) && (ptt == TRUE) && (fabs(ctrl->lasttxf - tmpfreq) >= 1.0)) { if (set_freq_simplex (ctrl, ctrl->conf, tmpfreq)) { /* reset error counter */ ctrl->errcnt = 0; + + /* The actual frequency migh be different from what we have set because + the tuning step is larger than what we work with (e.g. FT-817 has a + smallest tuning step of 10 Hz). Therefore we read back the actual + frequency from the rig. */ + get_freq_simplex (ctrl, ctrl->conf, &tmpfreq); ctrl->lasttxf = tmpfreq; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-11 15:11:05
|
Revision: 238 http://gpredict.svn.sourceforge.net/gpredict/?rev=238&view=rev Author: csete Date: 2009-04-11 15:10:54 +0000 (Sat, 11 Apr 2009) Log Message: ----------- Take set_freq error caused by tuning step size into account. The RX cycle is now fully functional (tested using FT-817 and IC-765). Modified Paths: -------------- trunk/src/gtk-rig-ctrl.c Modified: trunk/src/gtk-rig-ctrl.c =================================================================== --- trunk/src/gtk-rig-ctrl.c 2009-04-11 13:05:09 UTC (rev 237) +++ trunk/src/gtk-rig-ctrl.c 2009-04-11 15:10:54 UTC (rev 238) @@ -1271,7 +1271,11 @@ gboolean ptt = FALSE; gboolean dialchanged = FALSE; + /* get PTT status */ + if (ctrl->engaged && ctrl->conf->ptt) + ptt = get_ptt (ctrl, ctrl->conf); + /* Dial feedback: If radio device is engaged read frequency from radio and compare it to the last set frequency. If different, it means that user has changed frequency @@ -1282,9 +1286,6 @@ */ if ((ctrl->engaged) && (ctrl->lastrxf > 0.0)) { - /* check whether PTT is ON */ - ptt = ctrl->conf->ptt ? get_ptt (ctrl, ctrl->conf) : FALSE; - if (ptt == FALSE) { if (!get_freq_simplex (ctrl, ctrl->conf, &readfreq)) { /* error => use a passive value */ @@ -1296,11 +1297,12 @@ readfreq = ctrl->lastrxf; } - if (fabs (readfreq - ctrl->lastrxf) > 0.99) { + if (fabs (readfreq - ctrl->lastrxf) >= 1.0) { dialchanged = TRUE; /* user might have altered radio frequency => update transponder knob */ gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->RigFreqDown), readfreq); + ctrl->lastrxf = readfreq; /* doppler shift; only if we are tracking */ if (ctrl->tracking) { @@ -1350,10 +1352,16 @@ tmpfreq = gtk_freq_knob_get_value(GTK_FREQ_KNOB(ctrl->RigFreqDown)); /* if device is engaged, send freq command to radio */ - if ((ctrl->engaged) && (ptt == FALSE) && (fabs(ctrl->lastrxf - tmpfreq) > 0.99)) { + if ((ctrl->engaged) && (ptt == FALSE) && (fabs(ctrl->lastrxf - tmpfreq) >= 1.0)) { if (set_freq_simplex (ctrl, ctrl->conf, tmpfreq)) { /* reset error counter */ ctrl->errcnt = 0; + + /* The actual frequency migh be different from what we have set because + the tuning step is larger than what we work with (e.g. FT-817 has a + smallest tuning step of 10 Hz). Therefore we read back the actual + frequency from the rig. */ + get_freq_simplex (ctrl, ctrl->conf, &tmpfreq); ctrl->lastrxf = tmpfreq; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-11 13:05:20
|
Revision: 237 http://gpredict.svn.sourceforge.net/gpredict/?rev=237&view=rev Author: csete Date: 2009-04-11 13:05:09 +0000 (Sat, 11 Apr 2009) Log Message: ----------- Check-in current code before test session. Modified Paths: -------------- trunk/src/gtk-rig-ctrl.c trunk/src/gtk-rig-ctrl.h Modified: trunk/src/gtk-rig-ctrl.c =================================================================== --- trunk/src/gtk-rig-ctrl.c 2009-04-11 12:02:25 UTC (rev 236) +++ trunk/src/gtk-rig-ctrl.c 2009-04-11 13:05:09 UTC (rev 237) @@ -33,6 +33,11 @@ * popup menu and each module can have several radio control windows * attached to it. Note, however, that current implementation only * allows one control window per module. + * + * TODO Simplex TRX + * TODO Duplex TRX + * TODO Separate uplink rig + * TODO Transponder passband display somewhere * */ #include <gtk/gtk.h> @@ -79,7 +84,8 @@ static void sat_selected_cb (GtkComboBox *satsel, gpointer data); static void track_toggle_cb (GtkToggleButton *button, gpointer data); static void delay_changed_cb (GtkSpinButton *spin, gpointer data); -static void rig_selected_cb (GtkComboBox *box, gpointer data); +static void primary_rig_selected_cb (GtkComboBox *box, gpointer data); +static void secondary_rig_selected_cb (GtkComboBox *box, gpointer data); static void rig_engaged_cb (GtkToggleButton *button, gpointer data); static void trsp_selected_cb (GtkComboBox *box, gpointer data); static void trsp_tune_cb (GtkButton *button, gpointer data); @@ -94,9 +100,10 @@ static void exec_tx_cycle (GtkRigCtrl *ctrl); static void exec_trx_cycle (GtkRigCtrl *ctrl); static void exec_duplex_cycle (GtkRigCtrl *ctrl); -static gboolean set_freq_simplex (GtkRigCtrl *ctrl, gdouble freq); -static gboolean get_freq_simplex (GtkRigCtrl *ctrl, gdouble *freq); -static gboolean get_ptt (GtkRigCtrl *ctrl); +static void exec_dual_rig_cycle (GtkRigCtrl *ctrl); +static gboolean set_freq_simplex (GtkRigCtrl *ctrl, radio_conf_t *conf, gdouble freq); +static gboolean get_freq_simplex (GtkRigCtrl *ctrl, radio_conf_t *conf, gdouble *freq); +static gboolean get_ptt (GtkRigCtrl *ctrl, radio_conf_t *conf); static void update_count_down (GtkRigCtrl *ctrl, gdouble t); /* misc utility functions */ @@ -173,6 +180,7 @@ ctrl->pass = NULL; ctrl->qth = NULL; ctrl->conf = NULL; + ctrl->conf2 = NULL; ctrl->trsp = NULL; ctrl->trsplist = NULL; ctrl->trsplock = FALSE; @@ -202,6 +210,12 @@ g_free (ctrl->conf); ctrl->conf = NULL; } + if (ctrl->conf2 != NULL) { + g_free (ctrl->conf2->name); + g_free (ctrl->conf2->host); + g_free (ctrl->conf2); + ctrl->conf2 = NULL; + } /* free transponder */ if (ctrl->trsplist != NULL) { @@ -609,18 +623,18 @@ - table = gtk_table_new (3, 3, FALSE); + table = gtk_table_new (4, 3, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 5); gtk_table_set_col_spacings (GTK_TABLE (table), 5); gtk_table_set_row_spacings (GTK_TABLE (table), 5); - - label = gtk_label_new (_("Device:")); + /* Primary device */ + label = gtk_label_new (_("1. Device:")); gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1); ctrl->DevSel = gtk_combo_box_new_text (); - gtk_widget_set_tooltip_text (ctrl->DevSel, _("Select radio device")); + gtk_widget_set_tooltip_text (ctrl->DevSel, _("Select primary radio device.")); /* open configuration directory */ cfgdir = get_conf_dir (); @@ -652,10 +666,30 @@ g_dir_close (dir); gtk_combo_box_set_active (GTK_COMBO_BOX (ctrl->DevSel), 0); - g_signal_connect (ctrl->DevSel, "changed", G_CALLBACK (rig_selected_cb), ctrl); + g_signal_connect (ctrl->DevSel, "changed", G_CALLBACK (primary_rig_selected_cb), ctrl); gtk_table_attach_defaults (GTK_TABLE (table), ctrl->DevSel, 1, 2, 0, 1); /* config will be force-loaded after LO spin is created */ + /* Secondary device */ + label = gtk_label_new (_("2. Device:")); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); + gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2); + + ctrl->DevSel2 = gtk_combo_box_new_text (); + gtk_widget_set_tooltip_text (ctrl->DevSel2, _("Select secondary radio device, if you want "\ + "to use a transmitter other than the primary "\ + "device.")); + + /* load config */ + gtk_combo_box_append_text (GTK_COMBO_BOX (ctrl->DevSel2), _("None")); + gtk_combo_box_set_active (GTK_COMBO_BOX (ctrl->DevSel2), 0); + + //gtk_combo_box_set_active (GTK_COMBO_BOX (ctrl->DevSel), 0); + g_signal_connect (ctrl->DevSel2, "changed", G_CALLBACK (secondary_rig_selected_cb), ctrl); + gtk_table_attach_defaults (GTK_TABLE (table), ctrl->DevSel2, 1, 2, 1, 2); + + + /* Engage button */ ctrl->LockBut = gtk_toggle_button_new_with_label (_("Engage")); gtk_widget_set_tooltip_text (ctrl->LockBut, _("Engage the selcted radio device")); @@ -663,28 +697,27 @@ gtk_table_attach_defaults (GTK_TABLE (table), ctrl->LockBut, 2, 3, 0, 1); /* Now, load config*/ - rig_selected_cb (GTK_COMBO_BOX (ctrl->DevSel), ctrl); + primary_rig_selected_cb (GTK_COMBO_BOX (ctrl->DevSel), ctrl); /* Timeout */ label = gtk_label_new (_("Cycle:")); gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2); + gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4); timer = gtk_spin_button_new_with_range (100, 5000, 10); gtk_spin_button_set_digits (GTK_SPIN_BUTTON (timer), 0); gtk_widget_set_tooltip_text (timer, _("This parameter controls the delay between "\ - "commands sent to the rigator.")); + "commands sent to the rig.")); gtk_spin_button_set_value (GTK_SPIN_BUTTON (timer), ctrl->delay); g_signal_connect (timer, "value-changed", G_CALLBACK (delay_changed_cb), ctrl); - gtk_table_attach (GTK_TABLE (table), timer, 1, 2, 1, 2, + gtk_table_attach (GTK_TABLE (table), timer, 1, 2, 3, 4, GTK_FILL, GTK_FILL, 0, 0); label = gtk_label_new (_("msec")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 2, 3, 1, 2); + gtk_table_attach_defaults (GTK_TABLE (table), label, 2, 3, 3, 4); - frame = gtk_frame_new (_("Settings")); gtk_container_add (GTK_CONTAINER (frame), table); @@ -919,7 +952,7 @@ -/** \brief New rig device selected. +/** \brief New primary rig device selected. * \param box Pointer to the rigor selector combo box. * \param data Pointer to the GtkRigCtrl widget. * @@ -927,7 +960,7 @@ * device. */ static void -rig_selected_cb (GtkComboBox *box, gpointer data) +primary_rig_selected_cb (GtkComboBox *box, gpointer data) { GtkRigCtrl *ctrl = GTK_RIG_CTRL (data); gchar *buff; @@ -958,9 +991,12 @@ buff = g_strdup_printf (_("%.0f MHz"), ctrl->conf->lo/1.0e6); gtk_label_set_text (GTK_LABEL (ctrl->LoDown), buff); g_free (buff); - buff = g_strdup_printf (_("%.0f MHz"), ctrl->conf->loup/1.0e6); - gtk_label_set_text (GTK_LABEL (ctrl->LoUp), buff); - g_free (buff); + /* uplink LO only if single device */ + if (ctrl->conf2 == NULL) { + buff = g_strdup_printf (_("%.0f MHz"), ctrl->conf->loup/1.0e6); + gtk_label_set_text (GTK_LABEL (ctrl->LoUp), buff); + g_free (buff); + } //gtk_spin_button_set_value (GTK_SPIN_BUTTON (ctrl->LO), ctrl->conf->lo/1.0e6); } @@ -979,7 +1015,83 @@ } +/** \brief New secondary rig device selected. + * \param box Pointer to the rigor selector combo box. + * \param data Pointer to the GtkRigCtrl widget. + * + * This function is called when the user selects a new rig controller + * device for the secondary radio. This radio is used for uplink only. + */ +static void +secondary_rig_selected_cb (GtkComboBox *box, gpointer data) +{ + GtkRigCtrl *ctrl = GTK_RIG_CTRL (data); + gchar *buff; + + + /* free previous configuration */ + if (ctrl->conf2 != NULL) { + g_free (ctrl->conf2->name); + g_free (ctrl->conf2->host); + g_free (ctrl->conf2); + ctrl->conf2 = NULL; + } + + if (gtk_combo_box_get_active (box) == 0) { + /* first entry is "None" */ + + /* reset uplink LO to what's in ctrl->conf */ + if (ctrl->conf != NULL) { + buff = g_strdup_printf (_("%.0f MHz"), ctrl->conf->loup/1.0e6); + gtk_label_set_text (GTK_LABEL (ctrl->LoUp), buff); + g_free (buff); + } + + return; + } + + /* else load new device */ + ctrl->conf2 = g_try_new (radio_conf_t, 1); + if (ctrl->conf2 == NULL) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s:%d: Failed to allocate memory for radio config"), + __FILE__, __LINE__); + return; + } + + /* load new configuration */ + ctrl->conf2->name = gtk_combo_box_get_active_text (box); + if (radio_conf_read (ctrl->conf2)) { + sat_log_log (SAT_LOG_LEVEL_MSG, + _("Loaded new radio configuration %s"), + ctrl->conf2->name); + /* update LO widgets */ + //buff = g_strdup_printf (_("%.0f MHz"), ctrl->conf2->lo/1.0e6); + //gtk_label_set_text (GTK_LABEL (ctrl->LoDown), buff); + //g_free (buff); + buff = g_strdup_printf (_("%.0f MHz"), ctrl->conf2->loup/1.0e6); + gtk_label_set_text (GTK_LABEL (ctrl->LoUp), buff); + g_free (buff); + //gtk_spin_button_set_value (GTK_SPIN_BUTTON (ctrl->LO), ctrl->conf->lo/1.0e6); + } + else { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s:%d: Failed to load radio configuration %s"), + __FILE__, __LINE__, ctrl->conf->name); + + g_free (ctrl->conf2->name); + if (ctrl->conf2->host) + g_free (ctrl->conf2->host); + g_free (ctrl->conf2); + ctrl->conf2 = NULL; + } + +} + + + + /** \brief Manage Engage button signals. * \param button Pointer to the "Engage" button. * \param data Pointer to the GtkRigCtrl widget. @@ -995,6 +1107,7 @@ if (!gtk_toggle_button_get_active (button)) { /* close socket */ gtk_widget_set_sensitive (ctrl->DevSel, TRUE); + gtk_widget_set_sensitive (ctrl->DevSel2, TRUE); ctrl->engaged = FALSE; ctrl->lasttxf = 0.0; ctrl->lastrxf = 0.0; @@ -1009,37 +1122,46 @@ } gtk_widget_set_sensitive (ctrl->DevSel, FALSE); + gtk_widget_set_sensitive (ctrl->DevSel2, FALSE); ctrl->engaged = TRUE; ctrl->wrops = 0; /* set initial frequency */ - - switch (ctrl->conf->type) { - case RIG_TYPE_RX: - ctrl->lastrxf = gtk_freq_knob_get_value (GTK_FREQ_KNOB(ctrl->RigFreqDown)); - set_freq_simplex (ctrl, ctrl->lastrxf); - break; - case RIG_TYPE_TX: - ctrl->lasttxf = gtk_freq_knob_get_value (GTK_FREQ_KNOB(ctrl->RigFreqUp)); - set_freq_simplex (ctrl, ctrl->lasttxf); - break; - case RIG_TYPE_TRX: - case RIG_TYPE_DUPLEX: - if (get_ptt (ctrl)) { + if (ctrl->conf2 != NULL) { + /* set initial dual mode */ + ctrl->lastrxf = gtk_freq_knob_get_value (GTK_FREQ_KNOB(ctrl->RigFreqDown)); + set_freq_simplex (ctrl, ctrl->conf, ctrl->lastrxf); + ctrl->lasttxf = gtk_freq_knob_get_value (GTK_FREQ_KNOB(ctrl->RigFreqUp)); + set_freq_simplex (ctrl, ctrl->conf2, ctrl->lasttxf); + } + else { + switch (ctrl->conf->type) { + case RIG_TYPE_RX: + ctrl->lastrxf = gtk_freq_knob_get_value (GTK_FREQ_KNOB(ctrl->RigFreqDown)); + set_freq_simplex (ctrl, ctrl->conf, ctrl->lastrxf); + break; + case RIG_TYPE_TX: ctrl->lasttxf = gtk_freq_knob_get_value (GTK_FREQ_KNOB(ctrl->RigFreqUp)); - set_freq_simplex (ctrl, ctrl->lasttxf); - } - else { + set_freq_simplex (ctrl, ctrl->conf, ctrl->lasttxf); + break; + case RIG_TYPE_TRX: + case RIG_TYPE_DUPLEX: + if (get_ptt (ctrl, ctrl->conf)) { + ctrl->lasttxf = gtk_freq_knob_get_value (GTK_FREQ_KNOB(ctrl->RigFreqUp)); + set_freq_simplex (ctrl, ctrl->conf, ctrl->lasttxf); + } + else { + ctrl->lastrxf = gtk_freq_knob_get_value (GTK_FREQ_KNOB(ctrl->RigFreqDown)); + set_freq_simplex (ctrl, ctrl->conf, ctrl->lastrxf); + } + break; + default: + /* this is an error! */ + ctrl->conf->type = RIG_TYPE_RX; ctrl->lastrxf = gtk_freq_knob_get_value (GTK_FREQ_KNOB(ctrl->RigFreqDown)); - set_freq_simplex (ctrl, ctrl->lastrxf); - } - break; - default: - /* this is an error! */ - ctrl->conf->type = RIG_TYPE_RX; - ctrl->lastrxf = gtk_freq_knob_get_value (GTK_FREQ_KNOB(ctrl->RigFreqDown)); - set_freq_simplex (ctrl, ctrl->lastrxf); - break; + set_freq_simplex (ctrl, ctrl->conf, ctrl->lastrxf); + break; + } } } } @@ -1096,32 +1218,37 @@ ctrl->busy = TRUE; - /* Execute controller cycle depending on radio type */ - switch (ctrl->conf->type) { + if (ctrl->conf2 != NULL) { + exec_dual_rig_cycle (ctrl); + } + else { + /* Execute controller cycle depending on primary radio type */ + switch (ctrl->conf->type) { - case RIG_TYPE_RX: - exec_rx_cycle (ctrl); - break; + case RIG_TYPE_RX: + exec_rx_cycle (ctrl); + break; - case RIG_TYPE_TX: - exec_tx_cycle (ctrl); - break; + case RIG_TYPE_TX: + exec_tx_cycle (ctrl); + break; - case RIG_TYPE_TRX: - exec_trx_cycle (ctrl); - break; + case RIG_TYPE_TRX: + exec_trx_cycle (ctrl); + break; - case RIG_TYPE_DUPLEX: - exec_duplex_cycle (ctrl); - break; + case RIG_TYPE_DUPLEX: + exec_duplex_cycle (ctrl); + break; - default: - /* invalid mode */ - sat_log_log (SAT_LOG_LEVEL_ERROR, - _("%s: Invalid radio type %d. Setting type to RIG_TYPE_RX"), - __FUNCTION__, ctrl->conf->type); - ctrl->conf->type = RIG_TYPE_RX; + default: + /* invalid mode */ + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: Invalid radio type %d. Setting type to RIG_TYPE_RX"), + __FUNCTION__, ctrl->conf->type); + ctrl->conf->type = RIG_TYPE_RX; + } } //g_print (" WROPS = %d\n", ctrl->wrops); @@ -1136,6 +1263,7 @@ * \param ctrl Pointer to the GtkRigCtrl widget. * * This function executes a controller cycle when the device is of RIG_TYPE_RX. + * This function is not used dual-rig mode. */ static void exec_rx_cycle (GtkRigCtrl *ctrl) { @@ -1155,10 +1283,10 @@ if ((ctrl->engaged) && (ctrl->lastrxf > 0.0)) { /* check whether PTT is ON */ - ptt = ctrl->conf->ptt ? get_ptt (ctrl) : FALSE; + ptt = ctrl->conf->ptt ? get_ptt (ctrl, ctrl->conf) : FALSE; if (ptt == FALSE) { - if (!get_freq_simplex (ctrl, &readfreq)) { + if (!get_freq_simplex (ctrl, ctrl->conf, &readfreq)) { /* error => use a passive value */ readfreq = ctrl->lastrxf; ctrl->errcnt++; @@ -1210,20 +1338,20 @@ /* uplink */ doppler = -satfrequ * (ctrl->target->range_rate / 299792.4580); gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->RigFreqUp), - satfrequ + doppler - ctrl->conf->lo); + satfrequ + doppler - ctrl->conf->loup); } else { gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->RigFreqDown), satfreqd - ctrl->conf->lo); gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->RigFreqUp), - satfrequ - ctrl->conf->lo); + satfrequ - ctrl->conf->loup ); } tmpfreq = gtk_freq_knob_get_value(GTK_FREQ_KNOB(ctrl->RigFreqDown)); /* if device is engaged, send freq command to radio */ if ((ctrl->engaged) && (ptt == FALSE) && (fabs(ctrl->lastrxf - tmpfreq) > 0.99)) { - if (set_freq_simplex (ctrl, tmpfreq)) { + if (set_freq_simplex (ctrl, ctrl->conf, tmpfreq)) { /* reset error counter */ ctrl->errcnt = 0; ctrl->lastrxf = tmpfreq; @@ -1250,7 +1378,8 @@ /** \brief Execute TX mode cycle. * \param ctrl Pointer to the GtkRigCtrl widget. * - * This function executes a controller cycle when the device is of RIG_TYPE_TX. + * This function executes a controller cycle when the primary device is of RIG_TYPE_TX. + * This function is not used in dual-rig mode. */ static void exec_tx_cycle (GtkRigCtrl *ctrl) { @@ -1272,10 +1401,10 @@ //lastfreq = gtk_freq_knob_get_value (GTK_FREQ_KNOB (ctrl->RigFreqDown)); /* check whether PTT is ON */ - ptt = ctrl->conf->ptt ? get_ptt (ctrl) : FALSE; + ptt = ctrl->conf->ptt ? get_ptt (ctrl, ctrl->conf) : FALSE; if (ptt == TRUE) { - if (!get_freq_simplex (ctrl, &readfreq)) { + if (!get_freq_simplex (ctrl, ctrl->conf, &readfreq)) { /* error => use a passive value */ readfreq = ctrl->lasttxf; ctrl->errcnt++; @@ -1327,20 +1456,20 @@ /* uplink */ doppler = -satfrequ * (ctrl->target->range_rate / 299792.4580); gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->RigFreqUp), - satfrequ + doppler - ctrl->conf->lo); + satfrequ + doppler - ctrl->conf->loup); } else { gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->RigFreqDown), satfreqd - ctrl->conf->lo); gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->RigFreqUp), - satfrequ - ctrl->conf->lo); + satfrequ - ctrl->conf->loup); } tmpfreq = gtk_freq_knob_get_value(GTK_FREQ_KNOB(ctrl->RigFreqUp)); /* if device is engaged, send freq command to radio */ if ((ctrl->engaged) && (ptt == TRUE) && (fabs(ctrl->lasttxf - tmpfreq) > 0.99)) { - if (set_freq_simplex (ctrl, tmpfreq)) { + if (set_freq_simplex (ctrl, ctrl->conf, tmpfreq)) { /* reset error counter */ ctrl->errcnt = 0; ctrl->lasttxf = tmpfreq; @@ -1369,10 +1498,17 @@ * \param ctrl Pointer to the GtkRigCtrl widget. * * This function executes a controller cycle when the device is of RIG_TYPE_TRX (simplex). + * Technically, the function simply checks the PTT status and executes either exec_tx_cycle() + * or exec_rx_cycle(). */ static void exec_trx_cycle (GtkRigCtrl *ctrl) { - // FIXME implement + if (get_ptt (ctrl, ctrl->conf) == TRUE) { + exec_tx_cycle (ctrl); + } + else { + exec_rx_cycle (ctrl); + } } @@ -1387,13 +1523,29 @@ exec_trx_cycle (ctrl); } +/** \brief Execute dual-rig cycle. + * \param ctrl Pointer to the GtkRigCtrl widget. + * + * This function executes a controller cycle when we use a primary device for + * downlink and a secondary device for uplink. + */ +static void exec_dual_rig_cycle (GtkRigCtrl *ctrl) +{ + //FIXME implement + + /* Execute downlink cycle using ctrl->conf */ + + + /* Execute uplink cycle using ctrl->conf2 */ +} + /** \brief Get PTT status * \param ctrl Pointer to the GtkRigVtrl widget. * \return TRUE if PTT is ON, FALSE if PTT is OFF or an error occurred. * */ -static gboolean get_ptt (GtkRigCtrl *ctrl) +static gboolean get_ptt (GtkRigCtrl *ctrl, radio_conf_t *conf) { gchar *buff,**vbuff; gint written,size; @@ -1420,22 +1572,22 @@ memset(&ServAddr, 0, sizeof(ServAddr)); /* Zero out structure */ ServAddr.sin_family = AF_INET; /* Internet address family */ - h = gethostbyname(ctrl->conf->host); + h = gethostbyname(conf->host); memcpy((char *) &ServAddr.sin_addr.s_addr, h->h_addr_list[0], h->h_length); - ServAddr.sin_port = htons(ctrl->conf->port); /* Server port */ + ServAddr.sin_port = htons(conf->port); /* Server port */ /* establish connection */ status = connect(sock, (struct sockaddr *) &ServAddr, sizeof(ServAddr)); if (status < 0) { sat_log_log (SAT_LOG_LEVEL_ERROR, _("%s:%d: Failed to connect to %s:%d"), - __FILE__, __LINE__, ctrl->conf->host, ctrl->conf->port); + __FILE__, __LINE__, conf->host, conf->port); return FALSE; } else { sat_log_log (SAT_LOG_LEVEL_DEBUG, _("%s:%d: Connection opened to %s:%d"), - __FILE__, __LINE__, ctrl->conf->host, ctrl->conf->port); + __FILE__, __LINE__, conf->host, conf->port); } /* send command (get_ptt: t) */ @@ -1500,7 +1652,7 @@ * gotten the current frequency from the ctrl; however, the param * might become useful in the future. */ -static gboolean set_freq_simplex (GtkRigCtrl *ctrl, gdouble freq) +static gboolean set_freq_simplex (GtkRigCtrl *ctrl, radio_conf_t *conf, gdouble freq) { gchar *buff; gint written,size; @@ -1525,22 +1677,22 @@ memset(&ServAddr, 0, sizeof(ServAddr)); /* Zero out structure */ ServAddr.sin_family = AF_INET; /* Internet address family */ - h = gethostbyname(ctrl->conf->host); + h = gethostbyname(conf->host); memcpy((char *) &ServAddr.sin_addr.s_addr, h->h_addr_list[0], h->h_length); - ServAddr.sin_port = htons(ctrl->conf->port); /* Server port */ + ServAddr.sin_port = htons(conf->port); /* Server port */ /* establish connection */ status = connect(sock, (struct sockaddr *) &ServAddr, sizeof(ServAddr)); if (status < 0) { sat_log_log (SAT_LOG_LEVEL_ERROR, _("%s: Failed to connect to %s:%d"), - __FUNCTION__, ctrl->conf->host, ctrl->conf->port); + __FUNCTION__, conf->host, conf->port); return FALSE; } else { sat_log_log (SAT_LOG_LEVEL_DEBUG, _("%s: Connection opened to %s:%d"), - __FUNCTION__, ctrl->conf->host, ctrl->conf->port); + __FUNCTION__, conf->host, conf->port); } /* send command */ @@ -1569,7 +1721,7 @@ * \return TRUE if the operation was successful, FALSE if a connection error * occurred. */ -static gboolean get_freq_simplex (GtkRigCtrl *ctrl, gdouble *freq) +static gboolean get_freq_simplex (GtkRigCtrl *ctrl, radio_conf_t *conf, gdouble *freq) { gchar *buff,**vbuff; gint written,size; @@ -1578,7 +1730,7 @@ struct sockaddr_in ServAddr; gint sock; /*!< Network socket */ - + if (freq == NULL) { sat_log_log (SAT_LOG_LEVEL_BUG, _("%s:%d: NULL storage."), @@ -1602,22 +1754,22 @@ memset(&ServAddr, 0, sizeof(ServAddr)); /* Zero out structure */ ServAddr.sin_family = AF_INET; /* Internet address family */ - h = gethostbyname(ctrl->conf->host); + h = gethostbyname(conf->host); memcpy((char *) &ServAddr.sin_addr.s_addr, h->h_addr_list[0], h->h_length); - ServAddr.sin_port = htons(ctrl->conf->port); /* Server port */ + ServAddr.sin_port = htons(conf->port); /* Server port */ /* establish connection */ status = connect(sock, (struct sockaddr *) &ServAddr, sizeof(ServAddr)); if (status < 0) { sat_log_log (SAT_LOG_LEVEL_ERROR, _("%s:%d: Failed to connect to %s:%d"), - __FILE__, __LINE__, ctrl->conf->host, ctrl->conf->port); + __FILE__, __LINE__, conf->host, conf->port); return FALSE; } else { sat_log_log (SAT_LOG_LEVEL_DEBUG, _("%s:%d: Connection opened to %s:%d"), - __FILE__, __LINE__, ctrl->conf->host, ctrl->conf->port); + __FILE__, __LINE__, conf->host, conf->port); } /* send command */ Modified: trunk/src/gtk-rig-ctrl.h =================================================================== --- trunk/src/gtk-rig-ctrl.h 2009-04-11 12:02:25 UTC (rev 236) +++ trunk/src/gtk-rig-ctrl.h 2009-04-11 13:05:09 UTC (rev 237) @@ -80,9 +80,11 @@ /* other widgets */ GtkWidget *TrspSel; /*!< Transponder selector */ GtkWidget *DevSel; /*!< Device selector */ + GtkWidget *DevSel2; /*!< Second device selector */ GtkWidget *LockBut; radio_conf_t *conf; /*!< Radio configuration */ + radio_conf_t *conf2; /*!< Secondary radio configuration */ GSList *trsplist; /*!< List of available transponders */ trsp_t *trsp; /*!< Pointer to the current transponder configuration */ gboolean trsplock; /*!< Flag indicating whether uplink and downlink are lockled */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-11 12:02:31
|
Revision: 236 http://gpredict.svn.sourceforge.net/gpredict/?rev=236&view=rev Author: csete Date: 2009-04-11 12:02:25 +0000 (Sat, 11 Apr 2009) Log Message: ----------- Fixed bug that prevented correct saving of the LO frequencies. Modified Paths: -------------- trunk/src/radio-conf.c Modified: trunk/src/radio-conf.c =================================================================== --- trunk/src/radio-conf.c 2009-04-10 18:11:40 UTC (rev 235) +++ trunk/src/radio-conf.c 2009-04-11 12:02:25 UTC (rev 236) @@ -200,7 +200,7 @@ g_key_file_set_string (cfg, GROUP, KEY_HOST, conf->host); g_key_file_set_integer (cfg, GROUP, KEY_PORT, conf->port); g_key_file_set_double (cfg, GROUP, KEY_LO, conf->lo); - g_key_file_set_double (cfg, GROUP, KEY_LO, conf->loup); + g_key_file_set_double (cfg, GROUP, KEY_LOUP, conf->loup); g_key_file_set_integer (cfg, GROUP, KEY_TYPE, conf->type); g_key_file_set_boolean (cfg, GROUP, KEY_PTT, conf->ptt); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-10 18:11:48
|
Revision: 235 http://gpredict.svn.sourceforge.net/gpredict/?rev=235&view=rev Author: csete Date: 2009-04-10 18:11:40 +0000 (Fri, 10 Apr 2009) Log Message: ----------- Renamed rig_locked_cb to rig_engaged_cb. Modified Paths: -------------- trunk/src/gtk-rig-ctrl.c Modified: trunk/src/gtk-rig-ctrl.c =================================================================== --- trunk/src/gtk-rig-ctrl.c 2009-04-10 18:05:42 UTC (rev 234) +++ trunk/src/gtk-rig-ctrl.c 2009-04-10 18:11:40 UTC (rev 235) @@ -80,7 +80,7 @@ static void track_toggle_cb (GtkToggleButton *button, gpointer data); static void delay_changed_cb (GtkSpinButton *spin, gpointer data); static void rig_selected_cb (GtkComboBox *box, gpointer data); -static void rig_locked_cb (GtkToggleButton *button, gpointer data); +static void rig_engaged_cb (GtkToggleButton *button, gpointer data); static void trsp_selected_cb (GtkComboBox *box, gpointer data); static void trsp_tune_cb (GtkButton *button, gpointer data); static void trsp_lock_cb (GtkToggleButton *button, gpointer data); @@ -659,7 +659,7 @@ /* Engage button */ ctrl->LockBut = gtk_toggle_button_new_with_label (_("Engage")); gtk_widget_set_tooltip_text (ctrl->LockBut, _("Engage the selcted radio device")); - g_signal_connect (ctrl->LockBut, "toggled", G_CALLBACK (rig_locked_cb), ctrl); + g_signal_connect (ctrl->LockBut, "toggled", G_CALLBACK (rig_engaged_cb), ctrl); gtk_table_attach_defaults (GTK_TABLE (table), ctrl->LockBut, 2, 3, 0, 1); /* Now, load config*/ @@ -980,14 +980,14 @@ -/** \brief Rig locked. +/** \brief Manage Engage button signals. * \param button Pointer to the "Engage" button. * \param data Pointer to the GtkRigCtrl widget. * * This function is called when the user toggles the "Engage" button. */ static void -rig_locked_cb (GtkToggleButton *button, gpointer data) +rig_engaged_cb (GtkToggleButton *button, gpointer data) { GtkRigCtrl *ctrl = GTK_RIG_CTRL (data); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-10 18:05:43
|
Revision: 234 http://gpredict.svn.sourceforge.net/gpredict/?rev=234&view=rev Author: csete Date: 2009-04-10 18:05:42 +0000 (Fri, 10 Apr 2009) Log Message: ----------- Check for proper transponder config before attempting to track uplink or downlink. Modified Paths: -------------- trunk/src/gtk-rig-ctrl.c Modified: trunk/src/gtk-rig-ctrl.c =================================================================== --- trunk/src/gtk-rig-ctrl.c 2009-04-10 14:38:49 UTC (rev 233) +++ trunk/src/gtk-rig-ctrl.c 2009-04-10 18:05:42 UTC (rev 234) @@ -862,7 +862,7 @@ * \param button Pointer to the GtkToggleButton that received the signal. * \param data Pointer to the GtkRigCtrl structure. * - * This finction is called when the user toggles the "Lock Transponder" button. + * This function is called when the user toggles the "Lock Transponder" button. * When ON, the uplink and downlink are locked according to the current transponder * data, i.e. when user changes the downlink, the uplink will follow automatically * taking into account whether the transponder is inverting or not. @@ -871,7 +871,6 @@ { GtkRigCtrl *ctrl = GTK_RIG_CTRL (data); - ctrl->trsplock = gtk_toggle_button_get_active (button); /* set uplink according to downlink */ @@ -1859,17 +1858,21 @@ return; } - down = gtk_freq_knob_get_value (GTK_FREQ_KNOB (ctrl->SatFreqDown)); - delta = down - ctrl->trsp->downlow; + /* ensure that we have a useable transponder config */ + if ((ctrl->trsp->downlow > 0.0) && (ctrl->trsp->uplow > 0.0)) { - if (ctrl->trsp->invert) { - up = ctrl->trsp->uphigh - delta; + down = gtk_freq_knob_get_value (GTK_FREQ_KNOB (ctrl->SatFreqDown)); + delta = down - ctrl->trsp->downlow; + + if (ctrl->trsp->invert) { + up = ctrl->trsp->uphigh - delta; + } + else { + up = ctrl->trsp->uplow + delta; + } + + gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->SatFreqUp), up); } - else { - up = ctrl->trsp->uplow + delta; - } - - gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->SatFreqUp), up); } @@ -1886,16 +1889,20 @@ if (ctrl->trsp == NULL) { return; } + + /* ensure that we have a useable transponder config */ + if ((ctrl->trsp->downlow > 0.0) && (ctrl->trsp->uplow > 0.0)) { + + up = gtk_freq_knob_get_value (GTK_FREQ_KNOB (ctrl->SatFreqUp)); + delta = up - ctrl->trsp->uplow; - up = gtk_freq_knob_get_value (GTK_FREQ_KNOB (ctrl->SatFreqUp)); - delta = up - ctrl->trsp->uplow; + if (ctrl->trsp->invert) { + down = ctrl->trsp->downhigh - delta; + } + else { + down = ctrl->trsp->downlow + delta; + } - if (ctrl->trsp->invert) { - down = ctrl->trsp->downhigh - delta; + gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->SatFreqDown), down); } - else { - down = ctrl->trsp->downlow + delta; - } - - gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->SatFreqDown), down); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-10 14:38:50
|
Revision: 233 http://gpredict.svn.sourceforge.net/gpredict/?rev=233&view=rev Author: csete Date: 2009-04-10 14:38:49 +0000 (Fri, 10 Apr 2009) Log Message: ----------- Changed signal name from freq_changed to freq-changed. Modified Paths: -------------- trunk/src/gtk-freq-knob.c trunk/src/gtk-rig-ctrl.c Modified: trunk/src/gtk-freq-knob.c =================================================================== --- trunk/src/gtk-freq-knob.c 2009-04-10 14:36:50 UTC (rev 232) +++ trunk/src/gtk-freq-knob.c 2009-04-10 14:38:49 UTC (rev 233) @@ -118,7 +118,7 @@ object_class->destroy = gtk_freq_knob_destroy; /* create freq changed signal */ - freq_changed_signal = g_signal_new ("freq_changed", + freq_changed_signal = g_signal_new ("freq-changed", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, 0, //G_STRUCT_OFFSET (GtkFreqKnobClass, tictactoe), Modified: trunk/src/gtk-rig-ctrl.c =================================================================== --- trunk/src/gtk-rig-ctrl.c 2009-04-10 14:36:50 UTC (rev 232) +++ trunk/src/gtk-rig-ctrl.c 2009-04-10 14:38:49 UTC (rev 233) @@ -379,7 +379,7 @@ /* satellite downlink frequency */ ctrl->SatFreqDown = gtk_freq_knob_new (145890000.0, TRUE); - g_signal_connect (ctrl->SatFreqDown, "freq_changed", G_CALLBACK (downlink_changed_cb), ctrl); + g_signal_connect (ctrl->SatFreqDown, "freq-changed", G_CALLBACK (downlink_changed_cb), ctrl); gtk_box_pack_start_defaults (GTK_BOX (vbox), ctrl->SatFreqDown); /* Downlink doppler */ @@ -441,7 +441,7 @@ /* satellite uplink frequency */ ctrl->SatFreqUp = gtk_freq_knob_new (145890000.0, TRUE); - g_signal_connect (ctrl->SatFreqUp, "freq_changed", G_CALLBACK (uplink_changed_cb), ctrl); + g_signal_connect (ctrl->SatFreqUp, "freq-changed", G_CALLBACK (uplink_changed_cb), ctrl); gtk_box_pack_start_defaults (GTK_BOX (vbox), ctrl->SatFreqUp); /* Uplink doppler */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-10 14:36:53
|
Revision: 232 http://gpredict.svn.sourceforge.net/gpredict/?rev=232&view=rev Author: csete Date: 2009-04-10 14:36:50 +0000 (Fri, 10 Apr 2009) Log Message: ----------- Use new freq_changed signal of GtkFrweqKnob widget to track uplink and downlink changes. Modified Paths: -------------- trunk/src/gtk-rig-ctrl.c Modified: trunk/src/gtk-rig-ctrl.c =================================================================== --- trunk/src/gtk-rig-ctrl.c 2009-04-10 14:34:55 UTC (rev 231) +++ trunk/src/gtk-rig-ctrl.c 2009-04-10 14:36:50 UTC (rev 232) @@ -85,7 +85,10 @@ static void trsp_tune_cb (GtkButton *button, gpointer data); static void trsp_lock_cb (GtkToggleButton *button, gpointer data); static gboolean rig_ctrl_timeout_cb (gpointer data); +static void downlink_changed_cb (GtkFreqKnob *knob, gpointer data); +static void uplink_changed_cb (GtkFreqKnob *knob, gpointer data); + /* radio control functions */ static void exec_rx_cycle (GtkRigCtrl *ctrl); static void exec_tx_cycle (GtkRigCtrl *ctrl); @@ -376,6 +379,7 @@ /* satellite downlink frequency */ ctrl->SatFreqDown = gtk_freq_knob_new (145890000.0, TRUE); + g_signal_connect (ctrl->SatFreqDown, "freq_changed", G_CALLBACK (downlink_changed_cb), ctrl); gtk_box_pack_start_defaults (GTK_BOX (vbox), ctrl->SatFreqDown); /* Downlink doppler */ @@ -437,6 +441,7 @@ /* satellite uplink frequency */ ctrl->SatFreqUp = gtk_freq_knob_new (145890000.0, TRUE); + g_signal_connect (ctrl->SatFreqUp, "freq_changed", G_CALLBACK (uplink_changed_cb), ctrl); gtk_box_pack_start_defaults (GTK_BOX (vbox), ctrl->SatFreqUp); /* Uplink doppler */ @@ -865,7 +870,7 @@ static void trsp_lock_cb (GtkToggleButton *button, gpointer data) { GtkRigCtrl *ctrl = GTK_RIG_CTRL (data); - gdouble offset; + ctrl->trsplock = gtk_toggle_button_get_active (button); @@ -1041,6 +1046,40 @@ } +/** \brief Manage downlink frequency change callbacks. + * \param knob Pointer to the GtkFreqKnob widget that received the signal. + * \param data Pointer to the GtkRigCtrl structure. + * + * This function is called when the user changes the downlink frequency in the controller. + * The function checks if the the transponder is locked, if yes it calls track_downlink(). + */ +static void downlink_changed_cb (GtkFreqKnob *knob, gpointer data) +{ + GtkRigCtrl *ctrl = GTK_RIG_CTRL (data); + + if (ctrl->trsplock) { + track_downlink (ctrl); + } +} + +/** \brief Manage uplink frequency change callbacks. + * \param knob Pointer to the GtkFreqKnob widget that received the signal. + * \param data Pointer to the GtkRigCtrl structure. + * + * This function is called when the user changes the uplink frequency in the controller. + * The function checks if the the transponder is locked, if yes it calls track_uplink(). + */ +static void uplink_changed_cb (GtkFreqKnob *knob, gpointer data) +{ + GtkRigCtrl *ctrl = GTK_RIG_CTRL (data); + + if (ctrl->trsplock) { + track_uplink (ctrl); + } +} + + + /** \brief Rigator controller timeout function * \param data Pointer to the GtkRigCtrl widget. * \return Always TRUE to let the timer continue. @@ -1146,12 +1185,13 @@ } gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->SatFreqDown), satfreqd); - /* TODO Update uplink if locked to downlink */ + /* Update uplink if locked to downlink */ + if (ctrl->trsplock) { + track_downlink (ctrl); + } } } - /* TODO: Follow with uplink if transponder is locked */ - /* now, forward tracking */ if (dialchanged) { /* no need to forward track */ @@ -1261,13 +1301,14 @@ satfrequ = readfreq + ctrl->conf->loup; } gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->SatFreqUp), satfrequ); - - /* TODO Update downlink if locked to uplink */ + + /* Follow with downlink if transponder is locked */ + if (ctrl->trsplock) { + track_uplink (ctrl); + } } } - /* TODO: Follow with downlink if transponder is locked */ - /* now, forward tracking */ if (dialchanged) { /* no need to forward track */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-10 14:34:56
|
Revision: 231 http://gpredict.svn.sourceforge.net/gpredict/?rev=231&view=rev Author: csete Date: 2009-04-10 14:34:55 +0000 (Fri, 10 Apr 2009) Log Message: ----------- Added signal that is emitted when the value of the knob changes. Modified Paths: -------------- trunk/src/gtk-freq-knob.c Modified: trunk/src/gtk-freq-knob.c =================================================================== --- trunk/src/gtk-freq-knob.c 2009-04-10 13:24:35 UTC (rev 230) +++ trunk/src/gtk-freq-knob.c 2009-04-10 14:34:55 UTC (rev 231) @@ -68,7 +68,9 @@ 12 }; +static guint freq_changed_signal = 0; + GType gtk_freq_knob_get_type () { @@ -114,6 +116,17 @@ parent_class = g_type_class_peek_parent (class); object_class->destroy = gtk_freq_knob_destroy; + + /* create freq changed signal */ + freq_changed_signal = g_signal_new ("freq_changed", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + 0, //G_STRUCT_OFFSET (GtkFreqKnobClass, tictactoe), + NULL, + NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + } @@ -298,6 +311,8 @@ } gtk_freq_knob_update (knob); - + + /* emit "freq_changed" signal */ + g_signal_emit (G_OBJECT (data), freq_changed_signal, 0); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-10 13:24:46
|
Revision: 230 http://gpredict.svn.sourceforge.net/gpredict/?rev=230&view=rev Author: csete Date: 2009-04-10 13:24:35 +0000 (Fri, 10 Apr 2009) Log Message: ----------- Added controls and function for tuning and locking transponders. Modified Paths: -------------- trunk/src/gtk-rig-ctrl.c trunk/src/gtk-rig-ctrl.h Modified: trunk/src/gtk-rig-ctrl.c =================================================================== --- trunk/src/gtk-rig-ctrl.c 2009-04-10 11:40:03 UTC (rev 229) +++ trunk/src/gtk-rig-ctrl.c 2009-04-10 13:24:35 UTC (rev 230) @@ -82,6 +82,8 @@ static void rig_selected_cb (GtkComboBox *box, gpointer data); static void rig_locked_cb (GtkToggleButton *button, gpointer data); static void trsp_selected_cb (GtkComboBox *box, gpointer data); +static void trsp_tune_cb (GtkButton *button, gpointer data); +static void trsp_lock_cb (GtkToggleButton *button, gpointer data); static gboolean rig_ctrl_timeout_cb (gpointer data); /* radio control functions */ @@ -98,6 +100,8 @@ static void load_trsp_list (GtkRigCtrl *ctrl); static void store_sats (gpointer key, gpointer value, gpointer user_data); static gboolean have_conf (void); +static void track_downlink (GtkRigCtrl *ctrl); +static void track_uplink (GtkRigCtrl *ctrl); static GtkVBoxClass *parent_class = NULL; @@ -168,6 +172,7 @@ ctrl->conf = NULL; ctrl->trsp = NULL; ctrl->trsplist = NULL; + ctrl->trsplock = FALSE; ctrl->tracking = FALSE; ctrl->busy = FALSE; ctrl->engaged = FALSE; @@ -198,7 +203,7 @@ /* free transponder */ if (ctrl->trsplist != NULL) { free_transponders (ctrl->trsplist); - ctrl->trsplist = NULL; /* destroy might is called twice (?) so we need to NULL it */ + ctrl->trsplist = NULL; /* destroy might be called twice (?) so we need to NULL it */ } (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); @@ -474,6 +479,7 @@ GtkWidget *create_target_widgets (GtkRigCtrl *ctrl) { GtkWidget *frame,*table,*label,*satsel,*track; + GtkWidget *tune,*trsplock,*hbox; gchar *buff; guint i, n; sat_t *sat = NULL; @@ -506,7 +512,7 @@ gtk_table_attach_defaults (GTK_TABLE (table), track, 3, 4, 0, 1); g_signal_connect (track, "toggled", G_CALLBACK (track_toggle_cb), ctrl); - /* Transponder selector */ + /* Transponder selector, tune, and trsplock buttons */ ctrl->TrspSel = gtk_combo_box_new_text (); gtk_widget_set_tooltip_text (ctrl->TrspSel, _("Select a transponder")); load_trsp_list (ctrl); @@ -514,6 +520,35 @@ g_signal_connect (ctrl->TrspSel, "changed", G_CALLBACK (trsp_selected_cb), ctrl); gtk_table_attach_defaults (GTK_TABLE (table), ctrl->TrspSel, 0, 3, 1, 2); + /* buttons */ + tune = gtk_button_new_with_label (_("T")); + gtk_widget_set_tooltip_text (tune, + _("Tune the radio to this transponder. "\ + "The uplink and downlink will be set to the center of "\ + "the transponder passband. In case of beacons, only the "\ + "downlink will be tuned to the beacon frequency.")); + g_signal_connect (tune, "clicked", G_CALLBACK (trsp_tune_cb), ctrl); + + trsplock = gtk_toggle_button_new_with_label (_("L")); + gtk_widget_set_tooltip_text (trsplock, + _("Lock the uplink and the downlink to each other. "\ + "Whenever you change the downlink (in the controller "\ + "or on the dial, the uplink will track it according "\ + "to whether the transponder is inverting or not. "\ + "Similarly, if you change the uplink the downlink "\ + "will track it automatically.\n\n"\ + "If the downlink and uplink are initially out of sync "\ + "when you enable this function, "\ + "the current downlink frequency will be used as "\ + "baseline for setting the new uplink frequency.")); + g_signal_connect (trsplock, "toggled", G_CALLBACK (trsp_lock_cb), ctrl); + + /* box for packing buttons */ + hbox = gtk_hbox_new (FALSE, 5); + gtk_box_pack_start (GTK_BOX (hbox), tune, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (hbox), trsplock, TRUE, TRUE, 0); + gtk_table_attach_defaults (GTK_TABLE (table), hbox, 3, 4, 1, 2); + /* Azimuth */ label = gtk_label_new (_("Az:")); gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); @@ -756,7 +791,7 @@ GtkRigCtrl *ctrl = GTK_RIG_CTRL (data); gint i, n; - i = gtk_combo_box_get_active (box) - 1; /* 0th element is "Transponder" */ + i = gtk_combo_box_get_active (box); n = g_slist_length (ctrl->trsplist); if (i == -1) { @@ -773,6 +808,76 @@ } } + +/** \brief Manage "Tune" events + * \param button Pointer to the GtkButton that received the signal. + * \param data Pointer to the GtkRigCtrl structure. + * + * This function is called when the user clicks on the Tune button next to the + * transponder selector. When clicked, the radio controller will set the RX and TX + * frequencies to the middle of the transponder uplink/downlink bands. + * + * To avoid conflicts with manual frequency changes on the radio, the sync between + * RIG and GPREDICT is invalidated after the tuning operation is performed. + * + */ +static void trsp_tune_cb (GtkButton *button, gpointer data) +{ + GtkRigCtrl *ctrl = GTK_RIG_CTRL (data); + gdouble freq; + + if (ctrl->trsp == NULL) + return; + + /* tune downlink */ + if ((ctrl->trsp->downlow > 0.0) && (ctrl->trsp->downhigh > 0.0)) { + + freq = ctrl->trsp->downlow + fabs (ctrl->trsp->downhigh - ctrl->trsp->downlow) / 2; + gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->SatFreqDown), freq); + + /* invalidate RIG<->GPREDICT sync */ + ctrl->lastrxf = 0.0; + } + + /* tune uplink */ + if ((ctrl->trsp->uplow > 0.0) && (ctrl->trsp->uphigh > 0.0)) { + + freq = ctrl->trsp->uplow + fabs (ctrl->trsp->uphigh - ctrl->trsp->uplow) / 2; + gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->SatFreqUp), freq); + + /* invalidate RIG<->GPREDICT sync */ + ctrl->lasttxf = 0.0; + } + + +} + + +/** \brief Manage lock transponder signals. + * \param button Pointer to the GtkToggleButton that received the signal. + * \param data Pointer to the GtkRigCtrl structure. + * + * This finction is called when the user toggles the "Lock Transponder" button. + * When ON, the uplink and downlink are locked according to the current transponder + * data, i.e. when user changes the downlink, the uplink will follow automatically + * taking into account whether the transponder is inverting or not. + */ +static void trsp_lock_cb (GtkToggleButton *button, gpointer data) +{ + GtkRigCtrl *ctrl = GTK_RIG_CTRL (data); + gdouble offset; + + ctrl->trsplock = gtk_toggle_button_get_active (button); + + /* set uplink according to downlink */ + if (ctrl->trsplock) { + track_downlink (ctrl); + } +} + + + + /** \brief Manage toggle signals (tracking) * \param button Pointer to the GtkToggle button. * \param data Pointer to the GtkRigCtrl widget. @@ -1005,10 +1110,11 @@ If radio device is engaged read frequency from radio and compare it to the last set frequency. If different, it means that user has changed frequency on the radio dial => update transponder knob + + Note: If ctrl->lastrxf = 0.0 the sync has been invalidated (e.g. user pressed "tune") + and no need to execute the dial feedback. */ - if (ctrl->engaged) { - // This is no good because it gets out of sync while PTT = ON - //lastfreq = gtk_freq_knob_get_value (GTK_FREQ_KNOB (ctrl->RigFreqDown)); + if ((ctrl->engaged) && (ctrl->lastrxf > 0.0)) { /* check whether PTT is ON */ ptt = ctrl->conf->ptt ? get_ptt (ctrl) : FALSE; @@ -1118,8 +1224,11 @@ If radio device is engaged read frequency from radio and compare it to the last set frequency. If different, it means that user has changed frequency on the radio dial => update transponder knob + + Note: If ctrl->lasttxf = 0.0 the sync has been invalidated (e.g. user pressed "tune") + and no need to execute the dial feedback. */ - if (ctrl->engaged) { + if ((ctrl->engaged) && (ctrl->lasttxf > 0.0)) { // This is no good because it gets out of sync while PTT = ON //lastfreq = gtk_freq_knob_get_value (GTK_FREQ_KNOB (ctrl->RigFreqDown)); @@ -1223,7 +1332,7 @@ */ static void exec_trx_cycle (GtkRigCtrl *ctrl) { - + // FIXME implement } @@ -1622,8 +1731,10 @@ /* clear transponder list */ free_transponders (ctrl->trsplist); + + ctrl->trsp = NULL; } - + /* check if there is a target satellite */ if G_UNLIKELY (ctrl->target == NULL) { sat_log_log (SAT_LOG_LEVEL_MSG, @@ -1691,3 +1802,59 @@ return (i > 0) ? TRUE : FALSE; } + + +/** \brief Track the downlink frequency. + * \param ctrl Pointer to the GtkRigCtrl structure. + * + * This function tracks the downlink frequency by setting the uplink frequency + * according to the lower limit of the downlink passband. + */ +static void track_downlink (GtkRigCtrl *ctrl) +{ + gdouble delta,down,up; + + if (ctrl->trsp == NULL) { + return; + } + + down = gtk_freq_knob_get_value (GTK_FREQ_KNOB (ctrl->SatFreqDown)); + delta = down - ctrl->trsp->downlow; + + if (ctrl->trsp->invert) { + up = ctrl->trsp->uphigh - delta; + } + else { + up = ctrl->trsp->uplow + delta; + } + + gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->SatFreqUp), up); +} + + +/** \brief Track the uplink frequency. + * \param ctrl Pointer to the GtkRigCtrl structure. + * + * This function tracks the uplink frequency by setting the downlink frequency + * according to the offset from the lower limit on the uplink passband. + */ +static void track_uplink (GtkRigCtrl *ctrl) +{ + gdouble delta,down,up; + + if (ctrl->trsp == NULL) { + return; + } + + up = gtk_freq_knob_get_value (GTK_FREQ_KNOB (ctrl->SatFreqUp)); + delta = up - ctrl->trsp->uplow; + + if (ctrl->trsp->invert) { + down = ctrl->trsp->downhigh - delta; + } + else { + down = ctrl->trsp->downlow + delta; + } + + gtk_freq_knob_set_value (GTK_FREQ_KNOB (ctrl->SatFreqDown), down); +} Modified: trunk/src/gtk-rig-ctrl.h =================================================================== --- trunk/src/gtk-rig-ctrl.h 2009-04-10 11:40:03 UTC (rev 229) +++ trunk/src/gtk-rig-ctrl.h 2009-04-10 13:24:35 UTC (rev 230) @@ -82,9 +82,10 @@ GtkWidget *DevSel; /*!< Device selector */ GtkWidget *LockBut; - radio_conf_t *conf; /*!< Radio configuration */ + radio_conf_t *conf; /*!< Radio configuration */ GSList *trsplist; /*!< List of available transponders */ - trsp_t *trsp; /*!< Current transponder configuration */ + trsp_t *trsp; /*!< Pointer to the current transponder configuration */ + gboolean trsplock; /*!< Flag indicating whether uplink and downlink are lockled */ GSList *sats; /*!< List of sats in parent module */ sat_t *target; /*!< Target satellite */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-10 11:40:13
|
Revision: 229 http://gpredict.svn.sourceforge.net/gpredict/?rev=229&view=rev Author: csete Date: 2009-04-10 11:40:03 +0000 (Fri, 10 Apr 2009) Log Message: ----------- updated. Modified Paths: -------------- trunk/NEWS Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-04-10 11:22:13 UTC (rev 228) +++ trunk/NEWS 2009-04-10 11:40:03 UTC (rev 229) @@ -7,6 +7,7 @@ - Feature request 2192404: Starting time for pass predictions. * Feature request 2194621: Data recorder. - Feature request 2347471: Use system goocanvas. +* Feature request 2130940: Transponder info in gpredict. - Fixed bug 1752908: New satellites in TLE files. - Fixed bug 1818144: No log file created at first execution. - Fixed bug 1839140: Sky at a glance axis incorrectly labelled. @@ -17,6 +18,7 @@ - Fixed bug 2139102: rigctld port. - Fixed bug 2130912: Crash when no rig or no rotator are defined. - Fixed bug 2170642: Small error in user manual. +- Fixed bug 2750119: Unable to set the time correctly in Time Controller. - Applied patch 2688135: Use GIO instead of libcurl for TLE download. Note: This removes proxy management from gpredict. x Windows: New installer instead of ZIP distribution. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-10 11:22:27
|
Revision: 228 http://gpredict.svn.sourceforge.net/gpredict/?rev=228&view=rev Author: csete Date: 2009-04-10 11:22:13 +0000 (Fri, 10 Apr 2009) Log Message: ----------- Fixed bug 2750119: Unable to set the time correctly in Time Controller. Modified Paths: -------------- trunk/src/gtk-sat-module-tmg.c Modified: trunk/src/gtk-sat-module-tmg.c =================================================================== --- trunk/src/gtk-sat-module-tmg.c 2009-04-08 21:44:13 UTC (rev 227) +++ trunk/src/gtk-sat-module-tmg.c 2009-04-10 11:22:13 UTC (rev 228) @@ -440,48 +440,68 @@ } - +/** \brief Set new date and time callback. + * \param widget The widget that was modified. + * \param data Pointer to the GtkSatModule structure. + * + * This function is called when the user changes the date or time in the time + * controller. If we are in manual time control mode, the function reads the + * date and time set in the control widget and calculates the new time for + * the module. The function does nothing in real time and suimulated real + * time modes. + */ static void tmg_time_set (GtkWidget *widget, gpointer data) { GtkSatModule *mod = GTK_SAT_MODULE (data); - guint year, month, day; - gint hr, min, sec, msec; - struct tm tim; - gdouble jd; + guint year, month, day; + gint hr, min, sec, msec; + struct tm tim,utim; + gdouble jd; - /* update time only if we are in manual time control */ - if (!mod->throttle && !mod->reset) { + /* update time only if we are in manual time control */ + if (!mod->throttle && !mod->reset) { - /* get date and time from widgets */ - gtk_calendar_get_date (GTK_CALENDAR (mod->tmgCal), - &year, &month, &day); + /* get date and time from widgets */ + gtk_calendar_get_date (GTK_CALENDAR (mod->tmgCal), + &year, &month, &day); - hr = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgHour)); - min = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgMin)); - sec = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgSec)); - msec = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgMsec)); + hr = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgHour)); + min = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgMin)); + sec = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgSec)); + msec = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (mod->tmgMsec)); - /* build struct_tm */ - tim.tm_year = (int) (year); - tim.tm_mon = (int) (month+1); - tim.tm_mday = (int) day; - tim.tm_hour = (int) hr; - tim.tm_min = (int) min; - tim.tm_sec = (int) sec; + /* build struct_tm */ + tim.tm_year = (int) (year); + tim.tm_mon = (int) (month+1); + tim.tm_mday = (int) day; + tim.tm_hour = (int) hr; + tim.tm_min = (int) min; + tim.tm_sec = (int) sec; - sat_log_log (SAT_LOG_LEVEL_DEBUG, - _("%s: %d/%d/%d %d:%d:%d.%d"), - __FUNCTION__, - tim.tm_year, tim.tm_mon, tim.tm_mday, - tim.tm_hour, tim.tm_min, tim.tm_sec, msec); + sat_log_log (SAT_LOG_LEVEL_DEBUG, + _("%s: %d/%d/%d %d:%d:%d.%d"), + __FUNCTION__, + tim.tm_year, tim.tm_mon, tim.tm_mday, + tim.tm_hour, tim.tm_min, tim.tm_sec, msec); - /* convert to Julian Date (FIXME: only UTC?) */ - jd = Julian_Date (&tim); - jd = jd + (gdouble)msec/8.64e+7; + /* convert UTC time to Julian Date */ + if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_LOCAL_TIME)) { + /* convert local time to UTC */ + utim = Time_to_UTC (&tim); - mod->tmgCdnum = jd; - } + /* Convert to JD */ + jd = Julian_Date (&utim); + } + else { + /* Already UTC, just convert to JD */ + jd = Julian_Date (&tim); + } + + jd = jd + (gdouble)msec/8.64e+7; + + mod->tmgCdnum = jd; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-08 21:44:19
|
Revision: 227 http://gpredict.svn.sourceforge.net/gpredict/?rev=227&view=rev Author: csete Date: 2009-04-08 21:44:13 +0000 (Wed, 08 Apr 2009) Log Message: ----------- Fixed crash when closing rig controller window with active transponder list. Modified Paths: -------------- trunk/src/gtk-rig-ctrl.c Modified: trunk/src/gtk-rig-ctrl.c =================================================================== --- trunk/src/gtk-rig-ctrl.c 2009-04-04 22:40:08 UTC (rev 226) +++ trunk/src/gtk-rig-ctrl.c 2009-04-08 21:44:13 UTC (rev 227) @@ -198,6 +198,7 @@ /* free transponder */ if (ctrl->trsplist != NULL) { free_transponders (ctrl->trsplist); + ctrl->trsplist = NULL; /* destroy might is called twice (?) so we need to NULL it */ } (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-04 22:40:13
|
Revision: 226 http://gpredict.svn.sourceforge.net/gpredict/?rev=226&view=rev Author: csete Date: 2009-04-04 22:40:08 +0000 (Sat, 04 Apr 2009) Log Message: ----------- Updated. Modified Paths: -------------- trunk/ChangeLog Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-04-04 22:38:48 UTC (rev 225) +++ trunk/ChangeLog 2009-04-04 22:40:08 UTC (rev 226) @@ -1,3 +1,16 @@ +2009-04-04 Alexandru Csete <oz9aec.gmail.com> + + * src/gtk-rig-ctrl.[ch]: + Added transponder selector combo box. Not fully functional. + + +2009-04-03 Alexandru Csete <oz...@gm...> + + * src/trsp-conf.[ch]: + Added function for freeing transponder list. Fixed a small typo in file + extension. + + 2009-04-01 Alexandru Csete <oz...@gm...> * src/trsp-conf.c: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-04 22:38:52
|
Revision: 225 http://gpredict.svn.sourceforge.net/gpredict/?rev=225&view=rev Author: csete Date: 2009-04-04 22:38:48 +0000 (Sat, 04 Apr 2009) Log Message: ----------- Some more work on transponder management (segfaults from time to time). Modified Paths: -------------- trunk/src/gtk-rig-ctrl.c trunk/src/gtk-rig-ctrl.h Modified: trunk/src/gtk-rig-ctrl.c =================================================================== --- trunk/src/gtk-rig-ctrl.c 2009-04-04 22:21:38 UTC (rev 224) +++ trunk/src/gtk-rig-ctrl.c 2009-04-04 22:38:48 UTC (rev 225) @@ -81,6 +81,7 @@ static void delay_changed_cb (GtkSpinButton *spin, gpointer data); static void rig_selected_cb (GtkComboBox *box, gpointer data); static void rig_locked_cb (GtkToggleButton *button, gpointer data); +static void trsp_selected_cb (GtkComboBox *box, gpointer data); static gboolean rig_ctrl_timeout_cb (gpointer data); /* radio control functions */ @@ -94,6 +95,7 @@ static void update_count_down (GtkRigCtrl *ctrl, gdouble t); /* misc utility functions */ +static void load_trsp_list (GtkRigCtrl *ctrl); static void store_sats (gpointer key, gpointer value, gpointer user_data); static gboolean have_conf (void); @@ -109,48 +111,48 @@ GType gtk_rig_ctrl_get_type () { - static GType gtk_rig_ctrl_type = 0; + static GType gtk_rig_ctrl_type = 0; - if (!gtk_rig_ctrl_type) { + if (!gtk_rig_ctrl_type) { - static const GTypeInfo gtk_rig_ctrl_info = { - sizeof (GtkRigCtrlClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gtk_rig_ctrl_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GtkRigCtrl), - 5, /* n_preallocs */ - (GInstanceInitFunc) gtk_rig_ctrl_init, - }; + static const GTypeInfo gtk_rig_ctrl_info = { + sizeof (GtkRigCtrlClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_rig_ctrl_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkRigCtrl), + 2, /* n_preallocs */ + (GInstanceInitFunc) gtk_rig_ctrl_init, + }; - gtk_rig_ctrl_type = g_type_register_static (GTK_TYPE_VBOX, - "GtkRigCtrl", - >k_rig_ctrl_info, - 0); - } + gtk_rig_ctrl_type = g_type_register_static (GTK_TYPE_VBOX, + "GtkRigCtrl", + >k_rig_ctrl_info, + 0); + } - return gtk_rig_ctrl_type; + return gtk_rig_ctrl_type; } static void gtk_rig_ctrl_class_init (GtkRigCtrlClass *class) { - GObjectClass *gobject_class; - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - GtkContainerClass *container_class; + GObjectClass *gobject_class; + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + GtkContainerClass *container_class; - gobject_class = G_OBJECT_CLASS (class); - object_class = (GtkObjectClass*) class; - widget_class = (GtkWidgetClass*) class; - container_class = (GtkContainerClass*) class; + gobject_class = G_OBJECT_CLASS (class); + object_class = (GtkObjectClass*) class; + widget_class = (GtkWidgetClass*) class; + container_class = (GtkContainerClass*) class; - parent_class = g_type_class_peek_parent (class); + parent_class = g_type_class_peek_parent (class); - object_class->destroy = gtk_rig_ctrl_destroy; + object_class->destroy = gtk_rig_ctrl_destroy; } @@ -164,6 +166,8 @@ ctrl->pass = NULL; ctrl->qth = NULL; ctrl->conf = NULL; + ctrl->trsp = NULL; + ctrl->trsplist = NULL; ctrl->tracking = FALSE; ctrl->busy = FALSE; ctrl->engaged = FALSE; @@ -190,8 +194,13 @@ g_free (ctrl->conf); ctrl->conf = NULL; } + + /* free transponder */ + if (ctrl->trsplist != NULL) { + free_transponders (ctrl->trsplist); + } - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } @@ -211,7 +220,7 @@ return NULL; } - widget = g_object_new (GTK_TYPE_RIG_CTRL, NULL); + widget = g_object_new (GTK_TYPE_RIG_CTRL, NULL); /* store satellites */ g_hash_table_foreach (module->satellites, store_sats, widget); @@ -496,37 +505,45 @@ gtk_table_attach_defaults (GTK_TABLE (table), track, 3, 4, 0, 1); g_signal_connect (track, "toggled", G_CALLBACK (track_toggle_cb), ctrl); + /* Transponder selector */ + ctrl->TrspSel = gtk_combo_box_new_text (); + gtk_widget_set_tooltip_text (ctrl->TrspSel, _("Select a transponder")); + load_trsp_list (ctrl); + //gtk_combo_box_set_active (GTK_COMBO_BOX (ctrl->TrspSel), 0); + g_signal_connect (ctrl->TrspSel, "changed", G_CALLBACK (trsp_selected_cb), ctrl); + gtk_table_attach_defaults (GTK_TABLE (table), ctrl->TrspSel, 0, 3, 1, 2); + /* Azimuth */ label = gtk_label_new (_("Az:")); gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2); + gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3); ctrl->SatAz = gtk_label_new (buff); gtk_misc_set_alignment (GTK_MISC (ctrl->SatAz), 1.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), ctrl->SatAz, 1, 2, 1, 2); + gtk_table_attach_defaults (GTK_TABLE (table), ctrl->SatAz, 1, 2, 2, 3); /* Elevation */ label = gtk_label_new (_("El:")); gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3); + gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4); ctrl->SatEl = gtk_label_new (buff); gtk_misc_set_alignment (GTK_MISC (ctrl->SatEl), 1.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), ctrl->SatEl, 1, 2, 2, 3); + gtk_table_attach_defaults (GTK_TABLE (table), ctrl->SatEl, 1, 2, 3, 4); /* Range */ label = gtk_label_new (_(" Range:")); gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 2, 3, 1, 2); + gtk_table_attach_defaults (GTK_TABLE (table), label, 2, 3, 2, 3); ctrl->SatRng = gtk_label_new ("0 km"); gtk_misc_set_alignment (GTK_MISC (ctrl->SatRng), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), ctrl->SatRng, 3, 4, 1, 2); + gtk_table_attach_defaults (GTK_TABLE (table), ctrl->SatRng, 3, 4, 2, 3); /* Range rate */ label = gtk_label_new (_(" Rate:")); gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), label, 2, 3, 2, 3); + gtk_table_attach_defaults (GTK_TABLE (table), label, 2, 3, 3, 4); ctrl->SatRngRate = gtk_label_new ("0.0 km/s"); gtk_misc_set_alignment (GTK_MISC (ctrl->SatRngRate), 0.0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (table), ctrl->SatRngRate, 3, 4, 2, 3); + gtk_table_attach_defaults (GTK_TABLE (table), ctrl->SatRngRate, 3, 4, 3, 4); frame = gtk_frame_new (_("Target")); @@ -597,7 +614,7 @@ g_signal_connect (ctrl->DevSel, "changed", G_CALLBACK (rig_selected_cb), ctrl); gtk_table_attach_defaults (GTK_TABLE (table), ctrl->DevSel, 1, 2, 0, 1); /* config will be force-loaded after LO spin is created */ - + /* Engage button */ ctrl->LockBut = gtk_toggle_button_new_with_label (_("Engage")); gtk_widget_set_tooltip_text (ctrl->LockBut, _("Engage the selcted radio device")); @@ -605,7 +622,7 @@ gtk_table_attach_defaults (GTK_TABLE (table), ctrl->LockBut, 2, 3, 0, 1); /* Now, load config*/ - rig_selected_cb (GTK_COMBO_BOX (ctrl->DevSel), ctrl); + rig_selected_cb (GTK_COMBO_BOX (ctrl->DevSel), ctrl); /* Timeout */ label = gtk_label_new (_("Cycle:")); @@ -677,7 +694,8 @@ { GtkRigCtrl *ctrl = GTK_RIG_CTRL (data); GSList *trsplist = NULL; - gint i; + trsp_t *trsp; + gint i,n; i = gtk_combo_box_get_active (satsel); if (i >= 0) { @@ -688,10 +706,27 @@ free_pass (ctrl->pass); ctrl->pass = get_next_pass (ctrl->target, ctrl->qth, 3.0); + /* read transponders for new target */ + load_trsp_list (ctrl); + +#if 0 /* get transponders */ - //trsplist = read_tranponders (ctrl->target->tle.catnr); + trsplist = read_transponders (ctrl->target->tle.catnr); - //g_print ("**** %d \n", g_slist_length (trsplist)); + n = g_slist_length (trsplist); + //g_print ("*** %d\n", n); + for (i = 0; i < n; i++) { + trsp = (trsp_t *) g_slist_nth_data (trsplist, i); + g_print ("%s: %.0f/%.0f/%.0f/%.0f/%s\n", + trsp->name, + trsp->uplow, trsp->uphigh, + trsp->downlow, trsp->downhigh, + trsp->invert ? "INV" : "NONINV"); + + } + + free_transponders (trsplist); +#endif } else { sat_log_log (SAT_LOG_LEVEL_ERROR, @@ -708,6 +743,35 @@ } +/** \brief Manage transponder selections. + * \param box Pointer to the transponder selector widget. + * \param data Pointer to the GtkRigCtrl structure + * + * This function is called when the user selects a new transponder. + * It updates ctrl->trsp with the new selection. + */ +static void trsp_selected_cb (GtkComboBox *box, gpointer data) +{ + GtkRigCtrl *ctrl = GTK_RIG_CTRL (data); + gint i, n; + + i = gtk_combo_box_get_active (box) - 1; /* 0th element is "Transponder" */ + n = g_slist_length (ctrl->trsplist); + + if (i == -1) { + /* clear transponder data */ + ctrl->trsp = NULL; + } + else if (i < n) { + ctrl->trsp = (trsp_t *) g_slist_nth_data (ctrl->trsplist, i); + } + else { + sat_log_log (SAT_LOG_LEVEL_BUG, + _("%s: Inconsistency detected in internal transponder data (%d,%d)"), + __FUNCTION__, i, n); + } +} + /** \brief Manage toggle signals (tracking) * \param button Pointer to the GtkToggle button. * \param data Pointer to the GtkRigCtrl widget. @@ -1533,6 +1597,60 @@ } +/** \brief Load the transponder list for the target satellite. + * \param ctrl Pointer to the GtkRigCtrl structure. + * + * This function loads the transponder list for the currently selected + * satellite. The transponder list is loaded into ctrl->trsplist and the + * transponder names are added to the ctrl->TrspSel combo box. If any of + * these already contain data, it is cleared. The combo box is also cleared + * if there are no transponders for the current target, or if there is no + * target. + */ +static void load_trsp_list (GtkRigCtrl *ctrl) +{ + trsp_t *trsp = NULL; + guint i,n; + + if (ctrl->trsplist != NULL) { + /* clear combo box */ + n = g_slist_length (ctrl->trsplist); + for (i = 0; i < n; i++) { + gtk_combo_box_remove_text (GTK_COMBO_BOX (ctrl->TrspSel), 0); + } + + /* clear transponder list */ + free_transponders (ctrl->trsplist); + } + + /* check if there is a target satellite */ + if G_UNLIKELY (ctrl->target == NULL) { + sat_log_log (SAT_LOG_LEVEL_MSG, + _("%s:%s: GtkSatModule has no target satellite."), + __FILE__, __FUNCTION__); + return; + } + + /* read transponders for new target */ + ctrl->trsplist = read_transponders (ctrl->target->tle.catnr); + + /* append transponder names to combo box */ + n = g_slist_length (ctrl->trsplist); + + if (n == 0) + return; + + for (i = 0; i < n; i++) { + trsp = (trsp_t *) g_slist_nth_data (ctrl->trsplist, i); + gtk_combo_box_append_text (GTK_COMBO_BOX (ctrl->TrspSel), trsp->name); + } + + /* make an initial selection */ + ctrl->trsp = (trsp_t *) g_slist_nth_data (ctrl->trsplist, 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (ctrl->TrspSel), 0); +} + + /** \brief Check that we have at least one .rig file */ static gboolean have_conf () { Modified: trunk/src/gtk-rig-ctrl.h =================================================================== --- trunk/src/gtk-rig-ctrl.h 2009-04-04 22:21:38 UTC (rev 224) +++ trunk/src/gtk-rig-ctrl.h 2009-04-04 22:38:48 UTC (rev 225) @@ -34,6 +34,7 @@ #include "sgpsdp/sgp4sdp4.h" #include "gtk-sat-module.h" #include "radio-conf.h" +#include "trsp-conf.h" #ifdef __cplusplus extern "C" { @@ -44,12 +45,12 @@ #define GTK_TYPE_RIG_CTRL (gtk_rig_ctrl_get_type ()) #define GTK_RIG_CTRL(obj) GTK_CHECK_CAST (obj,\ - gtk_rig_ctrl_get_type (),\ - GtkRigCtrl) + gtk_rig_ctrl_get_type (),\ + GtkRigCtrl) #define GTK_RIG_CTRL_CLASS(klass) GTK_CHECK_CLASS_CAST (klass,\ - gtk_rig_ctrl_get_type (),\ - GtkRigCtrlClass) + gtk_rig_ctrl_get_type (),\ + GtkRigCtrlClass) #define IS_GTK_RIG_CTRL(obj) GTK_CHECK_TYPE (obj, gtk_rig_ctrl_get_type ()) @@ -61,7 +62,7 @@ struct _gtk_rig_ctrl { - GtkVBox vbox; + GtkVBox vbox; GtkWidget *SatFreqDown; GtkWidget *RigFreqDown; @@ -77,10 +78,13 @@ GtkWidget *SatRng,*SatRngRate,*SatDop; /* other widgets */ + GtkWidget *TrspSel; /*!< Transponder selector */ GtkWidget *DevSel; /*!< Device selector */ GtkWidget *LockBut; radio_conf_t *conf; /*!< Radio configuration */ + GSList *trsplist; /*!< List of available transponders */ + trsp_t *trsp; /*!< Current transponder configuration */ GSList *sats; /*!< List of sats in parent module */ sat_t *target; /*!< Target satellite */ @@ -105,7 +109,7 @@ struct _GtkRigCtrlClass { - GtkVBoxClass parent_class; + GtkVBoxClass parent_class; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-04 22:21:41
|
Revision: 224 http://gpredict.svn.sourceforge.net/gpredict/?rev=224&view=rev Author: csete Date: 2009-04-04 22:21:38 +0000 (Sat, 04 Apr 2009) Log Message: ----------- Set empty transponder list to NULL. Modified Paths: -------------- trunk/src/trsp-conf.c Modified: trunk/src/trsp-conf.c =================================================================== --- trunk/src/trsp-conf.c 2009-04-04 22:19:03 UTC (rev 223) +++ trunk/src/trsp-conf.c 2009-04-04 22:21:38 UTC (rev 224) @@ -184,4 +184,5 @@ g_free (trsp); } g_slist_free (trsplist); + trsplist = NULL; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-04 22:19:07
|
Revision: 223 http://gpredict.svn.sourceforge.net/gpredict/?rev=223&view=rev Author: csete Date: 2009-04-04 22:19:03 +0000 (Sat, 04 Apr 2009) Log Message: ----------- Fixed another typo... Modified Paths: -------------- trunk/src/trsp-conf.c trunk/src/trsp-conf.h Modified: trunk/src/trsp-conf.c =================================================================== --- trunk/src/trsp-conf.c 2009-04-03 21:03:23 UTC (rev 222) +++ trunk/src/trsp-conf.c 2009-04-04 22:19:03 UTC (rev 223) @@ -44,7 +44,7 @@ * \param catnum The catalog number of the satellite to read transponders for. * \return The new transponder list. */ -GSList *read_tranponders (guint catnum) +GSList *read_transponders (guint catnum) { GSList *trsplist = NULL; trsp_t *trsp; Modified: trunk/src/trsp-conf.h =================================================================== --- trunk/src/trsp-conf.h 2009-04-03 21:03:23 UTC (rev 222) +++ trunk/src/trsp-conf.h 2009-04-04 22:19:03 UTC (rev 223) @@ -44,7 +44,7 @@ /* The actual data would then be a singly linked list with pointers to transponder_t structures */ -GSList *read_tranponders (guint catnum); +GSList *read_transponders (guint catnum); void write_transponders (guint catnum, GSList *trsplist); void free_transponders (GSList *trsplist); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-03 21:03:25
|
Revision: 222 http://gpredict.svn.sourceforge.net/gpredict/?rev=222&view=rev Author: csete Date: 2009-04-03 21:03:23 +0000 (Fri, 03 Apr 2009) Log Message: ----------- Added function to free transponder list. Modified Paths: -------------- trunk/src/trsp-conf.c trunk/src/trsp-conf.h Modified: trunk/src/trsp-conf.c =================================================================== --- trunk/src/trsp-conf.c 2009-04-03 18:08:52 UTC (rev 221) +++ trunk/src/trsp-conf.c 2009-04-03 21:03:23 UTC (rev 222) @@ -42,7 +42,7 @@ /** \brief Read transponder data file. * \param catnum The catalog number of the satellite to read transponders for. - * \return A newly allocated GSList containing trsp_t structures. + * \return The new transponder list. */ GSList *read_tranponders (guint catnum) { @@ -54,6 +54,7 @@ gchar **groups; gsize numgrp,i; + name = g_strdup_printf ("%d.trsp", catnum); confdir = get_conf_dir(); fname = g_strconcat (confdir, G_DIR_SEPARATOR_S, @@ -137,7 +138,7 @@ g_clear_error (&error); trsp->invert = FALSE; } - + /* add transponder to list */ trsplist = g_slist_append (trsplist, trsp); } @@ -151,17 +152,36 @@ g_free (confdir); g_free (fname); + return trsplist; } /** \brief Write transponder list for satellite. * \param catnum The catlog number of the satellite. - * \param transp Pointer to a GSList of trsp_t structures. + * \param trsplist Pointer to a GSList of trsp_t structures. */ -void write_transponders (guint catnum, GSList *transp) +void write_transponders (guint catnum, GSList *trsplist) { // FIXME sat_log_log (SAT_LOG_LEVEL_BUG, _("%s: Not implemented!"), __FUNCTION__); } +/** \brief Free transponder list. + * \param trsplist Pointer to a GSList of trsp_t structures. + * + * This functions free all memory occupied by the transponder list. + */ +void free_transponders (GSList *trsplist) +{ + gint i, n; + trsp_t *trsp; + + n = g_slist_length (trsplist); + for (i = 0; i < n; i++) { + trsp = (trsp_t *) g_slist_nth_data (trsplist, i); + g_free (trsp->name); + g_free (trsp); + } + g_slist_free (trsplist); +} Modified: trunk/src/trsp-conf.h =================================================================== --- trunk/src/trsp-conf.h 2009-04-03 18:08:52 UTC (rev 221) +++ trunk/src/trsp-conf.h 2009-04-03 21:03:23 UTC (rev 222) @@ -45,8 +45,8 @@ /* The actual data would then be a singly linked list with pointers to transponder_t structures */ GSList *read_tranponders (guint catnum); -void write_transponders (guint catnum, GSList *transp); +void write_transponders (guint catnum, GSList *trsplist); +void free_transponders (GSList *trsplist); - #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-03 18:09:14
|
Revision: 221 http://gpredict.svn.sourceforge.net/gpredict/?rev=221&view=rev Author: csete Date: 2009-04-03 18:08:52 +0000 (Fri, 03 Apr 2009) Log Message: ----------- Fixed a typo in file extension. Modified Paths: -------------- trunk/src/trsp-conf.c Modified: trunk/src/trsp-conf.c =================================================================== --- trunk/src/trsp-conf.c 2009-04-01 22:44:54 UTC (rev 220) +++ trunk/src/trsp-conf.c 2009-04-03 18:08:52 UTC (rev 221) @@ -54,7 +54,7 @@ gchar **groups; gsize numgrp,i; - name = g_strdup_printf ("%d.tsrp", catnum); + name = g_strdup_printf ("%d.trsp", catnum); confdir = get_conf_dir(); fname = g_strconcat (confdir, G_DIR_SEPARATOR_S, "trsp", G_DIR_SEPARATOR_S, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-01 22:45:04
|
Revision: 220 http://gpredict.svn.sourceforge.net/gpredict/?rev=220&view=rev Author: csete Date: 2009-04-01 22:44:54 +0000 (Wed, 01 Apr 2009) Log Message: ----------- Updated. Modified Paths: -------------- trunk/ChangeLog Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-04-01 22:44:06 UTC (rev 219) +++ trunk/ChangeLog 2009-04-01 22:44:54 UTC (rev 220) @@ -1,3 +1,9 @@ +2009-04-01 Alexandru Csete <oz...@gm...> + + * src/trsp-conf.c: + Implemented read_transponders(). + + 2009-03-29 Alexandru Csete <oz...@gm...> * src/gtk-rig-ctrl.[ch]: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-01 22:44:07
|
Revision: 219 http://gpredict.svn.sourceforge.net/gpredict/?rev=219&view=rev Author: csete Date: 2009-04-01 22:44:06 +0000 (Wed, 01 Apr 2009) Log Message: ----------- Added some (currently inactive) code to test read_transponders. Modified Paths: -------------- trunk/src/gtk-rig-ctrl.c Modified: trunk/src/gtk-rig-ctrl.c =================================================================== --- trunk/src/gtk-rig-ctrl.c 2009-04-01 22:43:02 UTC (rev 218) +++ trunk/src/gtk-rig-ctrl.c 2009-04-01 22:44:06 UTC (rev 219) @@ -45,6 +45,7 @@ #include "sat-cfg.h" #include "gtk-freq-knob.h" #include "radio-conf.h" +#include "trsp-conf.h" #ifdef HAVE_CONFIG_H # include <build-config.h> #endif @@ -675,6 +676,7 @@ sat_selected_cb (GtkComboBox *satsel, gpointer data) { GtkRigCtrl *ctrl = GTK_RIG_CTRL (data); + GSList *trsplist = NULL; gint i; i = gtk_combo_box_get_active (satsel); @@ -685,6 +687,11 @@ if (ctrl->pass != NULL) free_pass (ctrl->pass); ctrl->pass = get_next_pass (ctrl->target, ctrl->qth, 3.0); + + /* get transponders */ + //trsplist = read_tranponders (ctrl->target->tle.catnr); + + //g_print ("**** %d \n", g_slist_length (trsplist)); } else { sat_log_log (SAT_LOG_LEVEL_ERROR, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-04-01 22:43:04
|
Revision: 218 http://gpredict.svn.sourceforge.net/gpredict/?rev=218&view=rev Author: csete Date: 2009-04-01 22:43:02 +0000 (Wed, 01 Apr 2009) Log Message: ----------- Added function to read transponder data. Modified Paths: -------------- trunk/src/trsp-conf.c Modified: trunk/src/trsp-conf.c =================================================================== --- trunk/src/trsp-conf.c 2009-03-29 21:36:04 UTC (rev 217) +++ trunk/src/trsp-conf.c 2009-04-01 22:43:02 UTC (rev 218) @@ -38,7 +38,7 @@ #define KEY_UP_HIGH "UP_HIGH" #define KEY_DOWN_LOW "DOWN_LOW" #define KEY_DOWN_HIGH "DOWN_HIGH" -#define KEY_INV "INVERT" +#define KEY_INVERT "INVERT" /** \brief Read transponder data file. * \param catnum The catalog number of the satellite to read transponders for. @@ -46,7 +46,8 @@ */ GSList *read_tranponders (guint catnum) { - GSList *trsp = NULL; + GSList *trsplist = NULL; + trsp_t *trsp; GKeyFile *cfg = NULL; GError *error = NULL; gchar *name,*fname,*confdir; @@ -82,8 +83,65 @@ } else { for (i = 0; i < numgrp; i++) { + trsp = g_try_new (trsp_t, 1); + if G_UNLIKELY(trsp == NULL) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: Failed to allocate memory for transponder data :-("), + __FUNCTION__); + } + else { + /* read transponder data */ + trsp->name = g_strdup (groups[i]); + + trsp->uplow = g_key_file_get_double (cfg, groups[i], KEY_UP_LOW, &error); + if (error != NULL) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: Error reading %s:%s from %s"), + __FUNCTION__, groups[i], KEY_UP_LOW, name); + g_clear_error (&error); + trsp->uplow = 0.0; + } + + trsp->uphigh = g_key_file_get_double (cfg, groups[i], KEY_UP_HIGH, &error); + if (error != NULL) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: Error reading %s:%s from %s"), + __FUNCTION__, groups[i], KEY_UP_HIGH, name); + g_clear_error (&error); + trsp->uphigh = trsp->uplow; + } + + trsp->downlow = g_key_file_get_double (cfg, groups[i], KEY_DOWN_LOW, &error); + if (error != NULL) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: Error reading %s:%s from %s"), + __FUNCTION__, groups[i], KEY_DOWN_LOW, name); + g_clear_error (&error); + trsp->downlow = 0.0; + } + + trsp->downhigh = g_key_file_get_double (cfg, groups[i], KEY_DOWN_HIGH, &error); + if (error != NULL) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: Error reading %s:%s from %s"), + __FUNCTION__, groups[i], KEY_DOWN_HIGH, name); + g_clear_error (&error); + trsp->downhigh = trsp->downlow; + } + + trsp->invert = g_key_file_get_boolean (cfg, groups[i], KEY_INVERT, &error); + if (error != NULL) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s: Error reading %s:%s from %s"), + __FUNCTION__, groups[i], KEY_INVERT, name); + g_clear_error (&error); + trsp->invert = FALSE; + } + + /* add transponder to list */ + trsplist = g_slist_append (trsplist, trsp); + } - } } @@ -93,8 +151,7 @@ g_free (confdir); g_free (fname); - - return NULL; + return trsplist; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cs...@us...> - 2009-03-29 21:36:13
|
Revision: 217 http://gpredict.svn.sourceforge.net/gpredict/?rev=217&view=rev Author: csete Date: 2009-03-29 21:36:04 +0000 (Sun, 29 Mar 2009) Log Message: ----------- Updated. Modified Paths: -------------- trunk/ChangeLog Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-03-29 21:34:58 UTC (rev 216) +++ trunk/ChangeLog 2009-03-29 21:36:04 UTC (rev 217) @@ -1,3 +1,12 @@ +2009-03-29 Alexandru Csete <oz...@gm...> + + * src/gtk-rig-ctrl.[ch]: + Implemented new controller (RX and TX). Pending transponder management. + + * src/trsp-conf.[ch]: + Added files for transpoder data file I/O. + + 2009-03-21 Alexandru Csete <oz...@gm...> * src/radio-conf.[ch]: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |