Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions share/logcfg.dat
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,19 @@ CWTONE=800
#
#################################
# #
# ROTATOR CONTROL #
# (comment out if not present) #
# Rigmodel = Hamlib index, here #
# for Yaesu GS-232B #
#################################
#
#ROTATOR_CONTROL
#ROTMODEL=603
#ROTSPEED=9600
#ROTPORT=/dev/ttyUSB3
#
#################################
# #
# INFORMATION WINDOWS #
# #
#################################
Expand Down
8 changes: 8 additions & 0 deletions src/globalvars.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

#include <glib.h>
#include <hamlib/rig.h>
#include <hamlib/rotator.h>
#include <stdbool.h>

#include <config.h>
Expand Down Expand Up @@ -109,10 +110,13 @@ extern int highqsonr;


extern RIG *my_rig;
extern ROT *my_rot;
extern pthread_mutex_t tlf_rig_mutex;
extern pthread_mutex_t tlf_rot_mutex;
extern cqmode_t cqmode;
extern int trxmode;
extern int myrig_model;
extern int myrot_model;
extern rmode_t rigmode;
extern freq_t freq;
extern char lastqsonr[];
Expand Down Expand Up @@ -187,6 +191,7 @@ extern bool keyer_backspace;
extern int netkeyer_port;
extern int cqdelay;
extern int serial_rate;
extern int rot_serial_rate;
extern int tnc_serial_rate;
extern int countrylist_points;
extern int my_country_points;
Expand Down Expand Up @@ -221,6 +226,7 @@ extern char modem_mode[];
extern char sc_volume[];
extern char clusterlogin[];
extern char rigconf[];
extern char rotconf[];
extern char keyer_device[10];
extern char netkeyer_hostaddress[];
extern char pr_hostaddress[];
Expand All @@ -236,6 +242,7 @@ extern char fldigi_url[50];
extern char *cabrillo;
extern char *editor_cmd;
extern char *rigportname;
extern char *rotportname;
extern char *config_file;
#ifdef HAVE_PYTHON
extern char *plugin_config;
Expand All @@ -257,6 +264,7 @@ extern bool ignoredupe;
extern bool continentlist_only;
extern int debuglevel;
extern bool trx_control;
extern bool rot_control;
extern bool nopacket;
extern bool verbose;

Expand Down
15 changes: 15 additions & 0 deletions src/keyer.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "netkeyer.h"
#include "nicebox.h" // Includes curses.h
#include "sendbuf.h"
#include "sendqrg.h"
#include "speedupndown.h"
#include "stoptx.h"
#include "time_update.h"
Expand Down Expand Up @@ -144,6 +145,20 @@ int handle_common_key(int key) {
break;
}

// Rotate antenna to short path
case '^': {
rotate_to_qrb(false);

break;
}

// Rotate antenna to long path
case '&': {
rotate_to_qrb(true);

break;
}

// <Page-Up>, change RST if call field not empty, else increase CW speed.
case KEY_PPAGE: {
if (change_rst && (strlen(current_qso.call) != 0)) { // change RST
Expand Down
57 changes: 56 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <argp.h>
#include <ctype.h>
#include <hamlib/rig.h>
#include <hamlib/rotator.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down Expand Up @@ -333,13 +334,13 @@ int nr_of_spots; /* Anzahl Lines in spot_ptr array */
int packetinterface = 0;
int fdSertnc = 0;
char tncportname[40];
char rigconf[80];
int tnc_serial_rate = 2400;
char clusterlogin[80] = "";
bool bmautoadd = false;
bool bmautograb = false;

/*-------------------------------------rigctl-------------------------------*/
char rigconf[80];
int myrig_model = 0; /* unset */
RIG *my_rig; /* handle to rig (instance) */
pthread_mutex_t tlf_rig_mutex = PTHREAD_MUTEX_INITIALIZER;
Expand All @@ -355,6 +356,15 @@ int rignumber = 0;
int rig_comm_error = 0;
int rig_comm_success = 0;

/*-------------------------------------rotctl-------------------------------*/
bool rot_control;
int myrot_model; /* unset */
char rotconf[80];
ROT *my_rot; /* handle to rotator (instance) */
pthread_mutex_t tlf_rot_mutex = PTHREAD_MUTEX_INITIALIZER;
int rot_serial_rate;
char *rotportname;

/*----------------------------------fldigi---------------------------------*/
char fldigi_url[50] = "http://localhost:7362/RPC2";

Expand Down Expand Up @@ -420,6 +430,7 @@ char itustr[3];

bool nopacket = false; /* set if tlf is called with '-n' */
bool trx_control_disabled = false; /* set if tlf is called with '-r' */
bool rot_control_disabled = false; /* set if tlf is called with '-R' */
bool convert_cabrillo = false; /* set if the arg input is a cabrillo */

int bandweight_points[NBANDS] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0};
Expand Down Expand Up @@ -450,6 +461,7 @@ static const struct argp_option options[] = {
{"import", 'i', 0, 0, "Import Cabrillo file to Tlf format"},
{"no-cluster", 'n', 0, 0, "Start without cluster hookup" },
{"no-rig", 'r', 0, 0, "Start without radio control" },
{"no-rotator", 'R', 0, 0, "Start without radio control" },
{"list", 'l', 0, 0, "List built-in contests" },
{"sync", 's', "URL", 0, "Synchronize log with other node" },
{
Expand All @@ -476,6 +488,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
case 'r':
trx_control_disabled = true; // disable radio control
break;
case 'R':
rot_control_disabled = true; // disable rotator control
break;
case 'i':
convert_cabrillo = true;
break;
Expand Down Expand Up @@ -664,6 +679,11 @@ static void init_variables() {
rig_mode_sync = true;
use_bandoutput = false;

/* rotctl */
rot_control = false;
myrot_model = 0; /* unset */
rot_serial_rate = 2400;

lan_active = false;
thisnode = 'A';
lan_port = 6788;
Expand Down Expand Up @@ -808,6 +828,36 @@ static void hamlib_init() {
}
}

static void hamlib_rot_init() {

if (rot_control_disabled) {
rot_control = false;
}

if (!rot_control) {
return;
}

shownr("Rotator model number is", myrot_model);
shownr("Rotator speed is", rot_serial_rate);

showmsg("Trying to start rotator control");

int status = init_tlf_rot();

if (status != 0) {
showmsg("Continue without rotator control Y/(N)?");
if (toupper(key_get()) != 'Y') {
endwin();
exit(1);
}
rot_control = false;
rot_control_disabled = true;
showmsg("Disabling rotator control!");
sleep(1);
}
}

static void fldigi_init() {
#ifdef HAVE_LIBXMLRPC
int status;
Expand Down Expand Up @@ -999,6 +1049,10 @@ static void tlf_cleanup() {
close_tlf_rig(my_rig);
}

if (my_rot) {
close_tlf_rot(my_rot);
}

#ifdef HAVE_LIBXMLRPC
if (digikeyer == FLDIGI) {
fldigi_xmlrpc_cleanup();
Expand Down Expand Up @@ -1110,6 +1164,7 @@ int main(int argc, char *argv[]) {
// synclog(synclogfile);

hamlib_init();
hamlib_rot_init();
fldigi_init();
lan_init();
keyer_init();
Expand Down
5 changes: 5 additions & 0 deletions src/parse_logcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,7 @@ static config_t logcfg_configs[] = {
{"IGNOREDUPE", CFG_BOOL(ignoredupe)},
{"USE_CONTINENTLIST_ONLY", CFG_BOOL(continentlist_only)},
{"RADIO_CONTROL", CFG_BOOL(trx_control)},
{"ROTATOR_CONTROL", CFG_BOOL(rot_control)},
{"PORTABLE_MULT_2", CFG_BOOL(portable_x2)},

{"USEPARTIALS", CFG_BOOL(use_part)},
Expand Down Expand Up @@ -1383,13 +1384,15 @@ static config_t logcfg_configs[] = {
{"NETKEYERPORT", CFG_INT(netkeyer_port, 1, INT32_MAX)},
{"TNCSPEED", CFG_INT(tnc_serial_rate, 0, INT32_MAX)},
{"RIGSPEED", CFG_INT(serial_rate, 0, INT32_MAX)},
{"ROTSPEED", CFG_INT(rot_serial_rate, 0, INT32_MAX)},
{"CQDELAY", CFG_INT(cqdelay, 3, 60)},
{"SSBPOINTS", CFG_INT(ssbpoints, 0, INT32_MAX)},
{"CWPOINTS", CFG_INT(cwpoints, 0, INT32_MAX)},
{"WEIGHT", CFG_INT(weight, -50, 50)},
{"TXDELAY", CFG_INT(txdelay, 0, 50)},
{"TUNE_SECONDS", CFG_INT(tune_seconds, 1, 100)},
{"RIGMODEL", CFG_INT(myrig_model, 0, 99999)},
{"ROTMODEL", CFG_INT(myrot_model, 0, 99999)},
{"COUNTRY_LIST_POINTS", CFG_INT(countrylist_points, 0, INT32_MAX)},
{"MY_COUNTRY_POINTS", CFG_INT(my_country_points, 0, INT32_MAX)},
{"MY_CONTINENT_POINTS", CFG_INT(my_cont_points, 0, INT32_MAX)},
Expand All @@ -1406,6 +1409,7 @@ static config_t logcfg_configs[] = {
{"RIGPTT", CFG_INT_CONST(rigptt, CAT_PTT_WANTED)},

{"RIGCONF", CFG_STRING_STATIC(rigconf, 80)},
{"ROTCONF", CFG_STRING_STATIC(rotconf, 80)},
{"LOGFILE", CFG_STRING_STATIC(logfile, 120)},
{"KEYER_DEVICE", CFG_STRING_STATIC(keyer_device, 10)},
{"NETKEYERHOST", CFG_STRING_STATIC(netkeyer_hostaddress, 16)},
Expand All @@ -1429,6 +1433,7 @@ static config_t logcfg_configs[] = {
#endif

{"RIGPORT", CFG_STRING_NOCHOMP(rigportname)},
{"ROTPORT", CFG_STRING_NOCHOMP(rotportname)},
{"CLUSTERLOGIN", CFG_STRING_STATIC_NOCHOMP(clusterlogin, 80)},

{"CALL", NEED_PARAM, cfg_call},
Expand Down
2 changes: 0 additions & 2 deletions src/qrb.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include <hamlib/rotator.h>

#include "globalvars.h"
#include "qrb.h"

Expand Down
Loading