Play catch-up with recent code.

This commit is contained in:
George Baltz N3GB 2024-07-02 13:17:26 -04:00
parent 02102f60e4
commit 37321a1df8
6 changed files with 27 additions and 25 deletions

View File

@ -28,31 +28,32 @@ int commradio_transaction(RIG *rig, const unsigned char *cmd, int cmd_len,
{
int ret = -RIG_EINTERNAL;
struct rig_state *rs;
hamlib_port_t *rp = RIGPORT(rig);
ENTERFUNC;
rs = &rig->state;
rs = STATE(rig);
rs->transaction_active = 1;
/*
* Flush is needed until async mode is done. The CTX-10 sends frames every
* time the VFO changes.
*/
rig_flush(&rs->rigport);
rig_flush(rp);
int frame_len;
unsigned char frame[3+2*(cmd_len+2)];
size_t rx_len = CR_FRAMELENGTH;
unsigned char rx[rx_len];
frame_len = frame_message(frame, cmd, cmd_len);
ret = write_block(&rs->rigport, frame, frame_len);
ret = write_block(rp, frame, frame_len);
if (ret < RIG_OK)
{
goto transaction_quit;
}
const char stopset[] = { CR_EOF };
ret = read_string(&rs->rigport, rx, rx_len-1, stopset, 1, 0, 1);
ret = read_string(rp, rx, rx_len-1, stopset, 1, 0, 1);
if (ret < RIG_OK)
{
goto transaction_quit;

View File

@ -353,7 +353,7 @@ static int pstrotator_rot_close(ROT *rot)
priv = (struct pstrotator_rot_priv_data *)ROTSTATE(rot)->priv;
pstrotator_handler_priv_data *pstrotator_handler_priv;
pstrotator_handler_priv = (pstrotator_handler_priv_data *)
rot->state.pstrotator_handler_priv_data;
ROTSTATE(rot)->pstrotator_handler_priv_data;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);

View File

@ -793,7 +793,7 @@ int tt565_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
char ttmode, ttreceiver;
int retry;
int timeout;
int widthOld = rig->state.cache.widthMainA;
int widthOld = CACHE(rig)->widthMainA;
struct rig_state *rs = STATE(rig);
ttreceiver = which_receiver(rig, vfo);

View File

@ -403,8 +403,8 @@ static int pmr171_init(RIG *rig)
return -RIG_ENOMEM;
}
rig->state.cache.freqMainA = 14999000;
rig->state.cache.freqMainB = 14999000;
CACHE(rig)->freqMainA = 14999000;
CACHE(rig)->freqMainB = 14999000;
return RIG_OK;
}
@ -475,7 +475,7 @@ static int pmr171_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
// probably already read VFO_A so just return cache for VFO_B for now
if (vfo == RIG_VFO_B)
{
*freq = rig->state.cache.freqMainB;
*freq = cachep->freqMainB;
return RIG_OK;
}
@ -484,16 +484,16 @@ static int pmr171_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
read_block(rp, &reply[5], reply[4]);
vfoa = from_bcd_be(&reply[9], 8);
vfob = from_bcd_be(&reply[13], 8);
rig->state.cache.freqMainA = vfoa;
rig->state.cache.freqMainB = vfob;
cachep->freqMainA = vfoa;
cachep->freqMainB = vfob;
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfoa=%.0f, vfob=%.0f\n", __func__, vfoa,
vfob);
// Now grab the ptt status
rig->state.cache.ptt = reply[6] == 1;
cachep->ptt = reply[6] == 1;
// And the mode
rig->state.cache.modeMainA = pmr171_modes[reply[7]];
rig->state.cache.modeMainB = pmr171_modes[reply[8]];
cachep->modeMainA = pmr171_modes[reply[7]];
cachep->modeMainB = pmr171_modes[reply[8]];
if (vfo == RIG_VFO_B) { *freq = cachep->freqMainA; }
else { *freq = cachep->freqMainB; }
@ -514,7 +514,7 @@ static int pmr171_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
static int pmr171_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
{
*split = rig->state.cache.split;
*split = CACHE(rig)->split;
if (*split) *tx_vfo=RIG_VFO_B;
else *tx_vfo = RIG_VFO_A;
return RIG_OK;
@ -524,7 +524,7 @@ static int pmr171_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
{
//struct pmr171_priv_data *p = (struct pmr171_priv_data *) STATE(rig)->priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__);
*ptt = rig->state.cache.ptt;
*ptt = CACHE(rig)->ptt;
return RIG_OK;
}
@ -795,13 +795,13 @@ static int pmr171_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
/* fill in the frequency */
if (vfo == RIG_VFO_B)
{
to_bcd_be(&cmd[6], rig->state.cache.freqMainA, 8);
to_bcd_be(&cmd[6], CACHE(rig)->freqMainA, 8);
to_bcd_be(&cmd[10], freq, 8);
}
else
{
to_bcd_be(&cmd[6], freq, 8);
to_bcd_be(&cmd[10], rig->state.cache.freqMainB, 8);
to_bcd_be(&cmd[10], CACHE(rig)->freqMainB, 8);
}
unsigned int crc = CRC16Check(&cmd[4], 12);
@ -828,13 +828,13 @@ static int pmr171_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
if (vfo == RIG_VFO_B)
{
cmd[6] = rig->state.cache.modeMainA;
cmd[6] = CACHE(rig)->modeMainA;
cmd[7] = i;
}
else
{
cmd[6] = i;
cmd[7] = rig->state.cache.modeMainB;
cmd[7] = CACHE(rig)->modeMainB;
}
crc = CRC16Check(&cmd[4], 4);

View File

@ -266,8 +266,8 @@ static int frontend_set_conf(RIG *rig, hamlib_token_t token, const char *val)
rig_debug(RIG_DEBUG_WARN, "%s: overriding port and changing to 4992\n", __func__);
}
sprintf(rs->rigport_deprecated.pathname, "%s:%s", val2, "4992");
strcpy(rs->rigport.pathname,rs->rigport_deprecated.pathname);
rig_debug(RIG_DEBUG_WARN, "%s: pathname=%s\n", __func__, rs->rigport.pathname);
strcpy(rp->pathname, rs->rigport_deprecated.pathname);
rig_debug(RIG_DEBUG_WARN, "%s: pathname=%s\n", __func__, rp->pathname);
free(val2);
}
else

View File

@ -489,6 +489,7 @@ int clear_chans(RIG *rig, const char *infilename)
{
int i, j, ret;
channel_t chan;
struct rig_state *rs = STATE(rig);
memset(&chan, 0, sizeof(chan));
chan.freq = RIG_FREQ_NONE;
@ -497,10 +498,10 @@ int clear_chans(RIG *rig, const char *infilename)
chan.tx_mode = RIG_MODE_NONE;
chan.vfo = RIG_VFO_MEM;
for (i = 0; rig->state.chan_list[i].type; i++)
for (i = 0; rs->chan_list[i].type; i++)
{
for (j = rig->state.chan_list[i].startc;
j <= rig->state.chan_list[i].endc; j++)
for (j = rs->chan_list[i].startc;
j <= rs->chan_list[i].endc; j++)
{
chan.channel_num = j;