diff --git a/rigs/yaesu/ft5000.c b/rigs/yaesu/ft5000.c index 06ac95eb9..70aa44df1 100644 --- a/rigs/yaesu/ft5000.c +++ b/rigs/yaesu/ft5000.c @@ -51,7 +51,7 @@ const struct newcat_priv_caps ftdx5000_priv_caps = { .index = 8, .set_value = 0, .get_value = '6', .width = 3000, .optional = 0 }, { .index = 9, .set_value = 0, .get_value = '9', .width = 600, .optional = 0 }, { .index = 10, .set_value = 0, .get_value = 'A', .width = 300, .optional = 0 }, - } + }, }; const struct confparams ftdx5000_ext_levels[] = @@ -140,11 +140,11 @@ const struct rig_caps ftdx5000_caps = RIG_MODEL(RIG_MODEL_FTDX5000), .model_name = "FTDX-5000", .mfg_name = "Yaesu", - .version = NEWCAT_VER ".8", + .version = NEWCAT_VER ".9", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, - .ptt_type = RIG_PTT_RIG, + .ptt_type = RIG_PTT_RIG_MICDATA, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, /* Default rate per manual */ diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index c5f87e376..c782afa17 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -545,6 +545,7 @@ int newcat_open(RIG *rig) struct newcat_priv_data *priv = rig->state.priv; struct rig_state *rig_s = &rig->state; const char *handshake[3] = {"None", "Xon/Xoff", "Hardware"}; + int err; ENTERFUNC; @@ -600,7 +601,6 @@ int newcat_open(RIG *rig) || priv->rig_id == NC_RIGID_FTDX3000 || priv->rig_id == NC_RIGID_FTDX3000DM) { - int err; char *cmd = "EX0291;EX029;"; // FT2000/D if (priv->rig_id == NC_RIGID_FT950 || rig->caps->rig_model == RIG_MODEL_FT950) { cmd = "EX0271;EX027;"; } @@ -631,6 +631,19 @@ int newcat_open(RIG *rig) rig_debug(RIG_DEBUG_VERBOSE, "%s: disabling FTDX3000 band select\n", __func__); } + if (is_ftdx5000) + { + // Remember EX103 status + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "EX103;"); + rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); + err = newcat_get_cmd(rig); + if (RIG_OK != (err = newcat_get_cmd(rig))) + { + RETURNFUNC(err); + } + if (priv->ret_data[6] == ';') priv->front_rear_status = priv->ret_data[5]; + } + RETURNFUNC(RIG_OK); } @@ -664,8 +677,8 @@ int newcat_close(RIG *rig) if (is_ftdx5000) { - // Ensure FT5000 is back to MIC input - SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "EX1030;"); + // Restore EX103 status + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "EX103%c;", priv->front_rear_status); rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); newcat_set_cmd(rig); // don't care about the return } @@ -1757,13 +1770,21 @@ int newcat_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) switch (ptt) { case RIG_PTT_ON_MIC: + /* Build the command string */ + // the FTDX5000 uses menu 103 for front/rear audio in USB mode + if (is_ftdx5000) + { + // Ensure FT5000 is back to MIC input + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "EX1030;"); + rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); + newcat_set_cmd(rig); // don't care about the return + } + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "%s", txon); + rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); + err = newcat_set_cmd(rig); break; case RIG_PTT_ON_DATA: - break; - - case RIG_PTT_ON: - /* Build the command string */ // the FTDX5000 uses menu 103 for front/rear audio in USB mode if (is_ftdx5000) @@ -1776,6 +1797,12 @@ int newcat_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "%s", txon); rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); err = newcat_set_cmd(rig); + break; + + case RIG_PTT_ON: + SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "%s", txon); + rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); + err = newcat_set_cmd(rig); break; diff --git a/rigs/yaesu/newcat.h b/rigs/yaesu/newcat.h index 110515457..914c535f7 100644 --- a/rigs/yaesu/newcat.h +++ b/rigs/yaesu/newcat.h @@ -128,6 +128,7 @@ struct newcat_priv_data char last_if_response[NEWCAT_DATA_LEN]; int poweron; /* to prevent powering on more than once */ int question_mark_response_means_rejected; /* the question mark response has multiple meanings */ + char front_rear_status; /* e.g. FTDX5000 EX103 status */ }; /* diff --git a/simulators/simftdx5000.c b/simulators/simftdx5000.c index 4b4352571..e8ce7d1d1 100644 --- a/simulators/simftdx5000.c +++ b/simulators/simftdx5000.c @@ -22,6 +22,7 @@ int ai = 0; int sh = 25; int na = 0; int ex039 = 0; +int ex103 = 0; // ID 0310 == 310, Must drop leading zero typedef enum nc_rigid_e @@ -316,6 +317,20 @@ int main(int argc, char *argv[]) { sscanf(buf, "EX039%d", &ex039); } + else if (strcmp(buf, "EX103;") == 0) + { + SNPRINTF(buf, sizeof(buf), "EX103%d;", ex103); + n = write(fd, buf, strlen(buf)); + } + else if (strncmp(buf, "EX103", 3) == 0) + { + sscanf(buf, "EX103%d", &ex103); + } + else if (strcmp(buf, "PS;") == 0) + { + SNPRINTF(buf, sizeof(buf), "PS1;"); + n = write(fd, buf, strlen(buf)); + } else if (strlen(buf) > 0) { fprintf(stderr, "Unknown command: %s\n", buf);