Merge pull request #1501 from GeoBaltz/fix9

Add calibration table for RFPOWER_METER_WATTS in ts890.c
pull/1506/head
Michael Black 2024-02-01 16:50:48 -06:00 zatwierdzone przez GitHub
commit 697c090935
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
2 zmienionych plików z 29 dodań i 39 usunięć

Wyświetl plik

@ -292,6 +292,7 @@ int kenwood_ts890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
case RIG_LEVEL_RFPOWER_METER_WATTS:
{
cal_table_float_t *table;
ptt_t ptt;
/* Values taken from the TS-890S In-Depth Manual (IDM), p. 8
* 0.03 - 21.5 MHz, Preamp 1
*/
@ -311,6 +312,20 @@ int kenwood_ts890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{48, 20}, {59, 40}, {70, 60}
}
};
static cal_table_t power_meter =
{
7, { { 0, 0}, { 5, 5}, { 10, 10}, {19, 25},
{ 35, 50}, { 59, 100}, { 70, 150}
}
};
/* Make sure we're asking the right question */
kenwood_get_ptt(rig, vfo, &ptt);
if ((ptt == RIG_PTT_OFF) != (level == RIG_LEVEL_STRENGTH))
{
/* We're sorry, the number you have dialed is not in service */
return -RIG_ENAVAIL;
}
/* Find out which meter type is in use */
retval = kenwood_safe_transaction(rig, "EX00011", ackbuf, sizeof(ackbuf), 11);
@ -345,7 +360,7 @@ int kenwood_ts890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
if (level == RIG_LEVEL_RFPOWER_METER_WATTS)
{
val->f = round(val->i / 70.0 * 150);
val->f = rig_raw2val(val->i, &power_meter);
}
else
{

Wyświetl plik

@ -1,5 +1,5 @@
// can run this using rigctl/rigctld and socat pty devices
// gcc -o simyaesu simyaesu.c
// gcc -o simts890 -l hamlib simts890.c
#define _XOPEN_SOURCE 700
// since we are POSIX here we need this
#if 0
@ -149,24 +149,24 @@ int main(int argc, char *argv[])
write(fd, ifbuf, strlen(ifbuf));
continue;
}
else if (strcmp(buf, "NB;") == 0)
else if (strcmp(buf, "NB1;") == 0)
{
hl_usleep(mysleep * 1000);
pbuf = "NB0;";
pbuf = "NB10;";
write(fd, pbuf, strlen(pbuf));
continue;
}
else if (strcmp(buf, "RA;") == 0)
{
hl_usleep(mysleep * 1000);
pbuf = "RA01;";
pbuf = "RA1;"; /* -6dB */
write(fd, pbuf, strlen(pbuf));
continue;
}
else if (strcmp(buf, "RG;") == 0)
{
hl_usleep(mysleep * 1000);
pbuf = "RG055;";
pbuf = "RG255;";
write(fd, pbuf, strlen(pbuf));
continue;
}
@ -187,7 +187,7 @@ int main(int argc, char *argv[])
else if (strcmp(buf, "FV;") == 0)
{
hl_usleep(mysleep * 1000);
pbuf = "FV1.2;";
pbuf = "FV1.04;";
write(fd, pbuf, strlen(pbuf));
continue;
}
@ -216,14 +216,12 @@ int main(int argc, char *argv[])
printf("%s\n", buf);
continue;
}
else if (strcmp(buf, "FW;") == 0)
else if (strcmp(buf, "FW1;") == 0)
{
//usleep(mysleep * 1000);
pbuf = "FW240";
pbuf = "FW10;";
write(fd, pbuf, strlen(pbuf));
hl_usleep(20 * 1000);
pbuf = "0;";
write(fd, pbuf, strlen(pbuf));
continue;
}
else if (strncmp(buf, "FW", 2) == 0)
@ -252,30 +250,12 @@ int main(int argc, char *argv[])
}
#endif
else if (strcmp(buf, "VS;") == 0)
{
printf("%s\n", buf);
hl_usleep(mysleep * 1000);
pbuf = "VS0;";
write(fd, pbuf, strlen(pbuf));
continue;
}
else if (strcmp(buf, "EX00011;") == 0)
{
pbuf = "EX00011 001;";
write(fd, pbuf, strlen(pbuf));
continue;
}
else if (strcmp(buf, "EX032;") == 0)
{
static int ant = 0;
ant = (ant + 1) % 3;
printf("%s\n", buf);
hl_usleep(mysleep * 1000);
SNPRINTF(buf, sizeof(buf), "EX032%1d;", ant);
write(fd, buf, strlen(buf));
continue;
}
else if (strncmp(buf, "EX", 2) == 0)
{
continue;
@ -315,11 +295,6 @@ int main(int argc, char *argv[])
write(fd, buf, strlen(buf));
continue;
}
else if (strncmp(buf, "SA;", 3) == 0)
{
SNPRINTF(buf, sizeof(buf), "SA0;");
write(fd, buf, strlen(buf));
}
else if (buf[3] == ';' && strncmp(buf, "SF", 2) == 0)
{
SNPRINTF(buf, sizeof(buf), "SF%c%011.0f%c;", buf[2],
@ -413,13 +388,13 @@ int main(int argc, char *argv[])
switch (buf[2])
{
case ';': ptt = 1;
case '0': ptt_mic = 1;
case ';':
case '0': ptt = ptt_mic = 1;
break;
case '1': ptt_data = 1;
break;
case '2': ptt_tune = 1;
break;
}
continue;