diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index fb6c7a248..1e70e30c7 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -2038,6 +2038,9 @@ struct rig_state { int auto_disable_screensaver; /*!< Allow Hamlib to disable the rig's screen saver automatically if supported */ + int power_now; /*!< Current RF power level in rig units */ + int power_min; /*!< Minimum RF power level in rig units */ + int power_max; /*!< Maximum RF power level in rig units */ }; //! @cond Doxygen_Suppress diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 27821926b..9dc0efa73 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -2260,6 +2260,18 @@ static int kenwood_get_power_minmax(RIG *rig, int *power_now, int *power_min, struct rig_state *rs = &rig->state; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); + + // Don't do this if PTT is on...don't want to max out power!! + if (rig->state.cache.ptt == RIG_PTT_ON) + { + rig_debug(RIG_DEBUG_TRACE, "%s: ptt on so not checking min/max power levels\n", __func__); + // return the last values we got + *power_now = rig->state.power_now; + *power_min = rig->state.power_min; + *power_max = rig->state.power_max; + return RIG_OK; + } + retval = write_block(&rs->rigport, cmd, strlen(cmd)); if (retval != RIG_OK) { return retval; } @@ -2293,6 +2305,10 @@ static int kenwood_get_power_minmax(RIG *rig, int *power_now, int *power_min, rig_debug(RIG_DEBUG_TRACE, "%s: returning now=%d, min=%d, max=%d\n", __func__, *power_now, *power_min, *power_max); + + rig->state.power_now = *power_now; + rig->state.power_min = *power_min; + rig->state.power_max = *power_max; return RIG_OK; }