- fix MSB of 7S1

- fix prm80_get_channel false proto error
- fix AF/SQL level reading
- PRM8060: fix available levels, remove prm80_get_split_freq


git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2999 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.13
Stéphane Fillod, F8CFE 2010-10-27 20:31:00 +00:00
rodzic 93a62f0691
commit 27a766dcb9
3 zmienionych plików z 21 dodań i 38 usunięć

Wyświetl plik

@ -72,7 +72,7 @@
*/
static int prm80_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len)
{
int retval;
int retval, i;
struct rig_state *rs;
rs = &rig->state;
@ -83,7 +83,6 @@ static int prm80_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
if (retval != RIG_OK)
return retval;
/* no data expected, check for OK returned */
if (!data || !data_len) {
#if 0
@ -112,14 +111,19 @@ static int prm80_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
retval = 0;
if (retval < 0)
return retval;
/* Clear possible MSB, because of 7S1 */
for (i=0; i<retval; i++)
data[i] &= 0x7f;
*data_len = retval;
/* strip CR/LF from string
/* chomp CR/LF from string
*/
if (*data_len >= 2)
if (*data_len >= 2 && data[*data_len-1] == '\x0a')
*data_len -= 2;
data[*data_len] = 0;
data[*data_len] = '\0';
return RIG_OK;
}
@ -180,28 +184,6 @@ int prm80_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return RIG_OK;
}
/*
* prm80_get_split_freq
* Assumes rig!=NULL
*/
int prm80_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
{
int ret;
channel_t chan;
memset(&chan, 0, sizeof(chan));
chan.vfo = RIG_VFO_CURR;
ret = prm80_get_channel(rig, &chan);
if (ret != RIG_OK)
return ret;
*tx_freq = chan.tx_freq;
return RIG_OK;
}
/*
* prm80_set_mem
* Assumes rig!=NULL
@ -276,7 +258,7 @@ int prm80_get_channel(RIG * rig, channel_t * chan)
ret = prm80_transaction (rig, "E", 1, statebuf, &statebuf_len);
if (ret != RIG_OK)
return ret;
if (ret < 20)
if (statebuf_len < 20)
return -RIG_EPROTO;
/* Example: 1240080AFF0033F02D40 */
@ -294,12 +276,13 @@ int prm80_get_channel(RIG * rig, channel_t * chan)
chanstate & 0x04 ? RIG_RPT_SHIFT_PLUS : RIG_RPT_SHIFT_NONE;
chan->flags = chanstate & 0x08 ? RIG_CHFLAG_SKIP : 0;
chan->levels[LVL_SQL].f = ((float)(hhtoi(statebuf+6)&0x0f))/15.;
chan->levels[LVL_AF].f = ((float)(hhtoi(statebuf+8)&0x0f))/15.;
/* same as chanstate bit 1 ? */
chan->levels[LVL_SQL].f = ((float)(hhtoi(statebuf+6)>>4))/15.;
chan->levels[LVL_AF].f = ((float)(hhtoi(statebuf+8)>>4))/15.;
/* same as chanstate bit 1 */
chan->flags = hhtoi(statebuf+10) == 0 ? 0 : RIG_CHFLAG_SKIP;
chan->freq = ((hhtoi(statebuf+12)<<8) + hhtoi(statebuf+14)) * 12500;
chan->tx_freq = ((hhtoi(statebuf+16)<<8) + hhtoi(statebuf+18)) * 12500;
chan->rptr_offs = chan->tx_freq - chan->freq;
return RIG_OK;
}
@ -328,7 +311,7 @@ int prm80_set_channel(RIG * rig, const channel_t * chan)
chan->flags & RIG_CHFLAG_SKIP ? 0x08 : 0, /* TODO: tx shift */
(unsigned)(chan->levels[LVL_SQL].f*15),
(unsigned)(chan->levels[LVL_AF].f*15),
0, /* TODO: Lock */
chan->flags & RIG_CHFLAG_SKIP ? 0x01 : 0x00, /* Lock */
(unsigned)(chan->freq / 12500.),
(unsigned)(chan->tx_freq / 12500.)
);

Wyświetl plik

@ -27,8 +27,8 @@
#define PRM80_MEM_CAP { \
.freq = 1, \
.mode = 1, \
.tx_freq = 1, \
.rptr_shift = 1, \
.rptr_offs = 1, \
.flags = 1, /* lockout*/ \
.levels = RIG_LEVEL_SQL|RIG_LEVEL_AF, \
}
@ -36,7 +36,6 @@
int prm80_reset(RIG *rig, reset_t reset);
int prm80_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
int prm80_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
int prm80_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq);
int prm80_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val);
int prm80_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
int prm80_set_mem (RIG *rig, vfo_t vfo, int ch);

Wyświetl plik

@ -69,11 +69,11 @@ const struct rig_caps prm8060_caps = {
.timeout = 2000,
.retry = 3,
.has_get_func = RIG_FUNC_NONE,
.has_get_func = PRM8060_FUNC,
.has_set_func = PRM8060_FUNC,
.has_get_level = RIG_LEVEL_NONE,
.has_get_level = PRM8060_LEVEL_ALL,
.has_set_level = RIG_LEVEL_SET(PRM8060_LEVEL_ALL),
.has_get_parm = RIG_PARM_NONE,
.has_get_parm = PRM8060_PARM_ALL,
.has_set_parm = RIG_PARM_SET(PRM8060_PARM_ALL),
.vfo_ops = PRM8060_VFO_OPS,
.preamp = { RIG_DBLST_END },
@ -120,13 +120,14 @@ const struct rig_caps prm8060_caps = {
.set_freq = prm80_set_freq,
.get_freq = prm80_get_freq,
.get_split_freq = prm80_get_split_freq,
.set_channel = prm80_set_channel,
.get_channel = prm80_get_channel,
.set_mem = prm80_set_mem,
.get_mem = prm80_get_mem,
.set_level = prm80_set_level,
.get_level = prm80_get_level,
.reset = prm80_reset,
.get_info = prm80_get_info,
};