diff --git a/yaesu/ft1200.c b/yaesu/ft1200.c index 6e54c31c4..309bdfcd3 100644 --- a/yaesu/ft1200.c +++ b/yaesu/ft1200.c @@ -163,6 +163,9 @@ const struct rig_caps ft1200_caps = { .rig_open = newcat_open, /* port opened */ .rig_close = newcat_close, /* port closed */ + .cfgparams = newcat_cfg_params, + .set_conf = newcat_set_conf, + .get_conf = newcat_get_conf, .set_freq = newcat_set_freq, .get_freq = newcat_get_freq, .set_mode = newcat_set_mode, diff --git a/yaesu/ft2000.c b/yaesu/ft2000.c index 75496429a..e3e5e75eb 100644 --- a/yaesu/ft2000.c +++ b/yaesu/ft2000.c @@ -162,6 +162,9 @@ const struct rig_caps ft2000_caps = { .rig_open = newcat_open, /* port opened */ .rig_close = newcat_close, /* port closed */ + .cfgparams = newcat_cfg_params, + .set_conf = newcat_set_conf, + .get_conf = newcat_get_conf, .set_freq = newcat_set_freq, .get_freq = newcat_get_freq, .set_mode = newcat_set_mode, @@ -204,4 +207,3 @@ const struct rig_caps ft2000_caps = { .get_channel = newcat_get_channel, }; - diff --git a/yaesu/ft450.c b/yaesu/ft450.c index 7217a3dfd..ad11220bc 100644 --- a/yaesu/ft450.c +++ b/yaesu/ft450.c @@ -160,7 +160,10 @@ const struct rig_caps ft450_caps = { .rig_cleanup = newcat_cleanup, .rig_open = newcat_open, /* port opened */ .rig_close = newcat_close, /* port closed */ - + + .cfgparams = newcat_cfg_params, + .set_conf = newcat_set_conf, + .get_conf = newcat_get_conf, .set_freq = newcat_set_freq, .get_freq = newcat_get_freq, .set_mode = newcat_set_mode, @@ -199,4 +202,3 @@ const struct rig_caps ft450_caps = { .get_channel = newcat_get_channel, }; - diff --git a/yaesu/ft5000.c b/yaesu/ft5000.c index 9af9a2386..e04ae0284 100644 --- a/yaesu/ft5000.c +++ b/yaesu/ft5000.c @@ -162,6 +162,9 @@ const struct rig_caps ftdx5000_caps = { .rig_open = newcat_open, /* port opened */ .rig_close = newcat_close, /* port closed */ + .cfgparams = newcat_cfg_params, + .set_conf = newcat_set_conf, + .get_conf = newcat_get_conf, .set_freq = newcat_set_freq, .get_freq = newcat_get_freq, .set_mode = newcat_set_mode, @@ -204,4 +207,3 @@ const struct rig_caps ftdx5000_caps = { .get_channel = newcat_get_channel, }; - diff --git a/yaesu/ft9000.c b/yaesu/ft9000.c index bdb58a2ae..1110fe6d4 100644 --- a/yaesu/ft9000.c +++ b/yaesu/ft9000.c @@ -163,6 +163,9 @@ const struct rig_caps ft9000_caps = { .rig_open = newcat_open, /* port opened */ .rig_close = newcat_close, /* port closed */ + .cfgparams = newcat_cfg_params, + .set_conf = newcat_set_conf, + .get_conf = newcat_get_conf, .set_freq = newcat_set_freq, .get_freq = newcat_get_freq, .set_mode = newcat_set_mode, @@ -205,4 +208,3 @@ const struct rig_caps ft9000_caps = { .get_channel = newcat_get_channel, }; - diff --git a/yaesu/ft950.c b/yaesu/ft950.c index b0e79206a..8767e15bb 100644 --- a/yaesu/ft950.c +++ b/yaesu/ft950.c @@ -190,6 +190,9 @@ const struct rig_caps ft950_caps = { .rig_open = newcat_open, /* port opened */ .rig_close = newcat_close, /* port closed */ + .cfgparams = newcat_cfg_params, + .set_conf = newcat_set_conf, + .get_conf = newcat_get_conf, .set_freq = newcat_set_freq, .get_freq = newcat_get_freq, .set_mode = newcat_set_mode, @@ -232,4 +235,3 @@ const struct rig_caps ft950_caps = { .get_channel = newcat_get_channel, }; - diff --git a/yaesu/ft950.h b/yaesu/ft950.h index bb6609b44..ce4ac6f84 100644 --- a/yaesu/ft950.h +++ b/yaesu/ft950.h @@ -118,6 +118,7 @@ /* Delay sequential fast writes */ -#define FT950_POST_WRITE_DELAY 5 +//#define FT950_POST_WRITE_DELAY 5 +#define FT950_POST_WRITE_DELAY 0 #endif /* _FT950_H */ diff --git a/yaesu/newcat.c b/yaesu/newcat.c index 1636c5d17..d6ec9549d 100644 --- a/yaesu/newcat.c +++ b/yaesu/newcat.c @@ -12,7 +12,7 @@ * "new" text CAT interface. * * Models this code aims to support are FTDX-9000*, FT-2000, FT-DX5000, - * FT-950, FT-450. Much testing remains. -N0NB + * FT-950, FT-450 and FT-1200. Much testing remains. -N0NB * * * This library is free software; you can redistribute it and/or @@ -214,6 +214,19 @@ static const yaesu_newcat_commands_t valid_commands[] = { }; int valid_commands_count = sizeof(valid_commands) / sizeof(yaesu_newcat_commands_t); + /* + * configuration Tokens + * + */ + +#define TOK_FAST_SET_CMD TOKEN_BACKEND(1) + +const struct confparams newcat_cfg_params[] = { + { TOK_FAST_SET_CMD, "fast_commands_token", "High troughput of commands", "Enabled high throughput of >200 messages/sec by not waiting for ACK/NAK of messages", "0", RIG_CONF_NUMERIC, { .n = { 0, 1, 1 } } + }, + { RIG_CONF_END, NULL, } +}; + /* NewCAT Internal Functions */ static ncboolean newcat_is_rig(RIG * rig, rig_model_t model); static int newcat_get_tx_vfo(RIG * rig, vfo_t * tx_vfo); @@ -235,7 +248,6 @@ static ncboolean newcat_valid_command(RIG *rig, char *command); int newcat_get_cmd(RIG * rig); int newcat_set_cmd (RIG *rig); - /* * ************************************ * @@ -272,6 +284,7 @@ int newcat_init(RIG *rig) { priv->rig_id = NC_RIGID_NONE; priv->current_mem = NC_MEM_CHANNEL_NONE; + priv->fast_set_commands = FALSE; return RIG_OK; } @@ -354,6 +367,91 @@ int newcat_close(RIG *rig) { return RIG_OK; } + +/* + * rig_set_config + * + * Set Configuration Token for Yaesu Radios + */ + +int newcat_set_conf(RIG *rig, token_t token, const char *val){ + + if (rig == NULL){ + return -RIG_EARG; + } + + int ret = RIG_OK; + struct newcat_priv_data *priv; + + priv = (struct newcat_priv_data*)rig->state.priv; + + if (priv == NULL){ + return -RIG_EINTERNAL; + } + + switch (token) { + case TOK_FAST_SET_CMD: ; + char *end; + long value; + //using strtol because atoi can lead to undefined behaviour + value = strtol(val, &end, 10); + if (end == val){ + return -RIG_EINVAL; + } + if ((value == 0) || (value == 1)){ + priv->fast_set_commands = (int)value; + } + else { + return -RIG_EINVAL; + } + break; + + default: + ret = -RIG_EINVAL; + } + + return ret; +} + + +/* + * rig_get_config + * + * Get Configuration Token for Yaesu Radios + */ + +int newcat_get_conf(RIG *rig, token_t token, char *val){ + + if (rig == NULL){ + return -RIG_EARG; + } + + int ret = RIG_OK; + struct newcat_priv_data *priv; + + priv = (struct newcat_priv_data*)rig->state.priv; + + if (priv == NULL){ + return -RIG_EINTERNAL; + } + + switch (token) { + case TOK_FAST_SET_CMD: + if (sizeof(val) < 2){ + return -RIG_ENOMEM; + } + sprintf(val, "%d", priv->fast_set_commands); + break; + default: + ret = -RIG_EINVAL; + } + + return ret; +} + + + + /* * rig_set_freq * @@ -2684,22 +2782,6 @@ int newcat_get_ext_parm(RIG *rig, token_t token, value_t *val) } -int newcat_set_conf(RIG * rig, token_t token, const char *val) -{ - rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); - - return -RIG_ENAVAIL; -} - - -int newcat_get_conf(RIG * rig, token_t token, char *val) -{ - rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); - - return -RIG_ENAVAIL; -} - - int newcat_send_dtmf(RIG * rig, vfo_t vfo, const char *digits) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -4349,6 +4431,7 @@ int newcat_set_cmd (RIG *rig) struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; int retry_count = 0; int rc = -RIG_EPROTO; + /* pick a basic quick query command for verification */ char const * const verify_cmd = RIG_MODEL_FT9000 == rig->caps->rig_model ? "AI;" : "ID;"; @@ -4362,6 +4445,11 @@ int newcat_set_cmd (RIG *rig) return rc; } + /* skip validation if high throughput is needed */ + if (priv->fast_set_commands == TRUE){ + return RIG_OK; + } + /* send the verification command */ rig_debug(RIG_DEBUG_TRACE, "cmd_str = %s\n", verify_cmd); if (RIG_OK != (rc = write_block(&state->rigport, verify_cmd, strlen(verify_cmd)))) diff --git a/yaesu/newcat.h b/yaesu/newcat.h index b0b18b75d..fadf90cc9 100644 --- a/yaesu/newcat.h +++ b/yaesu/newcat.h @@ -34,6 +34,7 @@ #define _NEWCAT_H 1 #include +#include /* Handy constants */ @@ -49,7 +50,7 @@ typedef char ncboolean; /* shared function version */ -#define NEWCAT_VER "0.22" +#define NEWCAT_VER "0.23" /* Hopefully large enough for future use, 128 chars plus '\0' */ #define NEWCAT_DATA_LEN 129 @@ -68,6 +69,8 @@ typedef char ncboolean; .ctcss_sql = 1,\ } +extern const struct confparams newcat_cfg_params[]; + /* * future - private data * @@ -85,6 +88,7 @@ struct newcat_priv_data { int width_frequency; /* width of FA/FB freq response */ int offset_rit; /* offset of rit in response */ int trn_state; /* AI state found at startup */ + int fast_set_commands; /* do not check for ACK/NAK; needed for high throughput > 100 commands/s */ }; @@ -115,7 +119,6 @@ struct newcat_priv_data { * */ - /* * newcat function definitions. * @@ -126,6 +129,9 @@ int newcat_cleanup(RIG *rig); int newcat_open(RIG *rig); int newcat_close(RIG *rig); +int newcat_set_conf(RIG *rig, token_t token, const char *val); +int newcat_get_conf(RIG *rig, token_t token, char *val); + int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int newcat_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);