kopia lustrzana https://github.com/Hamlib/Hamlib
rodzic
1f9d3a63d4
commit
5059ec8cd6
|
@ -22,10 +22,12 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <hamlib/rig.h>
|
||||
#include "kenwood.h"
|
||||
#include "ts990s.h"
|
||||
#include "cal.h"
|
||||
|
||||
#define TS990S_AM_MODES RIG_MODE_AM
|
||||
#define TS990S_FM_MODES (RIG_MODE_FM|RIG_MODE_FMN)
|
||||
|
@ -37,7 +39,7 @@
|
|||
|
||||
#define TS2000_FUNC_ALL (RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_BC|RIG_FUNC_NB|RIG_FUNC_NR|RIG_FUNC_ANF|RIG_FUNC_COMP)
|
||||
|
||||
#define TS2000_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_VOXDELAY|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_CWPITCH|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD|RIG_LEVEL_COMP|RIG_LEVEL_AGC|RIG_LEVEL_BKINDL|RIG_LEVEL_METER|RIG_LEVEL_VOXGAIN|RIG_LEVEL_ANTIVOX|RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH)
|
||||
#define TS2000_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_VOXDELAY|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_CWPITCH|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD|RIG_LEVEL_COMP|RIG_LEVEL_AGC|RIG_LEVEL_BKINDL|RIG_LEVEL_METER|RIG_LEVEL_VOXGAIN|RIG_LEVEL_ANTIVOX|RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH|RIG_LEVEL_SWR)
|
||||
|
||||
#define TS990S_VFO_OP (RIG_OP_BAND_UP|RIG_OP_BAND_DOWN)
|
||||
#define TS990S_SCAN_OP (RIG_SCAN_VFO)
|
||||
|
@ -54,6 +56,16 @@
|
|||
{0x46, 60}}\
|
||||
}
|
||||
|
||||
#define TS990S_SWR_CAL { 5, \
|
||||
{ \
|
||||
{ 0, 1.0f }, \
|
||||
{ 14, 1.5f }, \
|
||||
{ 28, 2.0f }, \
|
||||
{ 42, 3.0f }, \
|
||||
{ 70, 10.0f } \
|
||||
} }
|
||||
|
||||
|
||||
/* memory capabilities */
|
||||
#define TS990S_MEM_CAP { \
|
||||
.freq = 1, \
|
||||
|
@ -121,7 +133,7 @@ const struct rig_caps ts990s_caps =
|
|||
RIG_MODEL(RIG_MODEL_TS990S),
|
||||
.model_name = "TS-990S",
|
||||
.mfg_name = "Kenwood",
|
||||
.version = BACKEND_VER ".5",
|
||||
.version = BACKEND_VER ".6",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
@ -311,6 +323,7 @@ const struct rig_caps ts990s_caps =
|
|||
},
|
||||
|
||||
.str_cal = TS990S_STR_CAL,
|
||||
.swr_cal = TS990S_SWR_CAL,
|
||||
|
||||
.priv = (void *)& ts990s_priv_caps,
|
||||
|
||||
|
@ -633,6 +646,19 @@ int ts990s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
val->i = lvl / 100;
|
||||
break;
|
||||
|
||||
case RIG_LEVEL_SWR:
|
||||
retval = kenwood_safe_transaction(rig, "RM21", lvlbuf, sizeof(lvlbuf), 7);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
sscanf(lvlbuf, "RM2%d", &lvl);
|
||||
val->f = rig_raw2val_float(lvl, &rig->caps->swr_cal);
|
||||
val->f = round(val->f*10)/10.0; // 1 decimal place precision
|
||||
break;
|
||||
|
||||
case RIG_LEVEL_METER:
|
||||
retval = kenwood_safe_transaction(rig, "RM", lvlbuf, sizeof(lvlbuf), 7);
|
||||
|
||||
|
@ -715,7 +741,7 @@ int ts990s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unsupported get_level %s", __func__,
|
||||
rig_strlevel(level));
|
||||
|
|
|
@ -14,6 +14,7 @@ struct ip_mreq
|
|||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <hamlib/rig.h>
|
||||
|
||||
#define BUFSIZE 256
|
||||
|
@ -32,22 +33,6 @@ int modeMain = 2;
|
|||
int modeSub = 2;
|
||||
int keyspd = 20;
|
||||
|
||||
int
|
||||
getmyline(int fd, char *buf)
|
||||
{
|
||||
char c;
|
||||
int i = 0;
|
||||
memset(buf, 0, BUFSIZE);
|
||||
|
||||
while (read(fd, &c, 1) > 0)
|
||||
{
|
||||
buf[i++] = c;
|
||||
|
||||
if (c == ';') { return strlen(buf); }
|
||||
}
|
||||
|
||||
return strlen(buf);
|
||||
}
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
int openPort(char *comport) // doesn't matter for using pts devices
|
||||
|
@ -87,6 +72,30 @@ int openPort(char *comport) // doesn't matter for using pts devices
|
|||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
getmyline(int fd, char *buf)
|
||||
{
|
||||
char c;
|
||||
int i = 0;
|
||||
memset(buf, 0, BUFSIZE);
|
||||
int retval;
|
||||
|
||||
while ((retval=read(fd, &c, 1)) > 0)
|
||||
{
|
||||
buf[i++] = c;
|
||||
|
||||
if (c == ';') { return strlen(buf); }
|
||||
}
|
||||
if (retval != 0)
|
||||
{
|
||||
perror("read failed:");
|
||||
close(fd);
|
||||
fd = openPort("");
|
||||
}
|
||||
|
||||
return strlen(buf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
@ -99,13 +108,19 @@ int main(int argc, char *argv[])
|
|||
|
||||
while (1)
|
||||
{
|
||||
hl_usleep(10);
|
||||
buf[0] = 0;
|
||||
|
||||
if (getmyline(fd, buf) > 0) { printf("Cmd:%s\n", buf); }
|
||||
|
||||
// else { return 0; }
|
||||
|
||||
if (strcmp(buf, "RM5;") == 0)
|
||||
if (strncmp(buf, "RM2", 3) == 0)
|
||||
{
|
||||
pbuf = "RM20020;";
|
||||
write(fd, pbuf, strlen(pbuf));
|
||||
}
|
||||
else if (strcmp(buf, "RM5;") == 0)
|
||||
{
|
||||
printf("%s\n", buf);
|
||||
hl_usleep(mysleep * 1000);
|
||||
|
|
Ładowanie…
Reference in New Issue