Add RIG_LEVEL_BAND_SELECT -- applies to Yaesu rigs for now

https://github.com/Hamlib/Hamlib/issues/919
pull/948/head
Mike Black W9MDB 2022-01-29 16:08:43 -06:00
rodzic 4e0ddf10d2
commit 8e18fd624d
3 zmienionych plików z 64 dodań i 3 usunięć

Wyświetl plik

@ -547,6 +547,7 @@ typedef unsigned int vfo_t;
#define RIG_TARGETABLE_ANT (1<<10)
#define RIG_TARGETABLE_ROOFING (1<<11) // roofing filter targetable by VFO
#define RIG_TARGETABLE_SPECTRUM (1<<12) // spectrum scope targetable by VFO
#define RIG_TARGETABLE_BAND (1<<13) // Band select -- e.g. Yaeus BS command
#define RIG_TARGETABLE_COMMON (RIG_TARGETABLE_RITXIT | RIG_TARGETABLE_PTT | RIG_TARGETABLE_MEM | RIG_TARGETABLE_BANK)
#define RIG_TARGETABLE_ALL 0x7fffffff
//! @endcond
@ -695,6 +696,32 @@ typedef enum {
RIG_OP_TOGGLE = (1 << 12) /*!< \c TOGGLE -- Toggle VFOA and VFOB */
} vfo_op_t;
/**
* \brief Band enumeration
*
* Some rig commands like Yaesu band select know about bands
*
* \sa rig_set_level()
*/
typedef enum {
RIG_BAND_160M = 0, /*!< \c 160M */
RIG_BAND_80M = (1 << 1), /*!< \c 80M */
RIG_BAND_60M = (1 << 2), /*!< \c 60M */
RIG_BAND_40M = (1 << 3), /*!< \c 40M */
RIG_BAND_30M = (1 << 4), /*!< \c 30M */
RIG_BAND_20M = (1 << 5), /*!< \c 20M */
RIG_BAND_17M = (1 << 6), /*!< \c 17M */
RIG_BAND_15M = (1 << 7), /*!< \c 15M */
RIG_BAND_12M = (1 << 8), /*!< \c 12M */
RIG_BAND_10M = (1 << 9), /*!< \c 10M */
RIG_BAND_6M = (1 << 10), /*!< \c 6M */
RIG_BAND_144MHZ = (1 << 11), /*!< \c 144MHz */
RIG_BAND_430MHZ = (1 << 12), /*!< \c 430MHz */
RIG_BAND_GEN = (1 << 13), /*!< \c 60M */
RIG_BAND_MW = (1 << 14), /*!< \c Medium Wave */
RIG_BAND_AIR = (1 << 15), /*!< \c Air band */
} band_t;
/**
* \brief Rig Scan operation
@ -958,8 +985,7 @@ typedef uint64_t rig_level_e;
#define RIG_LEVEL_SPECTRUM_AVG CONSTANT_64BIT_FLAG(46) /*!< \c SPECTRUM_AVG -- Spectrum scope averaging mode, arg int (see struct rig_spectrum_avg_mode). Supported averaging modes defined in rig caps. */
#define RIG_LEVEL_SPECTRUM_ATT CONSTANT_64BIT_FLAG(47) /*!< \c SPECTRUM_ATT -- Spectrum scope attenuator, arg int (dB). Supported attenuator values defined in rig caps. */
#define RIG_LEVEL_TEMP_METER CONSTANT_64BIT_FLAG(48) /*!< \c TEMP_METER -- arg int (C, centigrade) */
#define RIG_LEVEL_48 CONSTANT_64BIT_FLAG(48) /*!< \c Future use */
#define RIG_LEVEL_49 CONSTANT_64BIT_FLAG(49) /*!< \c Future use */
#define RIG_LEVEL_BAND_SELECT CONSTANT_64BIT_FLAG(49) /*!< \c BAND_SELECT -- arg enum BAND_ENUM */
#define RIG_LEVEL_50 CONSTANT_64BIT_FLAG(50) /*!< \c Future use */
#define RIG_LEVEL_51 CONSTANT_64BIT_FLAG(51) /*!< \c Future use */
#define RIG_LEVEL_52 CONSTANT_64BIT_FLAG(52) /*!< \c Future use */

Wyświetl plik

@ -3521,6 +3521,33 @@ int newcat_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, value_t *option,
RETURNFUNC(RIG_OK);
}
static int band2rig (band_t band)
{
int retval = 0;
switch(band)
{
case RIG_BAND_160M: retval = 0;break;
case RIG_BAND_80M: retval = 1;break;
case RIG_BAND_60M: retval = 2;break;
case RIG_BAND_40M: retval = 3;break;
case RIG_BAND_30M: retval = 4;break;
case RIG_BAND_20M: retval = 5;break;
case RIG_BAND_17M: retval = 6;break;
case RIG_BAND_15M: retval = 7;break;
case RIG_BAND_12M: retval = 8;break;
case RIG_BAND_10M: retval = 9;break;
case RIG_BAND_6M: retval = 10;break;
case RIG_BAND_144MHZ: retval = 15;break;
case RIG_BAND_430MHZ: retval = 16;break;
case RIG_BAND_GEN: retval = 11;break;
case RIG_BAND_MW: retval = 12;break;
case RIG_BAND_AIR: retval = 14;break;
default:
rig_debug(RIG_DEBUG_ERR, "%s: unknown band index=%d\n", __func__, band);
break;
}
return retval;
}
int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
@ -4347,6 +4374,14 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
break;
case RIG_LEVEL_BAND_SELECT:
if (newcat_valid_command(rig, "BS"))
{
int band = band2rig((band_t)val.i);
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "BS%02d%c", band, cat_term);
}
break;
default:
RETURNFUNC(-RIG_EINVAL);
}

Wyświetl plik

@ -50,7 +50,7 @@
typedef char ncboolean;
/* shared function version */
#define NEWCAT_VER "20220122"
#define NEWCAT_VER "20220129"
/* Hopefully large enough for future use, 128 chars plus '\0' */
#define NEWCAT_DATA_LEN 129