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"
@@ -331,13 +333,13 @@ int nr_of_spots; /* Anzahl Lines in spot_ptr array */
331
333
int packetinterface = 0 ;
332
334
int fdSertnc = 0 ;
333
335
char tncportname [40 ];
334
- char rigconf [80 ];
335
336
int tnc_serial_rate = 2400 ;
336
337
char clusterlogin [80 ] = "" ;
337
338
bool bmautoadd = false;
338
339
bool bmautograb = false;
339
340
340
341
/*-------------------------------------rigctl-------------------------------*/
342
+ char rigconf [80 ];
341
343
int myrig_model = 0 ; /* unset */
342
344
RIG * my_rig ; /* handle to rig (instance) */
343
345
pthread_mutex_t tlf_rig_mutex = PTHREAD_MUTEX_INITIALIZER ;
@@ -353,6 +355,18 @@ int rignumber = 0;
353
355
int rig_comm_error = 0 ;
354
356
int rig_comm_success = 0 ;
355
357
358
+ /*-------------------------------------rotctl-------------------------------*/
359
+ bool rot_control = false;
360
+ int myrot_model = 0 ; /* unset */
361
+ char rotconf [80 ];
362
+ ROT * my_rot ; /* handle to rotator (instance) */
363
+ pthread_mutex_t tlf_rot_mutex = PTHREAD_MUTEX_INITIALIZER ;
364
+ int rot_serial_rate = 2400 ;
365
+ char * rotportname ;
366
+ int rotnumber = 0 ;
367
+ int rot_comm_error = 0 ;
368
+ int rot_comm_success = 0 ;
369
+
356
370
/*----------------------------------fldigi---------------------------------*/
357
371
char fldigi_url [50 ] = "http://localhost:7362/RPC2" ;
358
372
@@ -418,6 +432,7 @@ char itustr[3];
418
432
419
433
bool nopacket = false; /* set if tlf is called with '-n' */
420
434
bool trx_control_disabled = false; /* set if tlf is called with '-r' */
435
+ bool rot_control_disabled = false; /* set if tlf is called with '-R' */
421
436
bool convert_cabrillo = false; /* set if the arg input is a cabrillo */
422
437
423
438
int bandweight_points [NBANDS ] = {1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 };
@@ -448,6 +463,7 @@ static const struct argp_option options[] = {
448
463
{"import" , 'i' , 0 , 0 , "Import Cabrillo file to Tlf format" },
449
464
{"no-cluster" , 'n' , 0 , 0 , "Start without cluster hookup" },
450
465
{"no-rig" , 'r' , 0 , 0 , "Start without radio control" },
466
+ {"no-rotator" , 'R' , 0 , 0 , "Start without radio control" },
451
467
{"list" , 'l' , 0 , 0 , "List built-in contests" },
452
468
{"sync" , 's' , "URL" , 0 , "Synchronize log with other node" },
453
469
{"debug" , 'd' , 0 , 0 , "Debug mode" },
@@ -471,6 +487,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
471
487
case 'r' :
472
488
trx_control_disabled = true; // disable radio control
473
489
break ;
490
+ case 'R' :
491
+ rot_control_disabled = true; // disable rotator control
492
+ break ;
474
493
case 'i' :
475
494
convert_cabrillo = true;
476
495
break ;
@@ -788,6 +807,36 @@ static void hamlib_init() {
788
807
}
789
808
}
790
809
810
+ static void hamlib_rot_init () {
811
+
812
+ if (rot_control_disabled ) {
813
+ rot_control = false;
814
+ }
815
+
816
+ if (!rot_control ) {
817
+ return ;
818
+ }
819
+
820
+ shownr ("Rotator model number is" , myrot_model );
821
+ shownr ("Rotator speed is" , rot_serial_rate );
822
+
823
+ showmsg ("Trying to start rotator control" );
824
+
825
+ int status = init_tlf_rot ();
826
+
827
+ if (status != 0 ) {
828
+ showmsg ("Continue without rotator control Y/(N)?" );
829
+ if (toupper (key_get ()) != 'Y' ) {
830
+ endwin ();
831
+ exit (1 );
832
+ }
833
+ trx_control = false;
834
+ trx_control_disabled = true;
835
+ showmsg ("Disabling rotator control!" );
836
+ sleep (1 );
837
+ }
838
+ }
839
+
791
840
static void fldigi_init () {
792
841
#ifdef HAVE_LIBXMLRPC
793
842
int status ;
@@ -979,6 +1028,10 @@ static void tlf_cleanup() {
979
1028
close_tlf_rig (my_rig );
980
1029
}
981
1030
1031
+ if (my_rot ) {
1032
+ close_tlf_rot (my_rot );
1033
+ }
1034
+
982
1035
#ifdef HAVE_LIBXMLRPC
983
1036
if (digikeyer == FLDIGI ) {
984
1037
fldigi_xmlrpc_cleanup ();
@@ -1086,6 +1139,7 @@ int main(int argc, char *argv[]) {
1086
1139
// synclog(synclogfile);
1087
1140
1088
1141
hamlib_init ();
1142
+ hamlib_rot_init ();
1089
1143
fldigi_init ();
1090
1144
lan_init ();
1091
1145
keyer_init ();
0 commit comments