Fixed RF power reading and added power2mw and mw2power.

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2273 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.7
Alexandru Csete OZ9AEC 2008-01-05 16:47:35 +00:00
rodzic fb3307e466
commit bcea53c646
2 zmienionych plików z 45 dodań i 15 usunięć

Wyświetl plik

@ -11,7 +11,7 @@
* copied back and adopted for the FT-817. * copied back and adopted for the FT-817.
* *
* *
* $Id: ft817.c,v 1.15 2008-01-05 15:28:57 csete Exp $ * $Id: ft817.c,v 1.16 2008-01-05 16:47:35 csete Exp $
* *
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
@ -47,7 +47,6 @@
* - high swr flag * - high swr flag
* *
* Todo / tocheck list (oz9aec): * Todo / tocheck list (oz9aec):
* - check power meter reading, add power2mW, mW2power
* - test get_dcd; rigctl does not support it? * - test get_dcd; rigctl does not support it?
* - squelch * - squelch
* - the many "fixme" stuff around * - the many "fixme" stuff around
@ -171,7 +170,7 @@ const struct rig_caps ft817_caps = {
.mfg_name = "Yaesu", .mfg_name = "Yaesu",
.version = "0.4", .version = "0.4",
.copyright = "LGPL", .copyright = "LGPL",
.status = RIG_STATUS_STABLE, .status = RIG_STATUS_BETA,
.rig_type = RIG_TYPE_TRANSCEIVER, .rig_type = RIG_TYPE_TRANSCEIVER,
.ptt_type = RIG_PTT_RIG, .ptt_type = RIG_PTT_RIG,
.dcd_type = RIG_DCD_RIG, .dcd_type = RIG_DCD_RIG,
@ -318,8 +317,8 @@ const struct rig_caps ft817_caps = {
.get_tone_sql = NULL, .get_tone_sql = NULL,
.set_ctcss_sql = ft817_set_ctcss_sql, .set_ctcss_sql = ft817_set_ctcss_sql,
.get_ctcss_sql = NULL, .get_ctcss_sql = NULL,
.power2mW = NULL, .power2mW = ft817_power2mW,
.mW2power = NULL, .mW2power = ft817_mW2power,
.set_powerstat = ft817_set_powerstat, .set_powerstat = ft817_set_powerstat,
.get_powerstat = NULL, .get_powerstat = NULL,
.reset = NULL, .reset = NULL,
@ -350,7 +349,6 @@ const struct rig_caps ft817_caps = {
.decode_event = NULL, .decode_event = NULL,
.set_channel = NULL, .set_channel = NULL,
.get_channel = NULL, .get_channel = NULL,
/* there are some more */ /* there are some more */
}; };
@ -588,14 +586,15 @@ static int ft817_get_pometer_level(RIG *rig, value_t *val)
/* Valid only if PTT is on. /* Valid only if PTT is on.
FT-817 returns the number of bars in the lowest 4 bits FT-817 returns the number of bars in the lowest 4 bits
No documentation on how to interpret it but the max number
of bars on the display is 10 and I measure 4 watts on 20m
when I read 8 bars, but the scale is not exactly linear.
*/ */
if ((p->tx_status & 0x80) == 0) if ((p->tx_status & 0x80) == 0) {
val->f = ((p->tx_status & 0x0F) / 10.0); /* the rig has 10 bars on its display */
else val->f = (p->tx_status & 0x0F) / 10.0;
}
else {
val->f = 0.0; val->f = 0.0;
}
return RIG_OK; return RIG_OK;
} }
@ -1121,5 +1120,32 @@ int ft817_set_split_vfo (RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
} }
/* FIXME: currently ignores mode and freq */
/*
No documentation on how to interpret it but the max number
of bars on the display is 10 and I measure:
8 bars = 5W
5 bars = 2.5W
3 bars = 1W
1 bar = 0.5W
*/
int ft817_power2mW (RIG *rig, unsigned int *mwpower, float power,
freq_t freq, rmode_t mode)
{
*mwpower = (int) (power*6000);
return RIG_OK;
}
/* FIXME: currently ignores mode and freq */
int ft817_mW2power (RIG *rig, float *power, unsigned int mwpower,
freq_t freq, rmode_t mode)
{
*power = mwpower/6000.0;
return RIG_OK;
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

Wyświetl plik

@ -11,7 +11,7 @@
* copied back and adopted for the FT-817. * copied back and adopted for the FT-817.
* *
* *
* $Id: ft817.h,v 1.5 2005-09-04 10:44:23 csete Exp $ * $Id: ft817.h,v 1.6 2008-01-05 16:47:35 csete Exp $
* *
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
@ -156,6 +156,10 @@ static int ft817_get_dcd (RIG *rig, vfo_t vfo, dcd_t *dcd);
static int ft817_set_powerstat (RIG *rig, powerstat_t status); static int ft817_set_powerstat (RIG *rig, powerstat_t status);
static int ft817_vfo_op (RIG *rig, vfo_t vfo, vfo_op_t op); static int ft817_vfo_op (RIG *rig, vfo_t vfo, vfo_op_t op);
static int ft817_set_split_vfo (RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); static int ft817_set_split_vfo (RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
static int ft817_power2mW (RIG *rig, unsigned int *mwpower, float power,
freq_t freq, rmode_t mode);
static int ft817_mW2power (RIG *rig, float *power, unsigned int mwpower,
freq_t freq, rmode_t mode);
#endif /* _FT817_H */ #endif /* _FT817_H */