diff --git a/rigs/barrett/4050.c b/rigs/barrett/4050.c index 19c91ece7..49aa09fec 100644 --- a/rigs/barrett/4050.c +++ b/rigs/barrett/4050.c @@ -48,19 +48,63 @@ #define BARRETT4050_FUNCTIONS (RIG_FUNC_TUNER) +/* + * barrett4050_get_level + */ static int barrett4050_get_level(RIG *rig, vfo_t vfo, setting_t level, - value_t *val); + value_t *val) +{ + return -RIG_ENIMPL; +} -static const char *barrett4050_get_info(RIG *rig); +/* + * barrett4050_get_info + */ +static const char *barrett4050_get_info(RIG *rig) +{ + char *response = NULL; + int retval; + + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + retval = barrett_transaction(rig, "IV", 0, &response); + + if (retval == RIG_OK) + { + rig_debug(RIG_DEBUG_ERR, "%s: result=%s\n", __func__, response); + } + else + { + rig_debug(RIG_DEBUG_VERBOSE, "Software Version %s\n", response); + } + + return response; +} + +static int barrett4050_open(RIG *rig) +{ + int retval; + char *response; + ENTERFUNC; + barrett4050_get_info(rig); + retval = barrett_transaction(rig, "IDFS", 0, &response); + + if (retval == RIG_OK) + { + rig_debug(RIG_DEBUG_ERR, "%s: result=%s\n", __func__, response); + } + + RETURNFUNC(RIG_OK); +} const struct rig_caps barrett4050_caps = { RIG_MODEL(RIG_MODEL_BARRETT_4050), .model_name = "4050", .mfg_name = "Barrett", - .version = BACKEND_VER ".0b", + .version = BACKEND_VER ".0c", .copyright = "LGPL", - .status = RIG_STATUS_ALPHA, + .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .targetable_vfo = RIG_TARGETABLE_FREQ | RIG_TARGETABLE_MODE, .ptt_type = RIG_PTT_RIG, @@ -74,7 +118,7 @@ const struct rig_caps barrett4050_caps = .serial_handshake = RIG_HANDSHAKE_XONXOFF, .write_delay = 0, .post_write_delay = 0, - .timeout = 1000, + .timeout = 500, .retry = 3, .has_get_func = BARRETT4050_FUNCTIONS, @@ -105,7 +149,7 @@ const struct rig_caps barrett4050_caps = .rig_init = barrett_init, .rig_cleanup = barrett_cleanup, - .rig_open = barrett_open, + .rig_open = barrett4050_open, .set_freq = barrett_set_freq, .get_freq = barrett_get_freq, @@ -122,35 +166,3 @@ const struct rig_caps barrett4050_caps = .get_split_vfo = barrett_get_split_vfo, .hamlib_check_rig_caps = "HAMLIB_CHECK_RIG_CAPS" }; - -/* - * barrett4050_get_level - */ -int barrett4050_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) -{ - return -RIG_ENIMPL; -} - -/* - * barrett4050_get_info - */ -const char *barrett4050_get_info(RIG *rig) -{ - char *response = NULL; - int retval; - - rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); - - retval = barrett_transaction(rig, "IV", 0, &response); - - if (retval == RIG_OK) - { - rig_debug(RIG_DEBUG_ERR, "%s: result=%s\n", __func__, response); - } - else - { - rig_debug(RIG_DEBUG_VERBOSE, "Software Version %s\n", response); - } - - return response; -} diff --git a/rigs/barrett/barrett.c b/rigs/barrett/barrett.c index 462aa3a2f..7de9167c1 100644 --- a/rigs/barrett/barrett.c +++ b/rigs/barrett/barrett.c @@ -277,7 +277,7 @@ int barrett_set_freq(RIG *rig, vfo_t vfo, freq_t freq) if (vfo != RIG_VFO_B) { char *response = NULL; - sprintf((char *) cmd_buf, "PR%08.0f", freq); + sprintf((char *) cmd_buf, "TC9999R%08.0f", freq); retval = barrett_transaction(rig, cmd_buf, 0, &response); if (retval < 0) @@ -299,7 +299,7 @@ int barrett_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char *response = NULL; - sprintf((char *) cmd_buf, "PT%08.0f", freq); + sprintf((char *) cmd_buf, "TC9999T%08.0f", freq); retval = barrett_transaction(rig, cmd_buf, 0, &response); if (retval < 0) diff --git a/rigs/barrett/barrett.h b/rigs/barrett/barrett.h index 24ff0a882..5d8e46609 100644 --- a/rigs/barrett/barrett.h +++ b/rigs/barrett/barrett.h @@ -28,7 +28,7 @@ #include #endif -#define BACKEND_VER "20220107" +#define BACKEND_VER "20220108" #define EOM "\x0d" #define TRUE 1 @@ -37,6 +37,8 @@ // This will need a lot more room for some channel commands like IDFA which return all channels // But that would 9999*41 or 406KB so didn't do that right now #define BARRETT_DATA_LEN 64 +// RET_LEN is # of max channels times the per-channel response length +#define BARRETT_RET_LEN 24*1000 extern const struct rig_caps barrett_caps; extern const struct rig_caps barrett950_caps; @@ -44,7 +46,7 @@ extern const struct rig_caps barrett4050_caps; struct barrett_priv_data { char cmd_str[BARRETT_DATA_LEN]; /* command string buffer */ - char ret_data[BARRETT_DATA_LEN]; /* returned data--max value, most are less */ + char ret_data[BARRETT_RET_LEN]; /* returned data--max value, most are less */ char split; /* split on/off */ };