mirror of
https://github.com/Hamlib/Hamlib
synced 2026-08-13 17:32:05 -04:00
Clean up IC-7000, IC-7100, and IC-9100
Replace clock routines in ic7100.c
This commit is contained in:
parent
688762df27
commit
48dc2d2bc8
3 changed files with 13 additions and 119 deletions
|
|
@ -134,7 +134,7 @@
|
|||
.levels = RIG_LEVEL_SET(IC7000_LEVELS), \
|
||||
}
|
||||
|
||||
struct cmdparams ic7000_extcmds[] =
|
||||
static struct cmdparams ic7000_extcmds[] =
|
||||
{
|
||||
{ {.s = RIG_LEVEL_VOXDELAY}, CMD_PARAM_TYPE_LEVEL, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x17}, CMD_DAT_INT, 1 },
|
||||
{ {.s = RIG_PARM_TIME}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x41}, CMD_DAT_TIM, 2 },
|
||||
|
|
|
|||
|
|
@ -102,12 +102,13 @@
|
|||
// BANDSELECT disabled unti we figure out Icom's ability
|
||||
#define IC7100_PARM_ALL (RIG_PARM_ANN|RIG_PARM_BACKLIGHT|RIG_PARM_KEYLIGHT|RIG_PARM_BEEP|RIG_PARM_TIME)
|
||||
|
||||
static
|
||||
int ic7100_tokens[] = { TOK_DSTAR_CODE, TOK_DSTAR_DSQL, TOK_DSTAR_CALL_SIGN, TOK_DSTAR_MESSAGE,
|
||||
TOK_DSTAR_STATUS, TOK_DSTAR_MY_CS, TOK_DSTAR_TX_CS, TOK_DSTAR_TX_MESS,
|
||||
TOK_BACKEND_NONE
|
||||
};
|
||||
|
||||
struct cmdparams ic7100_extcmds[] =
|
||||
static struct cmdparams ic7100_extcmds[] =
|
||||
{
|
||||
{ {.s = RIG_PARM_BEEP}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x00, 0x03}, CMD_DAT_BOL, 1 },
|
||||
{ {.s = RIG_PARM_BACKLIGHT}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x04}, CMD_DAT_LVL, 2 },
|
||||
|
|
@ -117,8 +118,12 @@ struct cmdparams ic7100_extcmds[] =
|
|||
{ {.s = RIG_PARM_NONE} }
|
||||
};
|
||||
|
||||
static const struct icom_clock_cmds ic7100_clock_cmds = {
|
||||
.date_cmds = {0x01, 0x20}, .time_cmds = {0x01, 0x21}, .offset_cmds = {0x01, 0x23}
|
||||
};
|
||||
|
||||
// IC-7100 S-meter calibration data based on manual
|
||||
#define IC7100_STR_CAL { 14, \
|
||||
#define IC7100_STR_CAL { 3, \
|
||||
{ \
|
||||
{ 0, -54 }, \
|
||||
{ 120, 0 }, \
|
||||
|
|
@ -207,121 +212,10 @@ static const struct icom_priv_caps ic7100_priv_caps =
|
|||
.x1cx03_possibly = 1,
|
||||
.x1ax03_supported = 1,
|
||||
.mode_with_filter = 1,
|
||||
.data_mode_supported = 1
|
||||
.data_mode_supported = 1,
|
||||
.clock_cmds = &ic7100_clock_cmds
|
||||
};
|
||||
|
||||
// if hour < 0 then only date will be set
|
||||
static int ic7100_set_clock(RIG *rig, int year, int month, int day, int hour, int min,
|
||||
int sec, double msec, int utc_offset)
|
||||
{
|
||||
int cmd = 0x1a;
|
||||
int subcmd = 0x05;
|
||||
int retval = RIG_OK;
|
||||
unsigned char prmbuf[MAXFRAMELEN];
|
||||
|
||||
if (year >= 0)
|
||||
{
|
||||
prmbuf[0] = 0x01;
|
||||
prmbuf[1] = 0x20;
|
||||
to_bcd(&prmbuf[2], year / 100, 2);
|
||||
to_bcd(&prmbuf[3], year % 100, 2);
|
||||
to_bcd(&prmbuf[4], month, 2);
|
||||
to_bcd(&prmbuf[5], day, 2);
|
||||
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 6, NULL, NULL);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
|
||||
}
|
||||
}
|
||||
|
||||
if (hour >= 0)
|
||||
{
|
||||
prmbuf[0] = 0x01;
|
||||
prmbuf[1] = 0x21;
|
||||
to_bcd(&prmbuf[2], hour, 2);
|
||||
to_bcd(&prmbuf[3], min, 2);
|
||||
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 4, NULL, NULL);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
|
||||
}
|
||||
|
||||
prmbuf[0] = 0x01;
|
||||
prmbuf[1] = 0x23;
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: utc_offset=%d\n", __func__, utc_offset);
|
||||
to_bcd(&prmbuf[2], abs(utc_offset) / 100, 2);
|
||||
to_bcd(&prmbuf[3], abs(utc_offset) % 100, 2);
|
||||
to_bcd(&prmbuf[4], utc_offset >= 0 ? 0 : 1, 2);
|
||||
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 5, NULL, NULL);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s(%d): %s\b", __func__, __LINE__, rigerror(retval));
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int ic7100_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
|
||||
int *min, int *sec, double *msec, int *utc_offset)
|
||||
{
|
||||
int cmd = 0x1a;
|
||||
int subcmd = 0x05;
|
||||
int retval = RIG_OK;
|
||||
int resplen;
|
||||
unsigned char prmbuf[MAXFRAMELEN];
|
||||
unsigned char respbuf[MAXFRAMELEN];
|
||||
|
||||
prmbuf[0] = 0x01;
|
||||
prmbuf[1] = 0x20;
|
||||
resplen = sizeof(respbuf);
|
||||
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
|
||||
*year = from_bcd(&respbuf[4], 2) * 100 + from_bcd(&respbuf[5], 2);
|
||||
*month = from_bcd(&respbuf[6], 2);
|
||||
*day = from_bcd(&respbuf[7], 2);
|
||||
|
||||
if (hour != NULL)
|
||||
{
|
||||
prmbuf[0] = 0x01;
|
||||
prmbuf[1] = 0x21;
|
||||
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
*hour = from_bcd(&respbuf[4], 2);
|
||||
*min = from_bcd(&respbuf[5], 2);
|
||||
*sec = 0;
|
||||
*msec = 0;
|
||||
|
||||
prmbuf[0] = 0x01;
|
||||
prmbuf[1] = 0x23;
|
||||
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
*utc_offset = from_bcd(&respbuf[4], 2) * 100;
|
||||
*utc_offset += from_bcd(&respbuf[5], 2);
|
||||
|
||||
if (respbuf[6] != 0x00) { *utc_offset *= -1; }
|
||||
|
||||
//rig_debug(RIG_DEBUG_VERBOSE,
|
||||
// "%s: %02d-%02d-%02dT%02d:%02d:%06.3lf%s%04d\n'",
|
||||
// __func__, *year, *month, *day, *hour, *min, *sec + *msec / 1000,
|
||||
// *utc_offset >= 0 ? "+" : "-", (unsigned)abs(*utc_offset));
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
struct rig_caps ic7100_caps =
|
||||
{
|
||||
RIG_MODEL(RIG_MODEL_IC7100),
|
||||
|
|
@ -542,7 +436,7 @@ struct rig_caps ic7100_caps =
|
|||
.send_morse = icom_send_morse,
|
||||
.stop_morse = icom_stop_morse,
|
||||
.wait_morse = rig_wait_morse,
|
||||
.set_clock = ic7100_set_clock,
|
||||
.get_clock = ic7100_get_clock,
|
||||
.set_clock = icom_set_clock,
|
||||
.get_clock = icom_get_clock,
|
||||
.hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS
|
||||
};
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@
|
|||
|
||||
#define IC9100_HF_ANTS (RIG_ANT_1|RIG_ANT_2)
|
||||
|
||||
struct cmdparams ic9100_extcmds[] =
|
||||
static struct cmdparams ic9100_extcmds[] =
|
||||
{
|
||||
{ {.s = RIG_LEVEL_VOXDELAY}, CMD_PARAM_TYPE_LEVEL, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x27}, CMD_DAT_INT, 1 },
|
||||
{ {.s = RIG_PARM_KEYERTYPE}, CMD_PARAM_TYPE_PARM, C_CTL_MEM, S_MEM_PARM, SC_MOD_RW, 2, {0x01, 0x02}, CMD_DAT_INT, 1 },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue