23
23
#include <argp.h>
24
24
#include <ctype.h>
25
25
#include <hamlib/rig.h>
26
+ #include <hamlib/rotator.h>
26
27
#include <pthread.h>
27
28
#include <stdio.h>
28
29
#include <stdlib.h>
50
51
#include "netkeyer.h"
51
52
#include "parse_logcfg.h"
52
53
#include "plugin.h"
54
+ #include "qrb.h"
53
55
#include "qtcvars.h" // Includes globalvars.h
54
56
#include "readctydata.h"
55
57
#include "readcalls.h"
@@ -332,13 +334,13 @@ int nr_of_spots; /* Anzahl Lines in spot_ptr array */
332
334
int packetinterface = 0 ;
333
335
int fdSertnc = 0 ;
334
336
char tncportname [40 ];
335
- char rigconf [80 ];
336
337
int tnc_serial_rate = 2400 ;
337
338
char clusterlogin [80 ] = "" ;
338
339
bool bmautoadd = false;
339
340
bool bmautograb = false;
340
341
341
342
/*-------------------------------------rigctl-------------------------------*/
343
+ char rigconf [80 ];
342
344
int myrig_model = 0 ; /* unset */
343
345
RIG * my_rig ; /* handle to rig (instance) */
344
346
pthread_mutex_t tlf_rig_mutex = PTHREAD_MUTEX_INITIALIZER ;
@@ -354,6 +356,18 @@ int rignumber = 0;
354
356
int rig_comm_error = 0 ;
355
357
int rig_comm_success = 0 ;
356
358
359
+ /*-------------------------------------rotctl-------------------------------*/
360
+ bool rot_control = false;
361
+ int myrot_model = 0 ; /* unset */
362
+ char rotconf [80 ];
363
+ ROT * my_rot ; /* handle to rotator (instance) */
364
+ pthread_mutex_t tlf_rot_mutex = PTHREAD_MUTEX_INITIALIZER ;
365
+ int rot_serial_rate = 2400 ;
366
+ char * rotportname ;
367
+ int rotnumber = 0 ;
368
+ int rot_comm_error = 0 ;
369
+ int rot_comm_success = 0 ;
370
+
357
371
/*----------------------------------fldigi---------------------------------*/
358
372
char fldigi_url [50 ] = "http://localhost:7362/RPC2" ;
359
373
@@ -419,6 +433,7 @@ char itustr[3];
419
433
420
434
bool nopacket = false; /* set if tlf is called with '-n' */
421
435
bool trx_control_disabled = false; /* set if tlf is called with '-r' */
436
+ bool rot_control_disabled = false; /* set if tlf is called with '-R' */
422
437
bool convert_cabrillo = false; /* set if the arg input is a cabrillo */
423
438
424
439
int bandweight_points [NBANDS ] = {1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 };
@@ -449,6 +464,7 @@ static const struct argp_option options[] = {
449
464
{"import" , 'i' , 0 , 0 , "Import Cabrillo file to Tlf format" },
450
465
{"no-cluster" , 'n' , 0 , 0 , "Start without cluster hookup" },
451
466
{"no-rig" , 'r' , 0 , 0 , "Start without radio control" },
467
+ {"no-rotator" , 'R' , 0 , 0 , "Start without radio control" },
452
468
{"list" , 'l' , 0 , 0 , "List built-in contests" },
453
469
{"sync" , 's' , "URL" , 0 , "Synchronize log with other node" },
454
470
{"debug" , 'd' , 0 , 0 , "Debug mode" },
@@ -472,6 +488,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
472
488
case 'r' :
473
489
trx_control_disabled = true; // disable radio control
474
490
break ;
491
+ case 'R' :
492
+ rot_control_disabled = true; // disable rotator control
493
+ break ;
475
494
case 'i' :
476
495
convert_cabrillo = true;
477
496
break ;
@@ -800,6 +819,36 @@ static void hamlib_init() {
800
819
}
801
820
}
802
821
822
+ static void hamlib_rot_init () {
823
+
824
+ if (rot_control_disabled ) {
825
+ rot_control = false;
826
+ }
827
+
828
+ if (!rot_control ) {
829
+ return ;
830
+ }
831
+
832
+ shownr ("Rotator model number is" , myrot_model );
833
+ shownr ("Rotator speed is" , rot_serial_rate );
834
+
835
+ showmsg ("Trying to start rotator control" );
836
+
837
+ int status = init_tlf_rot ();
838
+
839
+ if (status != 0 ) {
840
+ showmsg ("Continue without rotator control Y/(N)?" );
841
+ if (toupper (key_get ()) != 'Y' ) {
842
+ endwin ();
843
+ exit (1 );
844
+ }
845
+ trx_control = false;
846
+ trx_control_disabled = true;
847
+ showmsg ("Disabling rotator control!" );
848
+ sleep (1 );
849
+ }
850
+ }
851
+
803
852
static void fldigi_init () {
804
853
#ifdef HAVE_LIBXMLRPC
805
854
int status ;
@@ -991,6 +1040,10 @@ static void tlf_cleanup() {
991
1040
close_tlf_rig (my_rig );
992
1041
}
993
1042
1043
+ if (my_rot ) {
1044
+ close_tlf_rot (my_rot );
1045
+ }
1046
+
994
1047
#ifdef HAVE_LIBXMLRPC
995
1048
if (digikeyer == FLDIGI ) {
996
1049
fldigi_xmlrpc_cleanup ();
@@ -1098,6 +1151,7 @@ int main(int argc, char *argv[]) {
1098
1151
// synclog(synclogfile);
1099
1152
1100
1153
hamlib_init ();
1154
+ hamlib_rot_init ();
1101
1155
fldigi_init ();
1102
1156
lan_init ();
1103
1157
keyer_init ();
0 commit comments