kopia lustrzana https://github.com/Hamlib/Hamlib
Add az and el offset to rotctl & rotctld
rodzic
4401300659
commit
a7335595de
|
@ -308,6 +308,8 @@ struct rot_state {
|
|||
elevation_t min_el; /*!< Lower limit for elevation (overridable). */
|
||||
elevation_t max_el; /*!< Upper limit for elevation (overridable). */
|
||||
int south_zero; /*!< South is zero degrees */
|
||||
azimuth_t az_offset; /*!< Offset to be applied to azimuth */
|
||||
elevation_t el_offset; /*!< Offset to be applied to elevation */
|
||||
|
||||
/*
|
||||
* non overridable fields, internal use
|
||||
|
|
|
@ -82,7 +82,7 @@ void usage();
|
|||
* NB: do NOT use -W since it's reserved by POSIX.
|
||||
* TODO: add an option to read from a file
|
||||
*/
|
||||
#define SHORT_OPTIONS "+m:r:s:C:t:LvhVluZ"
|
||||
#define SHORT_OPTIONS "+m:r:s:C:o:O:t:LvhVluZ"
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"model", 1, 0, 'm'},
|
||||
|
@ -91,6 +91,8 @@ static struct option long_options[] =
|
|||
{"send-cmd-term", 1, 0, 't'},
|
||||
{"list", 0, 0, 'l'},
|
||||
{"set-conf", 1, 0, 'C'},
|
||||
{"set-azoffset", 1, 0, 'o'},
|
||||
{"set-eloffset", 1, 0, 'O'},
|
||||
{"show-conf", 0, 0, 'L'},
|
||||
{"dump-caps", 0, 0, 'u'},
|
||||
{"debug-time-stamps", 0, 0, 'Z'},
|
||||
|
@ -111,6 +113,9 @@ static struct option long_options[] =
|
|||
static const int have_rl = 1;
|
||||
#endif
|
||||
|
||||
double az_offset;
|
||||
double el_offset;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
ROT *my_rot; /* handle to rot (instance) */
|
||||
|
@ -138,6 +143,8 @@ int main(int argc, char *argv[])
|
|||
int interactive = 1; /* if no cmd on command line, switch to interactive */
|
||||
int prompt = 1; /* Print prompt in rotctl */
|
||||
char send_cmd_term = '\r'; /* send_cmd termination char */
|
||||
azimuth_t az_offset = 0;
|
||||
elevation_t el_offset = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
@ -227,6 +234,27 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
if (!optarg)
|
||||
{
|
||||
usage(); /* wrong arg count */
|
||||
exit(1);
|
||||
}
|
||||
|
||||
az_offset = atof(optarg);
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
if (!optarg)
|
||||
{
|
||||
usage(); /* wrong arg count */
|
||||
exit(1);
|
||||
}
|
||||
|
||||
el_offset = atof(optarg);
|
||||
break;
|
||||
|
||||
#ifdef HAVE_READLINE_HISTORY
|
||||
|
||||
case 'i':
|
||||
|
@ -338,6 +366,9 @@ int main(int argc, char *argv[])
|
|||
exit(2);
|
||||
}
|
||||
|
||||
my_rot->state.az_offset = az_offset;
|
||||
my_rot->state.el_offset = el_offset;
|
||||
|
||||
if (verbose > 0)
|
||||
{
|
||||
printf("Opened rot model %d, '%s'\n",
|
||||
|
@ -452,6 +483,8 @@ void usage()
|
|||
" -s, --serial-speed=BAUD set serial speed of the serial port\n"
|
||||
" -t, --send-cmd-term=CHAR set send_cmd command termination char\n"
|
||||
" -C, --set-conf=PARM=VAL set config parameters\n"
|
||||
" -o, --set-azoffset==VAL set offset for azimuth\n"
|
||||
" -O, --set-eloffset==VAL set offset for elevation\n"
|
||||
" -L, --show-conf list all config parameters\n"
|
||||
" -l, --list list all model numbers and exit\n"
|
||||
" -u, --dump-caps dump capabilities and exit\n"
|
||||
|
|
|
@ -1681,7 +1681,7 @@ declare_proto_rot(set_position)
|
|||
|
||||
CHKSCN1ARG(sscanf(arg1, "%f", &az));
|
||||
CHKSCN1ARG(sscanf(arg2, "%f", &el));
|
||||
return rot_set_position(rot, az, el);
|
||||
return rot_set_position(rot, az + rot->state.az_offset, el);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1694,6 +1694,8 @@ declare_proto_rot(get_position)
|
|||
|
||||
status = rot_get_position(rot, &az, &el);
|
||||
|
||||
az -= rot->state.az_offset;
|
||||
|
||||
if (status != RIG_OK)
|
||||
{
|
||||
return status;
|
||||
|
|
|
@ -84,7 +84,7 @@ void usage();
|
|||
* NB: do NOT use -W since it's reserved by POSIX.
|
||||
* TODO: add an option to read from a file
|
||||
*/
|
||||
#define SHORT_OPTIONS "m:r:s:C:t:T:LuvhVlZ"
|
||||
#define SHORT_OPTIONS "m:r:s:C:o:O:t:T:LuvhVlZ"
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"model", 1, 0, 'm'},
|
||||
|
@ -94,6 +94,8 @@ static struct option long_options[] =
|
|||
{"listen-addr", 1, 0, 'T'},
|
||||
{"list", 0, 0, 'l'},
|
||||
{"set-conf", 1, 0, 'C'},
|
||||
{"set-azoffset", 1, 0, 'o'},
|
||||
{"set-eloffset", 1, 0, 'O'},
|
||||
{"show-conf", 0, 0, 'L'},
|
||||
{"dump-caps", 0, 0, 'u'},
|
||||
{"debug-time-stamps", 0, 0, 'Z'},
|
||||
|
@ -105,6 +107,8 @@ static struct option long_options[] =
|
|||
|
||||
const char *portno = "4533";
|
||||
const char *src_addr = NULL; /* INADDR_ANY */
|
||||
azimuth_t az_offset;
|
||||
elevation_t el_offset;
|
||||
|
||||
#define MAXCONFLEN 128
|
||||
|
||||
|
@ -259,6 +263,25 @@ int main(int argc, char *argv[])
|
|||
src_addr = optarg;
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
if (!optarg)
|
||||
{
|
||||
usage(); /* wrong arg count */
|
||||
exit(1);
|
||||
}
|
||||
|
||||
az_offset = atof(optarg);
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
if (!optarg)
|
||||
{
|
||||
usage(); /* wrong arg count */
|
||||
exit(1);
|
||||
}
|
||||
|
||||
el_offset = atof(optarg);
|
||||
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
|
@ -349,6 +372,9 @@ int main(int argc, char *argv[])
|
|||
exit(2);
|
||||
}
|
||||
|
||||
my_rot->state.az_offset = az_offset;
|
||||
my_rot->state.el_offset = el_offset;
|
||||
|
||||
if (verbose > 0)
|
||||
{
|
||||
printf("Opened rot model %d, '%s'\n",
|
||||
|
@ -689,6 +715,8 @@ void usage()
|
|||
" -t, --port=NUM set TCP listening port, default %s\n"
|
||||
" -T, --listen-addr=IPADDR set listening IP address, default ANY\n"
|
||||
" -C, --set-conf=PARM=VAL set config parameters\n"
|
||||
" -o, --set-azoffset==VAL set offset for azimuth\n"
|
||||
" -O, --set-eloffset==VAL set offset for elevation\n"
|
||||
" -L, --show-conf list all config parameters\n"
|
||||
" -l, --list list all model numbers and exit\n"
|
||||
" -u, --dump-caps dump capabilities and exit\n"
|
||||
|
|
Ładowanie…
Reference in New Issue