Fix rotorez set_conf in both rotctl and rotctld -- since it needs to be done after rot_open

pull/1565/head
Mike Black W9MDB 2024-06-07 16:07:57 -05:00
rodzic c112a5f6a9
commit 1557ad70f7
2 zmienionych plików z 61 dodań i 2 usunięć

Wyświetl plik

@ -341,7 +341,8 @@ int main(int argc, char *argv[])
char *token = strtok(conf_parms, ",");
while (token)
// ROTOREZ set_conf needs to be done after rot_open
while (token && my_rot->caps->rot_model != ROT_MODEL_ROTOREZ)
{
char mytoken[100], myvalue[100];
hamlib_token_t lookup;
@ -406,6 +407,34 @@ int main(int argc, char *argv[])
exit(2);
}
// ROTOREZ set_conf needs to be done after rot_open
while (token && my_rot->caps->rot_model == ROT_MODEL_ROTOREZ)
{
char mytoken[100], myvalue[100];
hamlib_token_t lookup;
sscanf(token, "%99[^=]=%99s", mytoken, myvalue);
//printf("mytoken=%s,myvalue=%s\n",mytoken, myvalue);
lookup = rot_token_lookup(my_rot, mytoken);
if (lookup == 0)
{
rig_debug(RIG_DEBUG_ERR, "%s: no such token as '%s', use -L switch to see\n",
__func__, mytoken);
token = strtok(NULL, ",");
continue;
}
retcode = rot_set_conf(my_rot, rot_token_lookup(my_rot, mytoken), myvalue);
if (retcode != RIG_OK)
{
fprintf(stderr, "Config parameter error: %s\n", rigerror(retcode));
exit(2);
}
token = strtok(NULL, ",");
}
/*
* Print out capabilities, and exits immediately as we may be interested
* only in caps, and rig_open may fail.

Wyświetl plik

@ -347,7 +347,8 @@ int main(int argc, char *argv[])
char *token = strtok(conf_parms, ",");
while (token)
// ROTOREZ set_conf needs to be done after rot_open
while (token && my_rot->caps->rot_model != ROT_MODEL_ROTOREZ)
{
char mytoken[100], myvalue[100];
hamlib_token_t lookup;
@ -417,6 +418,35 @@ int main(int argc, char *argv[])
exit(2);
}
// ROTOREZ set_conf needs to be done after rot_open
while (token && my_rot->caps->rot_model == ROT_MODEL_ROTOREZ)
{
char mytoken[100], myvalue[100];
hamlib_token_t lookup;
sscanf(token, "%99[^=]=%99s", mytoken, myvalue);
//printf("mytoken=%s,myvalue=%s\n",mytoken, myvalue);
lookup = rot_token_lookup(my_rot, mytoken);
if (lookup == 0)
{
rig_debug(RIG_DEBUG_ERR, "%s: no such token as '%s', use -L switch to see\n",
__func__, mytoken);
token = strtok(NULL, ",");
continue;
}
retcode = rot_set_conf(my_rot, rot_token_lookup(my_rot, mytoken), myvalue);
if (retcode != RIG_OK)
{
fprintf(stderr, "Config parameter error: %s\n", rigerror(retcode));
exit(2);
}
token = strtok(NULL, ",");
}
my_rot->state.az_offset = az_offset;
my_rot->state.el_offset = el_offset;