New power on option rather than power on/off

Also fixes incorrect token name usage in token definition
pull/345/head
Bill Somerville 2020-07-04 23:23:39 +01:00
rodzic 3f40029720
commit 281febec62
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: D864B06D1E81618F
6 zmienionych plików z 14 dodań i 14 usunięć

Wyświetl plik

@ -2028,8 +2028,8 @@ struct rig_state {
int twiddle_timeout; /*!< timeout to resume from twiddling */ int twiddle_timeout; /*!< timeout to resume from twiddling */
struct rig_cache cache; struct rig_cache cache;
int vfo_opt; /*!< Is -o switch turned on? */ int vfo_opt; /*!< Is -o switch turned on? */
int auto_pwr_on_off; /*!< Allow Hamlib to power rig on and int auto_power_on; /*!< Allow Hamlib to power rig
off automatically if supported */ automatically if supported */
int auto_disable_screensaver; /*!< Allow Hamlib to disable the int auto_disable_screensaver; /*!< Allow Hamlib to disable the
rig's screen saver automatically if rig's screen saver automatically if
supported */ supported */

Wyświetl plik

@ -727,7 +727,7 @@ icom_rig_open(RIG *rig)
rig->caps->version); rig->caps->version);
retval = icom_get_usb_echo_off(rig); retval = icom_get_usb_echo_off(rig);
if (retval != RIG_OK && priv->poweron == 0 && rs->auto_pwr_on_off) if (retval != RIG_OK && priv->poweron == 0 && rs->auto_power_on)
{ {
// maybe we need power on? // maybe we need power on?
rig_debug(RIG_DEBUG_VERBOSE, "%s trying power on\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s trying power on\n", __func__);

Wyświetl plik

@ -725,7 +725,7 @@ int kenwood_open(RIG *rig)
rig_debug(RIG_DEBUG_TRACE, "%s: got ID so try PS\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: got ID so try PS\n", __func__);
err = rig_get_powerstat(rig, &powerstat); err = rig_get_powerstat(rig, &powerstat);
if (err == RIG_OK && powerstat == 0 && priv->poweron == 0 && rig->state.auto_pwr_on_off) if (err == RIG_OK && powerstat == 0 && priv->poweron == 0 && rig->state.auto_power_on)
{ {
rig_debug(RIG_DEBUG_TRACE, "%s: got PS0 so powerup\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: got PS0 so powerup\n", __func__);
rig_set_powerstat(rig, 1); rig_set_powerstat(rig, 1);
@ -735,7 +735,7 @@ int kenwood_open(RIG *rig)
err = RIG_OK; // reset our err back to OK for later checks err = RIG_OK; // reset our err back to OK for later checks
} }
if (err == -RIG_ETIMEOUT && rig->state.auto_pwr_on_off) if (err == -RIG_ETIMEOUT && rig->state.auto_power_on)
{ {
// Ensure rig is on // Ensure rig is on
rig_set_powerstat(rig, 1); rig_set_powerstat(rig, 1);

Wyświetl plik

@ -366,7 +366,7 @@ int newcat_open(RIG *rig)
__func__, rig_s->rigport.post_write_delay); __func__, rig_s->rigport.post_write_delay);
/* Ensure rig is powered on */ /* Ensure rig is powered on */
if (priv->poweron == 0 && rig_s->auto_pwr_on_off) if (priv->poweron == 0 && rig_s->auto_power_on)
{ {
rig_set_powerstat(rig, 1); rig_set_powerstat(rig, 1);
priv->poweron = 1; priv->poweron = 1;

Wyświetl plik

@ -129,12 +129,12 @@ static const struct confparams frontend_cfg_params[] =
"500", RIG_CONF_NUMERIC, { .n = {0, 5000, 1}} "500", RIG_CONF_NUMERIC, { .n = {0, 5000, 1}}
}, },
{ {
TOK_AUTO_PWR_ON_OFF, "auto_pwr_on_off", "Auto power on/off", TOK_AUTO_POWER_ON, "auto_power_on", "Auto power on",
"True enables compatible rigs to be powered up on open", "True enables compatible rigs to be powered up on open",
"0", RIG_CONF_CHECKBUTTON, { } "0", RIG_CONF_CHECKBUTTON, { }
}, },
{ {
TOK_AUTO_PWR_ON_OFF, "auto_disable_screensaver", "Auto disable screen saver", TOK_AUTO_DISABLE_SCREENSAVER, "auto_disable_screensaver", "Auto disable screen saver",
"True enables compatible rigs to have their screen saver disabled on open", "True enables compatible rigs to have their screen saver disabled on open",
"0", RIG_CONF_CHECKBUTTON, { } "0", RIG_CONF_CHECKBUTTON, { }
}, },
@ -562,12 +562,12 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
rig_set_cache_timeout_ms(rig, HAMLIB_CACHE_ALL, atol(val)); rig_set_cache_timeout_ms(rig, HAMLIB_CACHE_ALL, atol(val));
break; break;
case TOK_AUTO_PWR_ON_OFF: case TOK_AUTO_POWER_ON:
if (1 != sscanf(val, "%d", &val_i)) if (1 != sscanf(val, "%d", &val_i))
{ {
return -RIG_EINVAL; //value format error return -RIG_EINVAL; //value format error
} }
rs->auto_pwr_on_off = val_i ? 1 : 0; rs->auto_power_on = val_i ? 1 : 0;
break; break;
case TOK_AUTO_DISABLE_SCREENSAVER: case TOK_AUTO_DISABLE_SCREENSAVER:
@ -890,8 +890,8 @@ static int frontend_get_conf(RIG *rig, token_t token, char *val)
sprintf(val, "%d", rig_get_cache_timeout_ms(rig, HAMLIB_CACHE_ALL)); sprintf(val, "%d", rig_get_cache_timeout_ms(rig, HAMLIB_CACHE_ALL));
break; break;
case TOK_AUTO_PWR_ON_OFF: case TOK_AUTO_POWER_ON:
sprintf(val, "%d", rs->auto_pwr_on_off); sprintf(val, "%d", rs->auto_power_on);
break; break;
case TOK_AUTO_DISABLE_SCREENSAVER: case TOK_AUTO_DISABLE_SCREENSAVER:

Wyświetl plik

@ -104,8 +104,8 @@
#define TOK_RANGE_NAME TOKEN_FRONTEND(122) #define TOK_RANGE_NAME TOKEN_FRONTEND(122)
/** \brief rig: Cache timeout */ /** \brief rig: Cache timeout */
#define TOK_CACHE_TIMEOUT TOKEN_FRONTEND(123) #define TOK_CACHE_TIMEOUT TOKEN_FRONTEND(123)
/** \brief rig: Auto power on/off */ /** \brief rig: Auto power on rig_open when supported */
#define TOK_AUTO_PWR_ON_OFF TOKEN_FRONTEND(124) #define TOK_AUTO_POWER_ON TOKEN_FRONTEND(124)
/** \brief rig: Auto disable screensaver */ /** \brief rig: Auto disable screensaver */
#define TOK_AUTO_DISABLE_SCREENSAVER TOKEN_FRONTEND(125) #define TOK_AUTO_DISABLE_SCREENSAVER TOKEN_FRONTEND(125)
/* /*