kopia lustrzana https://github.com/Hamlib/Hamlib
All kenwoods to have 3-char commands for functions and return whatever value the rig returns instead of 0/1
Changes to add more ts890 capabilities, e.g. NB2, BC2pull/78/head
rodzic
8b695bcc03
commit
0316376b45
|
@ -2056,7 +2056,12 @@ int kenwood_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
|
||||||
return kenwood_transaction(rig, buf, NULL, 0);
|
return kenwood_transaction(rig, buf, NULL, 0);
|
||||||
|
|
||||||
case RIG_FUNC_COMP:
|
case RIG_FUNC_COMP:
|
||||||
snprintf(buf, sizeof (buf), "PR%c", (status == 0) ? '0' : '1');
|
if (RIG_MODEL_TS890S == rig->caps->rig_model) {
|
||||||
|
snprintf(buf, sizeof (buf), "PR0%c", (status == 0) ? '0' : '1');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
snprintf(buf, sizeof (buf), "PR%c", (status == 0) ? '0' : '1');
|
||||||
|
}
|
||||||
return kenwood_transaction(rig, buf, NULL, 0);
|
return kenwood_transaction(rig, buf, NULL, 0);
|
||||||
|
|
||||||
case RIG_FUNC_TONE:
|
case RIG_FUNC_TONE:
|
||||||
|
@ -2076,13 +2081,24 @@ int kenwood_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
|
||||||
return kenwood_transaction(rig, buf, NULL, 0);
|
return kenwood_transaction(rig, buf, NULL, 0);
|
||||||
|
|
||||||
case RIG_FUNC_NR:
|
case RIG_FUNC_NR:
|
||||||
snprintf(buf, sizeof (buf), "NR%c", (status == 0) ? '0' : '1');
|
if (RIG_MODEL_TS890S == rig->caps->rig_model) {
|
||||||
|
char c = '1';
|
||||||
|
if (status == 2) c = '2';
|
||||||
|
snprintf(buf, sizeof (buf), "NR%c", (status == 0) ? '0' : c);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
snprintf(buf, sizeof (buf), "NR%c", (status == 0) ? '0' : '1');
|
||||||
|
}
|
||||||
return kenwood_transaction(rig, buf, NULL, 0);
|
return kenwood_transaction(rig, buf, NULL, 0);
|
||||||
|
|
||||||
case RIG_FUNC_BC:
|
case RIG_FUNC_BC:
|
||||||
snprintf(buf, sizeof (buf), "BC%c", (status == 0) ? '0' : '1');
|
snprintf(buf, sizeof (buf), "BC%c", (status == 0) ? '0' : '1');
|
||||||
return kenwood_transaction(rig, buf, NULL, 0);
|
return kenwood_transaction(rig, buf, NULL, 0);
|
||||||
|
|
||||||
|
case RIG_FUNC_BC2:
|
||||||
|
snprintf(buf, sizeof (buf), "BC%c", (status == 0) ? '0' : '2');
|
||||||
|
return kenwood_transaction(rig, buf, NULL, 0);
|
||||||
|
|
||||||
case RIG_FUNC_ANF:
|
case RIG_FUNC_ANF:
|
||||||
snprintf(buf, sizeof (buf), "NT%c", (status == 0) ? '0' : '1');
|
snprintf(buf, sizeof (buf), "NT%c", (status == 0) ? '0' : '1');
|
||||||
return kenwood_transaction(rig, buf, NULL, 0);
|
return kenwood_transaction(rig, buf, NULL, 0);
|
||||||
|
@ -2112,8 +2128,9 @@ int kenwood_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* works for any 'format 1' command
|
* works for any 'format 1' command or newer command like the TS890 has
|
||||||
* answer is always 4 bytes: two byte command id, status and terminator
|
* as long as the return is a number 0-9
|
||||||
|
* answer is always 4 bytes or 5 bytes: two or three byte command id, status and terminator
|
||||||
*/
|
*/
|
||||||
int get_kenwood_func(RIG *rig, const char *cmd, int *status)
|
int get_kenwood_func(RIG *rig, const char *cmd, int *status)
|
||||||
{
|
{
|
||||||
|
@ -2125,11 +2142,14 @@ int get_kenwood_func(RIG *rig, const char *cmd, int *status)
|
||||||
int retval;
|
int retval;
|
||||||
char buf[10];
|
char buf[10];
|
||||||
|
|
||||||
retval = kenwood_safe_transaction(rig, cmd, buf, 10, 3);
|
int offset=2;
|
||||||
|
if (strlen(cmd)==3) offset=3; // some commands are 3 letters
|
||||||
|
|
||||||
|
retval = kenwood_safe_transaction(rig, cmd, buf, sizeof(buf), offset+1);
|
||||||
if (retval != RIG_OK)
|
if (retval != RIG_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
*status = buf[2] == '0' ? 0 : 1;
|
*status = buf[offset] - '0'; // just return whatever the rig returns
|
||||||
|
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
};
|
};
|
||||||
|
@ -2139,6 +2159,7 @@ int get_kenwood_func(RIG *rig, const char *cmd, int *status)
|
||||||
*/
|
*/
|
||||||
int kenwood_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
|
int kenwood_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
|
||||||
{
|
{
|
||||||
|
char *cmd;
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
|
||||||
if (!rig || !status)
|
if (!rig || !status)
|
||||||
|
@ -2157,7 +2178,11 @@ int kenwood_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
|
|
||||||
case RIG_FUNC_NB:
|
case RIG_FUNC_NB:
|
||||||
return get_kenwood_func(rig, "NB", status);
|
cmd = "NB";
|
||||||
|
if (RIG_MODEL_TS890S == rig->caps->rig_model) {
|
||||||
|
cmd = "NB1";
|
||||||
|
}
|
||||||
|
return get_kenwood_func(rig, cmd, status);
|
||||||
|
|
||||||
case RIG_FUNC_NB2:
|
case RIG_FUNC_NB2:
|
||||||
return get_kenwood_func(rig, "NB2", status);
|
return get_kenwood_func(rig, "NB2", status);
|
||||||
|
@ -2181,8 +2206,20 @@ int kenwood_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
|
||||||
return get_kenwood_func(rig, "NR", status);
|
return get_kenwood_func(rig, "NR", status);
|
||||||
|
|
||||||
/* FIXME on TS2000 */
|
/* FIXME on TS2000 */
|
||||||
case RIG_FUNC_BC:
|
// Check for BC #1
|
||||||
return get_kenwood_func(rig, "BC", status);
|
case RIG_FUNC_BC: // Most will return BC1 or BC0, if BC2 then BC1 is off
|
||||||
|
retval = get_kenwood_func(rig, "BC", status);
|
||||||
|
if (retval == RIG_OK) {
|
||||||
|
*status = *status == '1' ? '1': '0';
|
||||||
|
}
|
||||||
|
return retval;
|
||||||
|
|
||||||
|
case RIG_FUNC_BC2: // TS-890 check Beat Cancel 2 we return boolean true/false
|
||||||
|
retval = get_kenwood_func(rig, "BC", status);
|
||||||
|
if (retval == RIG_OK) {
|
||||||
|
*status = *status == '2' ? '1': '0';
|
||||||
|
}
|
||||||
|
return retval;
|
||||||
|
|
||||||
case RIG_FUNC_ANF:
|
case RIG_FUNC_ANF:
|
||||||
return get_kenwood_func(rig, "NT", status);
|
return get_kenwood_func(rig, "NT", status);
|
||||||
|
|
1052
kenwood/ts480.c
1052
kenwood/ts480.c
Plik diff jest za duży
Load Diff
Ładowanie…
Reference in New Issue