[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. 263f1cde72081e4e6bdf1
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Michael B. <mdb...@us...> - 2020-12-17 21:07:31
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Hamlib -- Ham radio control libraries". The branch, master has been updated via 263f1cde72081e4e6bdf1c02eca5253a9445fe99 (commit) via 8ed0dcdbb78e118ef6be94836749d8ac0da81835 (commit) via 31b42de067ecee1a084aad36d28dd2739b347f7f (commit) via c11e592a7a747f93046c760ea988694f73011167 (commit) via 6f4c2de0b63f267c32497d86103a7629c55bfb30 (commit) via 603f39097db1f476d31f0f6962f6c0845a3c9611 (commit) via 2a0deb34158bea57cab351819adeea2a8fc02a1e (commit) from 21e691153854c7029b4d0c152f964c7dd7acba3d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 263f1cde72081e4e6bdf1c02eca5253a9445fe99 Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Dec 17 15:07:04 2020 -0600 astyle files diff --git a/rigs/dummy/flrig.c b/rigs/dummy/flrig.c index a34da5ad..3b38a0b2 100644 --- a/rigs/dummy/flrig.c +++ b/rigs/dummy/flrig.c @@ -1963,7 +1963,7 @@ static int flrig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) rig_debug(RIG_DEBUG_TRACE, "%s: val.i='%s'(%d)\n", __func__, value, val->i); case RIG_LEVEL_RFPOWER_METER: - val->f = atof(value)/100.0; + val->f = atof(value) / 100.0; rig_debug(RIG_DEBUG_TRACE, "%s: val.f='%s'(%g)\n", __func__, value, val->f); break; diff --git a/rigs/dummy/rot_dummy.c b/rigs/dummy/rot_dummy.c index d5b8b994..974f9caf 100644 --- a/rigs/dummy/rot_dummy.c +++ b/rigs/dummy/rot_dummy.c @@ -165,7 +165,7 @@ static int dummy_rot_init(ROT *rot) static int dummy_rot_cleanup(ROT *rot) { struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) - rot->state.priv; + rot->state.priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -261,7 +261,7 @@ static int dummy_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) static void dummy_rot_simulate_rotation(ROT *rot) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) rot->state.priv; struct timeval tv; unsigned elapsed; /* ms */ @@ -280,7 +280,8 @@ static void dummy_rot_simulate_rotation(ROT *rot) { /* target reached */ priv->az = priv->target_az; - priv->status &= ~(ROT_STATUS_MOVING_AZ | ROT_STATUS_MOVING_LEFT | ROT_STATUS_MOVING_RIGHT); + priv->status &= ~(ROT_STATUS_MOVING_AZ | ROT_STATUS_MOVING_LEFT | + ROT_STATUS_MOVING_RIGHT); } else { @@ -300,7 +301,8 @@ static void dummy_rot_simulate_rotation(ROT *rot) { /* target reached */ priv->el = priv->target_el; - priv->status &= ~(ROT_STATUS_MOVING_EL | ROT_STATUS_MOVING_UP | ROT_STATUS_MOVING_DOWN); + priv->status &= ~(ROT_STATUS_MOVING_EL | ROT_STATUS_MOVING_UP | + ROT_STATUS_MOVING_DOWN); } else { @@ -316,9 +318,12 @@ static void dummy_rot_simulate_rotation(ROT *rot) } } - if (priv->status & (ROT_STATUS_MOVING_AZ | ROT_STATUS_MOVING_EL)) { + if (priv->status & (ROT_STATUS_MOVING_AZ | ROT_STATUS_MOVING_EL)) + { priv->status |= ROT_STATUS_MOVING; - } else { + } + else + { priv->status &= ~(ROT_STATUS_MOVING); } @@ -427,7 +432,8 @@ static const char *dummy_rot_get_info(ROT *rot) static int dummy_set_func(ROT *rot, setting_t func, int status) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s %d\n", __func__, rot_strfunc(func), status); @@ -447,7 +453,8 @@ static int dummy_set_func(ROT *rot, setting_t func, int status) static int dummy_get_func(ROT *rot, setting_t func, int *status) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; *status = (priv->funcs & func) ? 1 : 0; @@ -460,7 +467,8 @@ static int dummy_get_func(ROT *rot, setting_t func, int *status) static int dummy_set_level(ROT *rot, setting_t level, value_t val) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; int idx; char lstr[32]; @@ -491,7 +499,8 @@ static int dummy_set_level(ROT *rot, setting_t level, value_t val) static int dummy_get_level(ROT *rot, setting_t level, value_t *val) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; int idx; idx = rig_setting2idx(level); @@ -511,7 +520,8 @@ static int dummy_get_level(ROT *rot, setting_t level, value_t *val) static int dummy_set_ext_level(ROT *rot, token_t token, value_t val) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; char lstr[64]; const struct confparams *cfp; struct ext_list *elp; @@ -579,7 +589,8 @@ static int dummy_set_ext_level(ROT *rot, token_t token, value_t val) static int dummy_get_ext_level(ROT *rot, token_t token, value_t *val) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; const struct confparams *cfp; struct ext_list *elp; @@ -621,7 +632,8 @@ static int dummy_get_ext_level(ROT *rot, token_t token, value_t *val) static int dummy_set_ext_func(ROT *rot, token_t token, int status) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; const struct confparams *cfp; struct ext_list *elp; @@ -672,7 +684,8 @@ static int dummy_set_ext_func(ROT *rot, token_t token, int status) static int dummy_get_ext_func(ROT *rot, token_t token, int *status) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; const struct confparams *cfp; struct ext_list *elp; @@ -711,7 +724,8 @@ static int dummy_get_ext_func(ROT *rot, token_t token, int *status) static int dummy_set_parm(ROT *rot, setting_t parm, value_t val) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; int idx; char pstr[32]; @@ -742,7 +756,8 @@ static int dummy_set_parm(ROT *rot, setting_t parm, value_t val) static int dummy_get_parm(ROT *rot, setting_t parm, value_t *val) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; int idx; idx = rig_setting2idx(parm); @@ -762,7 +777,8 @@ static int dummy_get_parm(ROT *rot, setting_t parm, value_t *val) static int dummy_set_ext_parm(ROT *rot, token_t token, value_t val) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; char lstr[64]; const struct confparams *cfp; struct ext_list *epp; @@ -827,7 +843,8 @@ static int dummy_set_ext_parm(ROT *rot, token_t token, value_t val) static int dummy_get_ext_parm(ROT *rot, token_t token, value_t *val) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; const struct confparams *cfp; struct ext_list *epp; @@ -866,7 +883,8 @@ static int dummy_get_ext_parm(ROT *rot, token_t token, value_t *val) static int dummy_rot_get_status(ROT *rot, rot_status_t *status) { - struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; + struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *) + rot->state.priv; dummy_rot_simulate_rotation(rot); diff --git a/rigs/icom/frame.c b/rigs/icom/frame.c index e52950ad..fbff3dda 100644 --- a/rigs/icom/frame.c +++ b/rigs/icom/frame.c @@ -490,6 +490,7 @@ int rig2icom_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width, icmode_ext = PD_WIDE_3; /* default to Wide */ } } + *pd = icmode_ext; } else diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 738738df..c83d5a7f 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -1604,7 +1604,8 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode, break; } - rig_debug(RIG_DEBUG_VERBOSE, "%s mode=%d, width=%d\n", __func__, (int)icom_mode, (int)width); + rig_debug(RIG_DEBUG_VERBOSE, "%s mode=%d, width=%d\n", __func__, (int)icom_mode, + (int)width); retval = icom_set_mode(rig, vfo, icom_mode, width); if (RIG_OK == retval) @@ -1627,6 +1628,7 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode, datamode[0] = 0x00; break; } + if (width != RIG_PASSBAND_NOCHANGE) { if (filter_byte) // then we need the width byte too @@ -1704,7 +1706,8 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { err = rig2icom_mode(rig, vfo, mode, width, &icmode, &icmode_ext); } - if (width == RIG_PASSBAND_NOCHANGE) icmode_ext = priv_data->filter; + + if (width == RIG_PASSBAND_NOCHANGE) { icmode_ext = priv_data->filter; } if (err < 0) { @@ -1712,7 +1715,9 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) return err; } - rig_debug(RIG_DEBUG_VERBOSE, "%s: icmode=%d, icmode_ext=%d\n", __func__, icmode, icmode_ext); + rig_debug(RIG_DEBUG_VERBOSE, "%s: icmode=%d, icmode_ext=%d\n", __func__, icmode, + icmode_ext); + /* IC-731, IC-735, IC-7000 don't support passband data */ /* IC-726 & IC-475A/E also limited support - only on CW */ /* TODO: G4WJS CW wide/narrow are possible with above two radios */ @@ -1724,7 +1729,8 @@ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) icmode_ext = -1; } - rig_debug(RIG_DEBUG_VERBOSE, "%s: #2 icmode=%d, icmode_ext=%d\n", __func__, icmode, icmode_ext); + rig_debug(RIG_DEBUG_VERBOSE, "%s: #2 icmode=%d, icmode_ext=%d\n", __func__, + icmode, icmode_ext); retval = icom_transaction(rig, C_SET_MODE, icmode, (unsigned char *) &icmode_ext, (icmode_ext == -1 ? 0 : 1), ackbuf, &ack_len); @@ -1775,6 +1781,7 @@ int icom_get_mode_with_data(RIG *rig, vfo_t vfo, rmode_t *mode, retval = icom_get_mode(rig, vfo, mode, width); rig_debug(RIG_DEBUG_VERBOSE, "%s mode=%d\n", __func__, (int)*mode); + if (retval != RIG_OK) { return retval; @@ -1820,7 +1827,9 @@ int icom_get_mode_with_data(RIG *rig, vfo_t vfo, rmode_t *mode, return -RIG_ERJCTED; } - rig_debug(RIG_DEBUG_VERBOSE, "%s databuf[2]=%d, mode=%d\n", __func__, (int)databuf[2], (int)*mode); + rig_debug(RIG_DEBUG_VERBOSE, "%s databuf[2]=%d, mode=%d\n", __func__, + (int)databuf[2], (int)*mode); + if (databuf[2]) /* 0x01/0x02/0x03 -> data mode, 0x00 -> not data mode */ { switch (*mode) @@ -3084,16 +3093,17 @@ int icom_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) break; case RIG_LEVEL_RFPOWER_METER_WATTS: + // eventually we should change all the Icom tables to watts if (rig->caps->rfpower_meter_cal.size == 0) { val->f = - rig_raw2val_float(icom_val, &icom_default_rfpower_meter_cal)*100; + rig_raw2val_float(icom_val, &icom_default_rfpower_meter_cal) * 100; } else { val->f = - rig_raw2val_float(icom_val, &rig->caps->rfpower_meter_cal)*100; + rig_raw2val_float(icom_val, &rig->caps->rfpower_meter_cal) * 100; } break; diff --git a/rigs/kenwood/flex6xxx.c b/rigs/kenwood/flex6xxx.c index 1da17bad..492d5205 100644 --- a/rigs/kenwood/flex6xxx.c +++ b/rigs/kenwood/flex6xxx.c @@ -774,10 +774,13 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) case RIG_LEVEL_RFPOWER_METER: case RIG_LEVEL_RFPOWER_METER_WATTS: flex6k_get_ptt(rig, vfo, &ptt); - if (!ptt) { + + if (!ptt) + { val->f = 0; return RIG_OK; } + cmd = "ZZRM5"; len = 5; ans = 3; @@ -844,6 +847,7 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) case RIG_LEVEL_RFPOWER_METER: case RIG_LEVEL_RFPOWER_METER_WATTS: n = sscanf(lvlbuf, "ZZRM%f", &val->f); + if (n != 1) { rig_debug(RIG_DEBUG_ERR, "%s: Error parsing value from lvlbuf='%s'\n", @@ -851,10 +855,12 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) val->f = 0; return -RIG_EPROTO; } + if (level != RIG_LEVEL_RFPOWER_METER_WATTS) { val->f /= 100; } + break; case RIG_LEVEL_RF: diff --git a/rigs/kenwood/k3.c b/rigs/kenwood/k3.c index e371c1a8..abe1f491 100644 --- a/rigs/kenwood/k3.c +++ b/rigs/kenwood/k3.c @@ -1864,10 +1864,12 @@ int k3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) } val->f = pwr; + if (level == RIG_LEVEL_RFPOWER_METER_WATTS) { val->f *= 100; } + break; } diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 685aeb3b..c366f3b1 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -2398,8 +2398,11 @@ int kenwood_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) // https://github.com/Hamlib/Hamlib/issues/465 kenwood_val = val.f * power_max; - if (kenwood_val < power_min) kenwood_val = power_min; - if (kenwood_val > power_max) kenwood_val = power_max; + + if (kenwood_val < power_min) { kenwood_val = power_min; } + + if (kenwood_val > power_max) { kenwood_val = power_max; } + snprintf(levelbuf, sizeof(levelbuf), "PC%03d", kenwood_val); break; } @@ -3888,8 +3891,8 @@ int kenwood_set_powerstat(RIG *rig, powerstat_t status) sleep(1); retval = rig_get_freq(rig, RIG_VFO_A, &freq); - if (retval == RIG_OK) - { + if (retval == RIG_OK) + { rig->state.rigport.retry = retry_save; return retval; } diff --git a/rigs/yaesu/ft2000.c b/rigs/yaesu/ft2000.c index 03888f71..aeaa6af1 100644 --- a/rigs/yaesu/ft2000.c +++ b/rigs/yaesu/ft2000.c @@ -185,12 +185,12 @@ const struct rig_caps ft2000_caps = /* mode/filter list, .remember = order matters! */ .filters = { - {RIG_MODE_CW|RIG_MODE_CWR, Hz(500)}, /* Normal CW, RTTY, PKT/USER */ - {RIG_MODE_CW|RIG_MODE_CWR, Hz(200)}, /* Narrow CW, RTTY, PKT/USER */ - {RIG_MODE_CW|RIG_MODE_CWR, Hz(2400)}, /* Wide CW, RTTY, PKT/USER */ - {RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(500)}, /* Normal RTTY */ - {RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(300)}, /* Narrow RTTY */ - {RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(2400)}, /* Wide RTTY */ + {RIG_MODE_CW | RIG_MODE_CWR, Hz(500)}, /* Normal CW, RTTY, PKT/USER */ + {RIG_MODE_CW | RIG_MODE_CWR, Hz(200)}, /* Narrow CW, RTTY, PKT/USER */ + {RIG_MODE_CW | RIG_MODE_CWR, Hz(2400)}, /* Wide CW, RTTY, PKT/USER */ + {RIG_MODE_RTTY | RIG_MODE_RTTYR, Hz(500)}, /* Normal RTTY */ + {RIG_MODE_RTTY | RIG_MODE_RTTYR, Hz(300)}, /* Narrow RTTY */ + {RIG_MODE_RTTY | RIG_MODE_RTTYR, Hz(2400)}, /* Wide RTTY */ {RIG_MODE_SSB, Hz(2400)}, /* Normal SSB */ {RIG_MODE_SSB, Hz(1800)}, /* Narrow SSB */ {RIG_MODE_SSB, Hz(3000)}, /* Wide SSB */ diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 1943adde..c2515a76 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -534,11 +534,14 @@ int newcat_open(RIG *rig) (void)newcat_get_rigid(rig); if (priv->rig_id == NC_RIGID_FT2000) - { // then we need to readjust rfpowermeter cal table in half + { + // then we need to readjust rfpowermeter cal table in half int i; - for(i=0;i<rig->caps->rfpower_meter_cal.size; ++i) - { // we may need a table for the FT2000 instead of this - rig->caps->rfpower_meter_cal.table[i].raw/=2; + + for (i = 0; i < rig->caps->rfpower_meter_cal.size; ++i) + { + // we may need a table for the FT2000 instead of this + rig->caps->rfpower_meter_cal.table[i].raw /= 2; } } @@ -2884,7 +2887,7 @@ int newcat_set_powerstat(RIG *rig, powerstat_t status) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "PS%c%c", ps, cat_term); retval = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); - + retry_save = rig->state.rigport.retry; rig->state.rigport.retry = 0; @@ -2896,10 +2899,11 @@ int newcat_set_powerstat(RIG *rig, powerstat_t status) hl_usleep(1000000); retval = rig_get_freq(rig, RIG_VFO_A, &freq); - if (retval == RIG_OK) { + if (retval == RIG_OK) + { rig->state.rigport.retry = retry_save; - return retval; - } + return retval; + } rig_debug(RIG_DEBUG_TRACE, "%s: Wait #%d for power up\n", __func__, i + 1); } @@ -4182,6 +4186,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM5%c", cat_term); } + break; case RIG_LEVEL_COMP_METER: @@ -4383,26 +4388,36 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) case RIG_LEVEL_RFPOWER_METER: case RIG_LEVEL_RFPOWER_METER_WATTS: rig_debug(RIG_DEBUG_VERBOSE, "%s: RFPOWER_METER retlvl=%s\n", __func__, retlvl); + if (retlvl_len > 3) { // Some rigs like FTDX101 have 6-byte return so we just truncate - rig_debug(RIG_DEBUG_VERBOSE, "%s: retlvl of %s getting truncated\n", __func__, retlvl); + rig_debug(RIG_DEBUG_VERBOSE, "%s: retlvl of %s getting truncated\n", __func__, + retlvl); retlvl[3] = 0; rig_debug(RIG_DEBUG_VERBOSE, "%s: retlvl truncated to %s\n", __func__, retlvl); } if (rig->caps->rfpower_meter_cal.size == 0) { - val->f = rig_raw2val_float(atoi(retlvl), &yaesu_default_rfpower_meter_cal)/(level == RIG_LEVEL_RFPOWER_METER_WATTS?1.0:100.0); + val->f = rig_raw2val_float(atoi(retlvl), + &yaesu_default_rfpower_meter_cal) / (level == RIG_LEVEL_RFPOWER_METER_WATTS ? + 1.0 : 100.0); } else { - val->f = rig_raw2val_float(atoi(retlvl), &rig->caps->rfpower_meter_cal)/(level == RIG_LEVEL_RFPOWER_METER_WATTS?1.0:100.0); + val->f = rig_raw2val_float(atoi(retlvl), + &rig->caps->rfpower_meter_cal) / (level == RIG_LEVEL_RFPOWER_METER_WATTS ? 1.0 : + 100.0); } - rig_debug(RIG_DEBUG_VERBOSE, "%s: RFPOWER_METER=%s, converted to %f\n", __func__, retlvl, val->f); - if (level == RIG_LEVEL_RFPOWER_METER && val->f > 1.0) + + rig_debug(RIG_DEBUG_VERBOSE, "%s: RFPOWER_METER=%s, converted to %f\n", + __func__, retlvl, val->f); + + if (level == RIG_LEVEL_RFPOWER_METER && val->f > 1.0) { - rig_debug(RIG_DEBUG_VERBOSE, "%s: val->f(%f) clipped at 1.0\n", __func__, val->f); + rig_debug(RIG_DEBUG_VERBOSE, "%s: val->f(%f) clipped at 1.0\n", __func__, + val->f); val->f = 1.0; } @@ -4417,11 +4432,11 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) if (rig->caps->comp_meter_cal.size == 0) { - val->f = rig_raw2val_float(atoi(retlvl), &yaesu_default_comp_meter_cal)/100; + val->f = rig_raw2val_float(atoi(retlvl), &yaesu_default_comp_meter_cal) / 100; } else { - val->f = rig_raw2val_float(atoi(retlvl), &rig->caps->comp_meter_cal)/100; + val->f = rig_raw2val_float(atoi(retlvl), &rig->caps->comp_meter_cal) / 100; } break; @@ -7656,11 +7671,14 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) w = 0; // use default in case of error + if (strlen(priv->ret_data) == 7) { int on; int n = sscanf(priv->ret_data, "SH0%1d%3d", &on, &w); - if (n == 2) { + + if (n == 2) + { if (!on) { w = 0; } } else @@ -7671,14 +7689,15 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) else if (strlen(priv->ret_data) == 6) { int n = sscanf(priv->ret_data, "SH%3d", &w); - if (n != 1) err = -RIG_EPROTO; + + if (n != 1) { err = -RIG_EPROTO; } } else { err = -RIG_EPROTO; } - rig_debug(RIG_DEBUG_TRACE, "%s: w=%d\n", __func__, w); + rig_debug(RIG_DEBUG_TRACE, "%s: w=%d\n", __func__, w); if (err != RIG_OK) { @@ -7878,7 +7897,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) case 17: *width = 3000; break; - default: + default: rig_debug(RIG_DEBUG_ERR, "%s: unknown w=%d\n", __func__, w); return -RIG_EINVAL; } @@ -7933,7 +7952,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) case 21: *width = 3200; break; - default: + default: rig_debug(RIG_DEBUG_ERR, "%s: unknown mode=%s\n", __func__, rig_strrmode(mode)); return -RIG_EINVAL; } @@ -8565,6 +8584,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) { *width = 3000; } + break; case RIG_MODE_PKTUSB: @@ -8581,6 +8601,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) { *width = 2400; } + break; case RIG_MODE_RTTY: @@ -8597,6 +8618,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) { *width = 2400; } + break; case RIG_MODE_LSB: @@ -8617,6 +8639,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) { *width = 4000; } + break; case RIG_MODE_AM: @@ -8665,6 +8688,7 @@ int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) { *width = rig_passband_normal(rig, mode); } + break; case RIG_MODE_AM: @@ -9074,7 +9098,7 @@ int newcat_get_cmd(RIG *rig) */ rig_debug(RIG_DEBUG_ERR, "%s: Command rejected by the rig: '%s'\n", __func__, priv->cmd_str); - // return -RIG_ERJCTED; + // return -RIG_ERJCTED; } continue; diff --git a/rotators/easycomm/easycomm.c b/rotators/easycomm/easycomm.c index e2955c11..a75c2763 100644 --- a/rotators/easycomm/easycomm.c +++ b/rotators/easycomm/easycomm.c @@ -259,13 +259,16 @@ static int easycomm_rot_move_velocity(ROT *rot, int direction, int speed) rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); - if (speed == ROT_SPEED_NOCHANGE) { + if (speed == ROT_SPEED_NOCHANGE) + { easycomm_speed = rs->current_speed; - } else { + } + else + { if (speed < 1 || speed > 100) { rig_debug(RIG_DEBUG_ERR, "%s: Invalid speed value (1-100)! (%d)\n", __func__, - speed); + speed); return -RIG_EINVAL; } @@ -314,12 +317,14 @@ static int easycomm_rot_get_level(ROT *rot, setting_t level, value_t *val) rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level)); - switch (level) { - case ROT_LEVEL_SPEED: - val->i = rs->current_speed; - break; - default: - return -RIG_ENAVAIL; + switch (level) + { + case ROT_LEVEL_SPEED: + val->i = rs->current_speed; + break; + + default: + return -RIG_ENAVAIL; } return RIG_OK; @@ -332,20 +337,27 @@ static int easycomm_rot_set_level(ROT *rot, setting_t level, value_t val) rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level)); - switch (level) { - case ROT_LEVEL_SPEED: { - int speed = val.i; - if (speed < 0) { - speed = 0; - } else if (speed > 9999) { - speed = 9999; - } - - rs->current_speed = speed; - break; + switch (level) + { + case ROT_LEVEL_SPEED: + { + int speed = val.i; + + if (speed < 0) + { + speed = 0; } - default: - return -RIG_ENAVAIL; + else if (speed > 9999) + { + speed = 9999; + } + + rs->current_speed = speed; + break; + } + + default: + return -RIG_ENAVAIL; } return RIG_OK; diff --git a/rotators/ether6/ether6.c b/rotators/ether6/ether6.c index 2a5c121a..10e65196 100644 --- a/rotators/ether6/ether6.c +++ b/rotators/ether6/ether6.c @@ -274,12 +274,16 @@ static int ether_rot_move(ROT *rot, int direction, int speed) rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); - if (speed == ROT_SPEED_NOCHANGE) { + if (speed == ROT_SPEED_NOCHANGE) + { ether_speed = rs->current_speed; - } else { + } + else + { if (speed < 1 || speed > 100) { - rig_debug(RIG_DEBUG_ERR, "%s: Invalid speed value (1-100)! (%d)\n", __func__, speed); + rig_debug(RIG_DEBUG_ERR, "%s: Invalid speed value (1-100)! (%d)\n", __func__, + speed); return -RIG_EINVAL; } @@ -315,12 +319,14 @@ static int ether_rot_get_level(ROT *rot, setting_t level, value_t *val) rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level)); - switch (level) { - case ROT_LEVEL_SPEED: - val->i = rs->current_speed; - break; - default: - return -RIG_ENAVAIL; + switch (level) + { + case ROT_LEVEL_SPEED: + val->i = rs->current_speed; + break; + + default: + return -RIG_ENAVAIL; } return RIG_OK; @@ -333,20 +339,27 @@ static int ether_rot_set_level(ROT *rot, setting_t level, value_t val) rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level)); - switch (level) { - case ROT_LEVEL_SPEED: { - int speed = val.i; - if (speed < 1) { - speed = 1; - } else if (speed > 100) { - speed = 100; - } - - rs->current_speed = speed; - break; + switch (level) + { + case ROT_LEVEL_SPEED: + { + int speed = val.i; + + if (speed < 1) + { + speed = 1; + } + else if (speed > 100) + { + speed = 100; } - default: - return -RIG_ENAVAIL; + + rs->current_speed = speed; + break; + } + + default: + return -RIG_ENAVAIL; } return RIG_OK; diff --git a/rotators/gs232a/gs232a.c b/rotators/gs232a/gs232a.c index 9647e0f0..335b6c3d 100644 --- a/rotators/gs232a/gs232a.c +++ b/rotators/gs232a/gs232a.c @@ -245,12 +245,14 @@ static int gs232a_rot_get_level(ROT *rot, setting_t level, value_t *val) rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level)); - switch (level) { - case ROT_LEVEL_SPEED: - val->i = rs->current_speed; - break; - default: - return -RIG_ENAVAIL; + switch (level) + { + case ROT_LEVEL_SPEED: + val->i = rs->current_speed; + break; + + default: + return -RIG_ENAVAIL; } return RIG_OK; @@ -265,28 +267,36 @@ static int gs232a_rot_set_level(ROT *rot, setting_t level, value_t val) rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level)); - switch (level) { - case ROT_LEVEL_SPEED: { - int speed = val.i; - if (speed < 1) { - speed = 1; - } else if (speed > 4) { - speed = 4; - } + switch (level) + { + case ROT_LEVEL_SPEED: + { + int speed = val.i; - /* between 1 (slowest) and 4 (fastest) */ - sprintf(cmdstr, "X%u" EOM, speed); - retval = gs232a_transaction(rot, cmdstr, NULL, 0, 1); + if (speed < 1) + { + speed = 1; + } + else if (speed > 4) + { + speed = 4; + } - if (retval != RIG_OK) { - return retval; - } + /* between 1 (slowest) and 4 (fastest) */ + sprintf(cmdstr, "X%u" EOM, speed); + retval = gs232a_transaction(rot, cmdstr, NULL, 0, 1); - rs->current_speed = speed; - break; + if (retval != RIG_OK) + { + return retval; } - default: - return -RIG_ENAVAIL; + + rs->current_speed = speed; + break; + } + + default: + return -RIG_ENAVAIL; } return RIG_OK; @@ -301,12 +311,14 @@ static int gs232a_rot_move(ROT *rot, int direction, int speed) rig_debug(RIG_DEBUG_TRACE, "%s called %d %d\n", __func__, direction, speed); - if (speed != ROT_SPEED_NOCHANGE) { + if (speed != ROT_SPEED_NOCHANGE) + { value_t gs232a_speed; if (speed < 1 || speed > 100) { - rig_debug(RIG_DEBUG_ERR, "%s: Invalid speed value (1-100)! (%d)\n", __func__, speed); + rig_debug(RIG_DEBUG_ERR, "%s: Invalid speed value (1-100)! (%d)\n", __func__, + speed); return -RIG_EINVAL; } diff --git a/rotators/gs232a/gs232b.c b/rotators/gs232a/gs232b.c index b085a29a..ef86fdba 100644 --- a/rotators/gs232a/gs232b.c +++ b/rotators/gs232a/gs232b.c @@ -109,7 +109,7 @@ transaction_write: if (strncmp(data, "\r\n", 2) == 0 || strchr(data, '>')) { rig_debug(RIG_DEBUG_ERR, "%s: Invalid response for '%s': '%s' (length=%d)\n", - __func__, cmdstr, data, (int) strlen(data)); + __func__, cmdstr, data, (int) strlen(data)); dump_hex((unsigned char *)data, strlen(data)); retval = -RIG_EPROTO; // force retry } @@ -274,12 +274,14 @@ static int gs232b_rot_get_level(ROT *rot, setting_t level, value_t *val) rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level)); - switch (level) { - case ROT_LEVEL_SPEED: - val->i = rs->current_speed; - break; - default: - return -RIG_ENAVAIL; + switch (level) + { + case ROT_LEVEL_SPEED: + val->i = rs->current_speed; + break; + + default: + return -RIG_ENAVAIL; } return RIG_OK; @@ -294,28 +296,36 @@ static int gs232b_rot_set_level(ROT *rot, setting_t level, value_t val) rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__, rot_strlevel(level)); - switch (level) { - case ROT_LEVEL_SPEED: { - int speed = val.i; - if (speed < 1) { - speed = 1; - } else if (speed > 4) { - speed = 4; - } - - /* between 1 (slowest) and 4 (fastest) */ - sprintf(cmdstr, "X%u" EOM, speed); - retval = gs232b_transaction(rot, cmdstr, NULL, 0, 1); - - if (retval != RIG_OK) { - return retval; - } - - rs->current_speed = speed; - break; + switch (level) + { + case ROT_LEVEL_SPEED: + { + int speed = val.i; + + if (speed < 1) + { + speed = 1; + } + else if (speed > 4) + { + speed = 4; + } + + /* between 1 (slowest) and 4 (fastest) */ + sprintf(cmdstr, "X%u" EOM, speed); + retval = gs232b_transaction(rot, cmdstr, NULL, 0, 1); + + if (retval != RIG_OK) + { + return retval; } - default: - return -RIG_ENAVAIL; + + rs->current_speed = speed; + break; + } + + default: + return -RIG_ENAVAIL; } return RIG_OK; @@ -330,12 +340,14 @@ static int gs232b_rot_move(ROT *rot, int direction, int speed) rig_debug(RIG_DEBUG_TRACE, "%s called %d %d\n", __func__, direction, speed); - if (speed != ROT_SPEED_NOCHANGE) { + if (speed != ROT_SPEED_NOCHANGE) + { value_t gs232b_speed; if (speed < 1 || speed > 100) { - rig_debug(RIG_DEBUG_ERR, "%s: Invalid speed value (1-100)! (%d)\n", __func__, speed); + rig_debug(RIG_DEBUG_ERR, "%s: Invalid speed value (1-100)! (%d)\n", __func__, + speed); return -RIG_EINVAL; } diff --git a/rotators/prosistel/prosistel.c b/rotators/prosistel/prosistel.c index 96d4c478..25fd64cc 100644 --- a/rotators/prosistel/prosistel.c +++ b/rotators/prosistel/prosistel.c @@ -133,7 +133,7 @@ transaction_quit: static int prosistel_rot_open(ROT *rot) { struct prosistel_rot_priv_caps *priv_caps = - (struct prosistel_rot_priv_caps *) rot->caps->priv; + (struct prosistel_rot_priv_caps *) rot->caps->priv; char cmdstr[64]; int retval; @@ -144,10 +144,12 @@ static int prosistel_rot_open(ROT *rot) // The rotator controller sends position data continuously when CPM is enabled // Disable CPM for azimuth if the rotator has an azimuth rotator - if (rot->caps->rot_type == ROT_TYPE_AZIMUTH || rot->caps->rot_type == ROT_TYPE_AZEL) + if (rot->caps->rot_type == ROT_TYPE_AZIMUTH + || rot->caps->rot_type == ROT_TYPE_AZEL) { num_sprintf(cmdstr, STX"%cS"CR, priv_caps->azimuth_id); retval = prosistel_transaction(rot, cmdstr, NULL, 0); + if (retval != RIG_OK) { return retval; @@ -155,10 +157,12 @@ static int prosistel_rot_open(ROT *rot) } // Disable CPM for elevation if the rotator has an elevation rotator - if (rot->caps->rot_type == ROT_TYPE_ELEVATION || rot->caps->rot_type == ROT_TYPE_AZEL) + if (rot->caps->rot_type == ROT_TYPE_ELEVATION + || rot->caps->rot_type == ROT_TYPE_AZEL) { num_sprintf(cmdstr, STX"%cS"CR, priv_caps->elevation_id); retval = prosistel_transaction(rot, cmdstr, NULL, 0); + if (retval != RIG_OK) { return retval; @@ -172,7 +176,7 @@ static int prosistel_rot_open(ROT *rot) static int prosistel_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) { struct prosistel_rot_priv_caps *priv_caps = - (struct prosistel_rot_priv_caps *) rot->caps->priv; + (struct prosistel_rot_priv_caps *) rot->caps->priv; char cmdstr[64]; int retval; @@ -182,9 +186,11 @@ static int prosistel_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) // Set azimuth only if the rotator has the capability to do so // It is an error to set azimuth if it's not supported by the rotator controller - if (rot->caps->rot_type == ROT_TYPE_AZIMUTH || rot->caps->rot_type == ROT_TYPE_AZEL) + if (rot->caps->rot_type == ROT_TYPE_AZIMUTH + || rot->caps->rot_type == ROT_TYPE_AZEL) { - num_sprintf(cmdstr, STX"%cG%.0f"CR, priv_caps->azimuth_id, az * priv_caps->angle_multiplier); + num_sprintf(cmdstr, STX"%cG%.0f"CR, priv_caps->azimuth_id, + az * priv_caps->angle_multiplier); retval = prosistel_transaction(rot, cmdstr, NULL, 0); if (retval != RIG_OK) @@ -195,9 +201,11 @@ static int prosistel_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) // Set elevation only if the rotator has the capability to do so // It is an error to set elevation if it's not supported by the rotator controller - if (rot->caps->rot_type == ROT_TYPE_ELEVATION || rot->caps->rot_type == ROT_TYPE_AZEL) + if (rot->caps->rot_type == ROT_TYPE_ELEVATION + || rot->caps->rot_type == ROT_TYPE_AZEL) { - num_sprintf(cmdstr, STX"%cG%.0f"CR, priv_caps->elevation_id, el * priv_caps->angle_multiplier); + num_sprintf(cmdstr, STX"%cG%.0f"CR, priv_caps->elevation_id, + el * priv_caps->angle_multiplier); retval = prosistel_transaction(rot, cmdstr, NULL, 0); if (retval != RIG_OK) @@ -213,7 +221,7 @@ static int prosistel_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) static int prosistel_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) { struct prosistel_rot_priv_caps *priv_caps = - (struct prosistel_rot_priv_caps *) rot->caps->priv; + (struct prosistel_rot_priv_caps *) rot->caps->priv; char cmdstr[64]; char data[20]; float posval; @@ -222,12 +230,14 @@ static int prosistel_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) // Query azimuth only if the rotator has the capability to do so // It is an error to query for azimuth if it's not supported by the rotator controller - if (rot->caps->rot_type == ROT_TYPE_AZIMUTH || rot->caps->rot_type == ROT_TYPE_AZEL) + if (rot->caps->rot_type == ROT_TYPE_AZIMUTH + || rot->caps->rot_type == ROT_TYPE_AZEL) { char rot_id; num_sprintf(cmdstr, STX"%c?"CR, priv_caps->azimuth_id); retval = prosistel_transaction(rot, cmdstr, data, sizeof(data)); + if (retval != RIG_OK) { return retval; @@ -248,7 +258,7 @@ static int prosistel_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) posval /= priv_caps->angle_multiplier; rig_debug(RIG_DEBUG_VERBOSE, "%s got position from '%s' converted to %f\n", - __func__, data, posval); + __func__, data, posval); *az = (azimuth_t) posval; } @@ -259,12 +269,14 @@ static int prosistel_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) // Query elevation only if the rotator has the capability to do so // It is an error to query for elevation if it's not supported by the rotator controller - if (rot->caps->rot_type == ROT_TYPE_ELEVATION || rot->caps->rot_type == ROT_TYPE_AZEL) + if (rot->caps->rot_type == ROT_TYPE_ELEVATION + || rot->caps->rot_type == ROT_TYPE_AZEL) { char rot_id; num_sprintf(cmdstr, STX"%c?"CR, priv_caps->elevation_id); retval = prosistel_transaction(rot, cmdstr, data, sizeof(data)); + if (retval != RIG_OK) { return retval; @@ -285,7 +297,7 @@ static int prosistel_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) posval /= priv_caps->angle_multiplier; rig_debug(RIG_DEBUG_VERBOSE, "%s got position from '%s' converted to %f\n", - __func__, data, posval); + __func__, data, posval); *el = (elevation_t) posval; } @@ -301,14 +313,15 @@ static int prosistel_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) static int prosistel_rot_stop(ROT *rot) { struct prosistel_rot_priv_caps *priv_caps = - (struct prosistel_rot_priv_caps *) rot->caps->priv; + (struct prosistel_rot_priv_caps *) rot->caps->priv; char cmdstr[64]; int retval; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); // Stop azimuth only if the rotator has the capability to do so - if (rot->caps->rot_type == ROT_TYPE_AZIMUTH || rot->caps->rot_type == ROT_TYPE_AZEL) + if (rot->caps->rot_type == ROT_TYPE_AZIMUTH + || rot->caps->rot_type == ROT_TYPE_AZEL) { num_sprintf(cmdstr, STX"%cG%d"CR, priv_caps->azimuth_id, priv_caps->stop_angle); retval = prosistel_transaction(rot, cmdstr, NULL, 0); @@ -320,9 +333,11 @@ static int prosistel_rot_stop(ROT *rot) } // Stop elevation only if the rotator has the capability to do so - if (rot->caps->rot_type == ROT_TYPE_ELEVATION || rot->caps->rot_type == ROT_TYPE_AZEL) + if (rot->caps->rot_type == ROT_TYPE_ELEVATION + || rot->caps->rot_type == ROT_TYPE_AZEL) { - num_sprintf(cmdstr, STX"%cG%d"CR, priv_caps->elevation_id, priv_caps->stop_angle); + num_sprintf(cmdstr, STX"%cG%d"CR, priv_caps->elevation_id, + priv_caps->stop_angle); retval = prosistel_transaction(rot, cmdstr, NULL, 0); if (retval != RIG_OK) commit 8ed0dcdbb78e118ef6be94836749d8ac0da81835 Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Dec 17 12:01:08 2020 -0600 Fix flex6xxx RFPOWER_METER_WATTS for sure this time diff --git a/rigs/kenwood/flex6xxx.c b/rigs/kenwood/flex6xxx.c index 11bb1dc1..1da17bad 100644 --- a/rigs/kenwood/flex6xxx.c +++ b/rigs/kenwood/flex6xxx.c @@ -736,6 +736,7 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) int len, ans; rmode_t mode; pbwidth_t width; + ptt_t ptt; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -772,6 +773,11 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) case RIG_LEVEL_RFPOWER_METER: case RIG_LEVEL_RFPOWER_METER_WATTS: + flex6k_get_ptt(rig, vfo, &ptt); + if (!ptt) { + val->f = 0; + return RIG_OK; + } cmd = "ZZRM5"; len = 5; ans = 3; @@ -837,12 +843,12 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) case RIG_LEVEL_AF: case RIG_LEVEL_RFPOWER_METER: case RIG_LEVEL_RFPOWER_METER_WATTS: - n = sscanf(lvlbuf + len, "%f", &val->f); - + n = sscanf(lvlbuf, "ZZRM%f", &val->f); if (n != 1) { rig_debug(RIG_DEBUG_ERR, "%s: Error parsing value from lvlbuf='%s'\n", __func__, lvlbuf); + val->f = 0; return -RIG_EPROTO; } if (level != RIG_LEVEL_RFPOWER_METER_WATTS) commit 31b42de067ecee1a084aad36d28dd2739b347f7f Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Dec 17 11:36:21 2020 -0600 Fix flex6xxx RFPOWER_METER_WATTS diff --git a/rigs/kenwood/flex6xxx.c b/rigs/kenwood/flex6xxx.c index 7dc8c89b..11bb1dc1 100644 --- a/rigs/kenwood/flex6xxx.c +++ b/rigs/kenwood/flex6xxx.c @@ -771,6 +771,7 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) break; case RIG_LEVEL_RFPOWER_METER: + case RIG_LEVEL_RFPOWER_METER_WATTS: cmd = "ZZRM5"; len = 5; ans = 3; commit c11e592a7a747f93046c760ea988694f73011167 Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Dec 17 07:53:16 2020 -0600 Add RFLEVEL_POWER_METER_WATTS to flex6xxx and k3 diff --git a/rigs/kenwood/flex6xxx.c b/rigs/kenwood/flex6xxx.c index 65411fbf..7dc8c89b 100644 --- a/rigs/kenwood/flex6xxx.c +++ b/rigs/kenwood/flex6xxx.c @@ -51,7 +51,7 @@ /* PowerSDR differences */ #define POWERSDR_FUNC_ALL (RIG_FUNC_VOX|RIG_FUNC_SQL|RIG_FUNC_NB|RIG_FUNC_ANF|RIG_FUNC_MUTE|RIG_FUNC_RIT|RIG_FUNC_XIT|RIG_FUNC_TUNER) -#define POWERSDR_LEVEL_ALL (RIG_LEVEL_SLOPE_HIGH|RIG_LEVEL_SLOPE_LOW|RIG_LEVEL_KEYSPD|RIG_LEVEL_RFPOWER_METER|RIG_LEVEL_MICGAIN|RIG_LEVEL_VOXGAIN|RIG_LEVEL_SQL|RIG_LEVEL_AF|RIG_LEVEL_AGC|RIG_LEVEL_RF|RIG_LEVEL_IF) +#define POWERSDR_LEVEL_ALL (RIG_LEVEL_SLOPE_HIGH|RIG_LEVEL_SLOPE_LOW|RIG_LEVEL_KEYSPD|RIG_LEVEL_RFPOWER_METER|RIG_LEVEL_RFPOWER_METER_WATTS|RIG_LEVEL_MICGAIN|RIG_LEVEL_VOXGAIN|RIG_LEVEL_SQL|RIG_LEVEL_AF|RIG_LEVEL_AGC|RIG_LEVEL_RF|RIG_LEVEL_IF) static rmode_t flex_mode_table[KENWOOD_MODE_TABLE_MAX] = @@ -835,6 +835,7 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) case RIG_LEVEL_AF: case RIG_LEVEL_RFPOWER_METER: + case RIG_LEVEL_RFPOWER_METER_WATTS: n = sscanf(lvlbuf + len, "%f", &val->f); if (n != 1) @@ -843,8 +844,10 @@ int powersdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) __func__, lvlbuf); return -RIG_EPROTO; } - - val->f /= 100; + if (level != RIG_LEVEL_RFPOWER_METER_WATTS) + { + val->f /= 100; + } break; case RIG_LEVEL_RF: @@ -1020,7 +1023,7 @@ const struct rig_caps f6k_caps = RIG_MODEL(RIG_MODEL_F6K), .model_name = "6xxx", .mfg_name = "FlexRadio", - .version = "20130717.0", + .version = "20201217.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -1144,7 +1147,7 @@ const struct rig_caps powersdr_caps = RIG_MODEL(RIG_MODEL_POWERSDR), .model_name = "PowerSDR/Thetis", .mfg_name = "FlexRadio/ANAN", - .version = "20201108.0", + .version = "2020161217", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, diff --git a/rigs/kenwood/k3.c b/rigs/kenwood/k3.c index 8cdfe628..e371c1a8 100644 --- a/rigs/kenwood/k3.c +++ b/rigs/kenwood/k3.c @@ -47,7 +47,7 @@ #define K3_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_PREAMP|RIG_LEVEL_AGC|RIG_LEVEL_SQL|\ RIG_LEVEL_STRENGTH|RIG_LEVEL_ALC|RIG_LEVEL_RFPOWER|RIG_LEVEL_KEYSPD|\ RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_MICGAIN|RIG_LEVEL_COMP|\ - RIG_LEVEL_NR|RIG_LEVEL_MONITOR_GAIN|RIG_LEVEL_RAWSTR|RIG_LEVEL_RFPOWER_METER) + RIG_LEVEL_NR|RIG_LEVEL_MONITOR_GAIN|RIG_LEVEL_RAWSTR|RIG_LEVEL_RFPOWER_METER|RIG_LEVEL_RFPOWER_METER_WATTS) #define K3_VFO (RIG_VFO_A|RIG_VFO_B) #define K3_VFO_OP (RIG_OP_UP|RIG_OP_DOWN) @@ -61,7 +61,7 @@ #define KX3_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_PREAMP|RIG_LEVEL_AGC|RIG_LEVEL_SQL|\ RIG_LEVEL_STRENGTH|RIG_LEVEL_RFPOWER|RIG_LEVEL_KEYSPD|\ RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_MICGAIN|RIG_LEVEL_COMP|\ - RIG_LEVEL_NR|RIG_LEVEL_MONITOR_GAIN|RIG_LEVEL_RAWSTR|RIG_LEVEL_RFPOWER_METER) + RIG_LEVEL_NR|RIG_LEVEL_MONITOR_GAIN|RIG_LEVEL_RAWSTR|RIG_LEVEL_RFPOWER_METER|RIG_LEVEL_RFPOWER_METER_WATTS) /* * Elecraft K3/K3S extra level definitions @@ -181,7 +181,7 @@ const struct rig_caps k3_caps = RIG_MODEL(RIG_MODEL_K3), .model_name = "K3", .mfg_name = "Elecraft", - .version = BACKEND_VER ".1", + .version = BACKEND_VER ".2", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -332,7 +332,7 @@ const struct rig_caps k3s_caps = RIG_MODEL(RIG_MODEL_K3S), .model_name = "K3S", .mfg_name = "Elecraft", - .version = BACKEND_VER ".1", + .version = BACKEND_VER ".2", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -482,7 +482,7 @@ const struct rig_caps k4_caps = RIG_MODEL(RIG_MODEL_K4), .model_name = "K4", .mfg_name = "Elecraft", - .version = BACKEND_VER ".1", + .version = BACKEND_VER ".2", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -631,7 +631,7 @@ const struct rig_caps kx3_caps = RIG_MODEL(RIG_MODEL_KX3), .model_name = "KX3", .mfg_name = "Elecraft", - .version = BACKEND_VER ".1", + .version = BACKEND_VER ".2", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -780,7 +780,7 @@ const struct rig_caps kx2_caps = RIG_MODEL(RIG_MODEL_KX2), .model_name = "KX2", .mfg_name = "Elecraft", - .version = BACKEND_VER ".1", + .version = BACKEND_VER ".2", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -1840,6 +1840,7 @@ int k3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) } case RIG_LEVEL_RFPOWER_METER: + case RIG_LEVEL_RFPOWER_METER_WATTS: { int tx_mode; float pwr; @@ -1863,6 +1864,10 @@ int k3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) } val->f = pwr; + if (level == RIG_LEVEL_RFPOWER_METER_WATTS) + { + val->f *= 100; + } break; } commit 6f4c2de0b63f267c32497d86103a7629c55bfb30 Author: Michael Black W9MDB <mdb...@ya...> Date: Wed Dec 16 22:33:00 2020 -0600 Change RFPOWER_METER table to reflect that it's for the FT2000D diff --git a/rigs/yaesu/ft2000.c b/rigs/yaesu/ft2000.c index 59b9d1c5..03888f71 100644 --- a/rigs/yaesu/ft2000.c +++ b/rigs/yaesu/ft2000.c @@ -133,7 +133,7 @@ const struct rig_caps ft2000_caps = .transceive = RIG_TRN_OFF, /* May enable later as the 2000 has an Auto Info command */ .bank_qty = 0, .chan_desc_sz = 0, - .rfpower_meter_cal = FT2000_RFPOWER_METER_CAL, + .rfpower_meter_cal = FT2000D_RFPOWER_METER_CAL, .str_cal = FT2000_STR_CAL, .chan_list = { { 1, 99, RIG_MTYPE_MEM, NEWCAT_MEM_CAP }, diff --git a/rigs/yaesu/ft2000.h b/rigs/yaesu/ft2000.h index e9e10459..b09da65e 100644 --- a/rigs/yaesu/ft2000.h +++ b/rigs/yaesu/ft2000.h @@ -72,7 +72,7 @@ // From measurements on FT2000D by Stan UA3SAQ // We'll reuse this for now and divide by 2 for FT2000 -#define FT2000_RFPOWER_METER_CAL { 12, \ +#define FT2000D_RFPOWER_METER_CAL { 12, \ { \ {0, 0.0f}, \ {51, 10.0f}, \ commit 603f39097db1f476d31f0f6962f6c0845a3c9611 Author: Michael Black W9MDB <mdb...@ya...> Date: Wed Dec 16 22:20:39 2020 -0600 Update ft2000 RFPOWER_METER diff --git a/rigs/yaesu/ft2000.c b/rigs/yaesu/ft2000.c index 03888f71..59b9d1c5 100644 --- a/rigs/yaesu/ft2000.c +++ b/rigs/yaesu/ft2000.c @@ -133,7 +133,7 @@ const struct rig_caps ft2000_caps = .transceive = RIG_TRN_OFF, /* May enable later as the 2000 has an Auto Info command */ .bank_qty = 0, .chan_desc_sz = 0, - .rfpower_meter_cal = FT2000D_RFPOWER_METER_CAL, + .rfpower_meter_cal = FT2000_RFPOWER_METER_CAL, .str_cal = FT2000_STR_CAL, .chan_list = { { 1, 99, RIG_MTYPE_MEM, NEWCAT_MEM_CAP }, diff --git a/rigs/yaesu/ft2000.h b/rigs/yaesu/ft2000.h index f81c5a9b..e9e10459 100644 --- a/rigs/yaesu/ft2000.h +++ b/rigs/yaesu/ft2000.h @@ -72,8 +72,9 @@ // From measurements on FT2000D by Stan UA3SAQ // We'll reuse this for now and divide by 2 for FT2000 -#define FT2000D_RFPOWER_METER_CAL { 11, \ +#define FT2000_RFPOWER_METER_CAL { 12, \ { \ + {0, 0.0f}, \ {51, 10.0f}, \ {67, 20.0f}, \ {97, 40.0f}, \ commit 2a0deb34158bea57cab351819adeea2a8fc02a1e Author: Michael Black W9MDB <mdb...@ya...> Date: Wed Dec 16 17:47:49 2020 -0600 Add RIG_LEVEL_RFPOWER_METER_WATTS Old level of 0-1 just doesn't work well with the varying power levels in rigs now diff --git a/NEWS b/NEWS index 438541d0..e1407ba7 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,7 @@ Version 4.0 * API/ABI changes, advance ABI to 4 0 0. * Add GPIO and GPION options for DCD. Jeroen Vreeken * New backend: ELAD FDM DUO. Giovanni, HB9EIK. + * New RIG_LEVEL_RFPOWER_METER_WATTS level * All channel functions now take a vfo argument * New rotator backend: iOptron. Bob, KD8CGH * New model: Icom IC-R8600. Ekki, DF4OR diff --git a/doc/man1/rigctl.1 b/doc/man1/rigctl.1 index b2fde9ce..e695ce3f 100644 --- a/doc/man1/rigctl.1 +++ b/doc/man1/rigctl.1 @@ -841,7 +841,7 @@ and .IP Level is a token: \(oqPREAMP\(cq, \(oqATT\(cq, \(oqVOX\(cq, \(oqAF\(cq, \(oqRF\(cq, \(oqSQL\(cq, \(oqIF\(cq, \(oqAPF\(cq, \(oqNR\(cq, \(oqPBT_IN\(cq, -\(oqPBT_OUT\(cq, \(oqCWPITCH\(cq, \(oqRFPOWER\(cq, \(oqMICGAIN\(cq, +\(oqPBT_OUT\(cq, \(oqCWPITCH\(cq, \(oqRFPOWER\(cq, \(oqRFPOWER_METER\(cq, \(oqRFPOWER_METER_WATTS\(cq, \(oqMICGAIN\(cq, \(oqKEYSPD\(cq, \(oqNOTCHF\(cq, \(oqCOMP\(cq, \(oqAGC\(cq, \(oqBKINDL\(cq, \(oqBAL\(cq, \(oqMETER\(cq, \(oqVOXGAIN\(cq, \(oqANTIVOX\(cq, \(oqSLOPE_LOW\(cq, \(oqSLOPE_HIGH\(cq, \(oqRAWSTR\(cq, \(oqSWR\(cq, diff --git a/doc/man1/rigctld.1 b/doc/man1/rigctld.1 index 74229e18..8024b6c1 100644 --- a/doc/man1/rigctld.1 +++ b/doc/man1/rigctld.1 @@ -822,7 +822,7 @@ and .IP Level is a token: \(oqPREAMP\(cq, \(oqATT\(cq, \(oqVOX\(cq, \(oqAF\(cq, \(oqRF\(cq, \(oqSQL\(cq, \(oqIF\(cq, \(oqAPF\(cq, \(oqNR\(cq, \(oqPBT_IN\(cq, -\(oqPBT_OUT\(cq, \(oqCWPITCH\(cq, \(oqRFPOWER\(cq, \(oqMICGAIN\(cq, +\(oqPBT_OUT\(cq, \(oqCWPITCH\(cq, \(oqRFPOWER\(cq, \(oqRFPOWER_METER\(cq, \(oqRFPOWER_METER_WATTS\(cq, \(oqMICGAIN\(cq, \(oqKEYSPD\(cq, \(oqNOTCHF\(cq, \(oqCOMP\(cq, \(oqAGC\(cq, \(oqBKINDL\(cq, \(oqBAL\(cq, \(oqMETER\(cq, \(oqVOXGAIN\(cq, \(oqANTIVOX\(cq, \(oqSLOPE_LOW\(cq, \(oqSLOPE_HIGH\(cq, \(oqRAWSTR\(cq, \(oqSWR\(cq, diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index b8c4832f..8825c8d6 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -888,7 +888,7 @@ enum rig_level_e { RIG_LEVEL_NOTCHF_RAW = CONSTANT_64BIT_FLAG(36), /*!< \c NOTCHF_RAW -- Notch Freq., arg float [0.0 ... 1.0] */ RIG_LEVEL_MONITOR_GAIN = CONSTANT_64BIT_FLAG(37), /*!< \c MONITOR_GAIN -- Monitor gain (level for monitoring of transmitted audio), arg float [0.0 ... 1.0] */ RIG_LEVEL_NB = CONSTANT_64BIT_FLAG(38), /*!< \c NB -- Noise Blanker level, arg float [0.0 ... 1.0] */ - RIG_LEVEL_39 = CONSTANT_64BIT_FLAG(39), /*!< \c Future use */ + RIG_LEVEL_RFPOWER_METER_WATTS = CONSTANT_64BIT_FLAG(39), /*!< \c RFPOWER_METER_WATTS -- RF power output meter, arg float [0.0 ... MAX] (output power in watts) */ RIG_LEVEL_40 = CONSTANT_64BIT_FLAG(40), /*!< \c Future use */ RIG_LEVEL_41 = CONSTANT_64BIT_FLAG(41), /*!< \c Future use */ RIG_LEVEL_42 = CONSTANT_64BIT_FLAG(42), /*!< \c Future use */ @@ -916,7 +916,7 @@ enum rig_level_e { }; //! @cond Doxygen_Suppress -#define RIG_LEVEL_FLOAT_LIST (RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_APF|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_COMP|RIG_LEVEL_BALANCE|RIG_LEVEL_SWR|RIG_LEVEL_ALC|RIG_LEVEL_VOXGAIN|RIG_LEVEL_ANTIVOX|RIG_LEVEL_RFPOWER_METER|RIG_LEVEL_COMP_METER|RIG_LEVEL_VD_METER|RIG_LEVEL_ID_METER|RIG_LEVEL_NOTCHF_RAW|RIG_LEVEL_MONITOR_GAIN|RIG_LEVEL_NB) +#define RIG_LEVEL_FLOAT_LIST (RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_APF|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_COMP|RIG_LEVEL_BALANCE|RIG_LEVEL_SWR|RIG_LEVEL_ALC|RIG_LEVEL_VOXGAIN|RIG_LEVEL_ANTIVOX|RIG_LEVEL_RFPOWER_METER|RIG_LEVEL_RFPOWER_METER_WATTS|RIG_LEVEL_COMP_METER|RIG_LEVEL_VD_METER|RIG_LEVEL_ID_METER|RIG_LEVEL_NOTCHF_RAW|RIG_LEVEL_MONITOR_GAIN|RIG_LEVEL_NB) #define RIG_LEVEL_READONLY_LIST (RIG_LEVEL_SQLSTAT|RIG_LEVEL_SWR|RIG_LEVEL_ALC|RIG_LEVEL_STRENGTH|RIG_LEVEL_RAWSTR|RIG_LEVEL_RFPOWER_METER|RIG_LEVEL_COMP_METER|RIG_LEVEL_VD_METER|RIG_LEVEL_ID_METER) diff --git a/rigs/dummy/dummy.c b/rigs/dummy/dummy.c index 37f4ad2f..d3d7b51a 100644 --- a/rigs/dummy/dummy.c +++ b/rigs/dummy/dummy.c @@ -1069,6 +1069,20 @@ static int dummy_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) break; + case RIG_LEVEL_RFPOWER_METER_WATTS: + if (priv->static_data) + { + curr->levels[idx].f = 50.0f; + } + else + { + curr->levels[idx].f = (float)(time(NULL) % 32) / 64.0f + (float)( + rand() % 4) / 8.0f; + curr->levels[idx].f *= 100.0f; + } + + break; + case RIG_LEVEL_COMP_METER: if (priv->static_data) { diff --git a/rigs/dummy/flrig.c b/rigs/dummy/flrig.c index 214174df..a34da5ad 100644 --- a/rigs/dummy/flrig.c +++ b/rigs/dummy/flrig.c @@ -107,6 +107,7 @@ struct flrig_priv_data pbwidth_t curr_widthB; int has_get_modeA; /* True if this function is available */ int has_get_bwA; /* True if this function is available */ + float powermeter_scale; /* So we can scale power meter to 0-1 */ }; const struct rig_caps flrig_caps = @@ -735,6 +736,19 @@ static int flrig_open(RIG *rig) strncpy(priv->info, value, sizeof(priv->info)); rig_debug(RIG_DEBUG_VERBOSE, "Transceiver=%s\n", value); + /* see if get_pwrmeter_scale is available */ + retval = flrig_transaction(rig, "rig.get_pwrmeter_scale", NULL, value, + sizeof(value)); + + if (retval != RIG_OK) { return retval; } + + priv->powermeter_scale = 100; // default + + if (strlen(value) > 0) + { + priv->powermeter_scale = atof(value); + } + /* see if get_modeA is available */ retval = flrig_transaction(rig, "rig.get_modeA", NULL, value, sizeof(value)); @@ -1909,6 +1923,7 @@ static int flrig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) char value[MAXARGLEN]; char *cmd; int retval; + //struct flrig_priv_data *priv = (struct flrig_priv_data *) rig->state.priv; rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s\n", __func__, rig_strvfo(vfo)); @@ -1944,9 +1959,17 @@ static int flrig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) switch (level) { case RIG_LEVEL_STRENGTH: - case RIG_LEVEL_RFPOWER_METER: val->i = atoi(value); rig_debug(RIG_DEBUG_TRACE, "%s: val.i='%s'(%d)\n", __func__, value, val->i); + + case RIG_LEVEL_RFPOWER_METER: + val->f = atof(value)/100.0; + rig_debug(RIG_DEBUG_TRACE, "%s: val.f='%s'(%g)\n", __func__, value, val->f); + break; + + case RIG_LEVEL_RFPOWER_METER_WATTS: + val->f = atof(value); + rig_debug(RIG_DEBUG_TRACE, "%s: val.f='%s'(%g)\n", __func__, value, val->f); break; d... [truncated message content] |