kopia lustrzana https://github.com/Hamlib/Hamlib
Porównaj commity
27 Commity
21c14da270
...
190747430f
Autor | SHA1 | Data |
---|---|---|
Mike Black W9MDB | 190747430f | |
Mike Black W9MDB | f8fd79442d | |
Mike Black W9MDB | 34f953ba0b | |
Mike Black W9MDB | 9b817f325d | |
Mike Black W9MDB | dc0fd2955d | |
Mike Black W9MDB | 89876895de | |
Mike Black W9MDB | 79c496800e | |
Mike Black W9MDB | a6951c8e14 | |
Michael Black | 2646f0fd3a | |
Mike Black W9MDB | 8280748ace | |
Mike Black W9MDB | 32ed2c4d91 | |
Mike Black W9MDB | ac054e9f75 | |
Mike Black W9MDB | 05fb4389f7 | |
Mike Black W9MDB | e25fab7d2f | |
Mike Black W9MDB | ddb0a64272 | |
Mike Black W9MDB | 47062cf812 | |
Mike Black W9MDB | 7002ca9f09 | |
Mike Black W9MDB | a7d2a5e32b | |
Mike Black W9MDB | 2709fb8ab9 | |
Mike Black W9MDB | e610d3b691 | |
Mike Black W9MDB | cb74453f06 | |
Mike Black W9MDB | 5e59a555d8 | |
Mike Black W9MDB | df78960ff1 | |
George Baltz N3GB | 8dff750285 | |
George Baltz N3GB | 9af715d244 | |
George Baltz N3GB | b38014832f | |
George Baltz N3GB | 9c7a21282c |
1
NEWS
1
NEWS
|
@ -13,6 +13,7 @@ Version 5.x -- future
|
|||
* Change FT1000MP Mark V model names to align with FT1000MP
|
||||
|
||||
Version 4.6
|
||||
* Added Barrett 4100
|
||||
* Added DL2MAN (tr)uSDX -- needs refinement
|
||||
* Added Thetis entry -- derived from FlexRadio/Apache PowerSDR
|
||||
* Added VOICE/CW memory capability to many rigs -- thanks to David Balharrie M0DGB/G8FKH
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
// Our shared secret password
|
||||
#define HAMLIB_SECRET_LENGTH 32
|
||||
|
||||
#define HAMLIB_TRACE rig_debug(RIG_DEBUG_TRACE,"%.*s%s(%d) trace\n",rig->state.depth-1, spaces(), __FILE__, __LINE__)
|
||||
#define HAMLIB_TRACE rig_debug(RIG_DEBUG_TRACE,"%s%s(%d) trace\n",spaces(rig->state.depth-1), __FILE__, __LINE__)
|
||||
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -2463,6 +2463,30 @@ typedef hamlib_port_t_deprecated port_t_deprecated;
|
|||
typedef hamlib_port_t port_t;
|
||||
#endif
|
||||
|
||||
/* Macros to access port structures/pointers
|
||||
* Make it easier to change location in preparation
|
||||
* for moving them out of rig->state.
|
||||
* See https://github.com/Hamlib/Hamlib/issues/1445
|
||||
*/
|
||||
// Note: Experimental, and subject to change!!
|
||||
#if defined(IN_HAMLIB)
|
||||
/* These are for internal use only */
|
||||
#define RIGPORT(r) (&r->state.rigport)
|
||||
#define PTTPORT(r) (&r->state.pttport)
|
||||
#define DCDPORT(r) (&r->state.dcdport)
|
||||
#else
|
||||
/* Define external unique names */
|
||||
/* These will be changed to a function call before release */
|
||||
#define HAMLIB_RIGPORT(r) (&r->state.rigport)
|
||||
#define HAMLIB_PTTPORT(r) (&r->state.pttport)
|
||||
#define HAMLIB_DCDPORT(r) (&r->state.dcdport)
|
||||
#endif
|
||||
/* Then when the rigport address is stored as a pointer somewhere else(say,
|
||||
* in the rig structure itself), the definition could be changed to
|
||||
* #define RIGPORT(r) r->somewhereelse
|
||||
* and every reference is updated.
|
||||
*/
|
||||
|
||||
#define HAMLIB_ELAPSED_GET 0
|
||||
#define HAMLIB_ELAPSED_SET 1
|
||||
#define HAMLIB_ELAPSED_INVALIDATE 2
|
||||
|
@ -3668,7 +3692,7 @@ extern HAMLIB_EXPORT_VAR(char) debugmsgsave3[DEBUGMSGSAVE_SIZE]; // last-2 debu
|
|||
|
||||
// Measuring elapsed time -- local variable inside function when macro is used
|
||||
#define ELAPSED1 struct timespec __begin; elapsed_ms(&__begin, HAMLIB_ELAPSED_SET);
|
||||
#define ELAPSED2 rig_debug(RIG_DEBUG_VERBOSE, "%.*s%d:%s: elapsed=%.0lfms\n", rig->state.depth-1, spaces(), rig->state.depth, __func__, elapsed_ms(&__begin, HAMLIB_ELAPSED_GET));
|
||||
#define ELAPSED2 rig_debug(RIG_DEBUG_VERBOSE, "%s%d:%s: elapsed=%.0lfms\n", spaces(rig->state.depth-1), rig->state.depth, __func__, elapsed_ms(&__begin, HAMLIB_ELAPSED_GET));
|
||||
|
||||
// use this instead of snprintf for automatic detection of buffer limit
|
||||
#define SNPRINTF(s,n,...) { snprintf(s,n,##__VA_ARGS__);if (strlen(s) > n-1) fprintf(stderr,"****** %s(%d): buffer overflow ******\n", __func__, __LINE__); }
|
||||
|
|
|
@ -625,6 +625,7 @@
|
|||
#define RIG_MODEL_BARRETT_2050 RIG_MAKE_MODEL(RIG_BARRETT, 1)
|
||||
#define RIG_MODEL_BARRETT_950 RIG_MAKE_MODEL(RIG_BARRETT, 2)
|
||||
#define RIG_MODEL_BARRETT_4050 RIG_MAKE_MODEL(RIG_BARRETT, 3)
|
||||
#define RIG_MODEL_BARRETT_4100 RIG_MAKE_MODEL(RIG_BARRETT, 4)
|
||||
|
||||
/*
|
||||
* Elad
|
||||
|
|
|
@ -0,0 +1,301 @@
|
|||
/*
|
||||
* Hamlib Barrett 4100 backend - main file
|
||||
* Derived from 4050 backend
|
||||
* Copyright (c) 2017-2024 by Michael Black W9MDB
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <hamlib/rig.h>
|
||||
#include "misc.h"
|
||||
|
||||
#include "barrett.h"
|
||||
|
||||
#define MAXCMDLEN 32
|
||||
|
||||
//#define BARRETT4100 VFOS (RIG_VFO_A|RIG_VFO_MEM) // VFO_MEM eventually?
|
||||
#define BARRETT4100 VFOS (RIG_VFO_A)
|
||||
|
||||
#define BARRETT4100_MODES (RIG_MODE_CW | RIG_MODE_SSB)
|
||||
|
||||
// Levels eventually
|
||||
//#define BARRETT4100_LEVELS (RIG_LEVEL_AGC|RIG_LEVEL_STRENGTH)
|
||||
|
||||
// Functions eventually
|
||||
//#define BARRETT4100_FUNCTIONS (RIG_FUNC_TUNER)
|
||||
|
||||
extern int barret950_get_freq(RIG *rig, vfo_t vfo, freq_t freq);
|
||||
|
||||
/*
|
||||
* barrett4100_get_info
|
||||
*/
|
||||
static const char *barrett4100_get_info(RIG *rig)
|
||||
{
|
||||
char *response = NULL;
|
||||
int retval;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
retval = barrett_transaction(rig, "M:MIB GM", 0, &response);
|
||||
|
||||
if (retval == RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: error=\"%s\", result=\"%s\"\n", __func__,
|
||||
strerror(retval), response);
|
||||
}
|
||||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "MIB GM: %s\n", response);
|
||||
}
|
||||
|
||||
retval = barrett_transaction(rig, "M:FF GM", 0, &response);
|
||||
|
||||
if (retval == RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: error=\"%s\", result=\"%s\"\n", __func__,
|
||||
strerror(retval), response);
|
||||
}
|
||||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "FF GM: %s\n", response);
|
||||
}
|
||||
|
||||
retval = barrett_transaction(rig, "M:FF BWA", 0, &response);
|
||||
|
||||
if (retval == RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: error=\"%s\", result=\"%s\"\n", __func__,
|
||||
strerror(retval), response);
|
||||
}
|
||||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "FF BWA: %s\n", response);
|
||||
}
|
||||
|
||||
retval = barrett_transaction(rig, "M:FF GRFA", 0, &response);
|
||||
|
||||
if (retval == RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: error=\"%s\", result=\"%s\"\n", __func__,
|
||||
strerror(retval), response);
|
||||
}
|
||||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "M:FF GRFA: %s\n", response);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
static int barrett4100_open(RIG *rig)
|
||||
{
|
||||
int retval;
|
||||
char *response;
|
||||
ENTERFUNC;
|
||||
retval = barrett_transaction2(rig, "M:REMOTE SENTER2", 0, &response);
|
||||
|
||||
if (retval != RIG_OK || response[0] != 's')
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: REMOTE SENTER2 error: got %s\n", __func__,
|
||||
response);
|
||||
}
|
||||
|
||||
barrett4100_get_info(rig);
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
static int barrett4100_close(RIG *rig)
|
||||
{
|
||||
char *response;
|
||||
int retval = barrett_transaction2(rig, "M:REMOTE SENTER0", 0, &response);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s(%d): result=%s\n", __func__, __LINE__, response);
|
||||
}
|
||||
|
||||
return rig_close(rig);
|
||||
}
|
||||
|
||||
int barrett4100_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
||||
{
|
||||
char *response;
|
||||
int retval = barrett_transaction2(rig, "M:FF SRF%.0f GRF", freq, &response);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s(%d): result=%s\n", __func__, __LINE__, response);
|
||||
}
|
||||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s(%d): result=%s\n", __func__, __LINE__, response);
|
||||
freq_t freq2 = 0;
|
||||
int n = sscanf(response, "s gRF%lf", &freq2);
|
||||
|
||||
if (n == 1)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: freq set to %.0f\n", __func__, freq2);
|
||||
}
|
||||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unable to parse s gRF\n", __func__);
|
||||
}
|
||||
}
|
||||
retval = barrett_transaction2(rig, "M:FF STF%.0f GTF", freq, &response);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s(%d): result=%s\n", __func__, __LINE__, response);
|
||||
}
|
||||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s(%d): result=%s\n", __func__, __LINE__, response);
|
||||
freq_t freq2 = 0;
|
||||
int n = sscanf(response, "s gTF%lf", &freq2);
|
||||
|
||||
if (n == 1)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: freq set to %.0f\n", __func__, freq2);
|
||||
}
|
||||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unable to parse s gTF\n", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int barrett4100_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||
{
|
||||
char *response;
|
||||
int retval = barrett_transaction2(rig, "M:FF GRF", 0, &response);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s(%d): result=%s\n", __func__, __LINE__, response);
|
||||
}
|
||||
else
|
||||
{
|
||||
sscanf(response, "gRFA1,%*d,%lf,%*d", freq);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int barrett4100_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
||||
{
|
||||
char *response;
|
||||
int retval = barrett_transaction2(rig, "M:FF SRPTT%d GRPTT", ptt, &response);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s(%d): result=%s\n", __func__, __LINE__, response);
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d); response=%s\n", __func__, __LINE__,
|
||||
response);
|
||||
return retval;
|
||||
}
|
||||
int barrett4100_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
|
||||
{
|
||||
char *response;
|
||||
int retval = barrett_transaction2(rig, "M:FF GRPTT", 0, &response);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s(%d): result=%s\n", __func__, __LINE__, response);
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d); response=%s\n", __func__, __LINE__,
|
||||
response);
|
||||
return retval;
|
||||
}
|
||||
|
||||
struct rig_caps barrett4100_caps =
|
||||
{
|
||||
RIG_MODEL(RIG_MODEL_BARRETT_4100),
|
||||
.model_name = "4100",
|
||||
.mfg_name = "Barrett",
|
||||
.version = BACKEND_VER ".0",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_ALPHA,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
.targetable_vfo = RIG_TARGETABLE_FREQ | RIG_TARGETABLE_MODE,
|
||||
.ptt_type = RIG_PTT_RIG,
|
||||
.dcd_type = RIG_DCD_NONE,
|
||||
.port_type = RIG_PORT_NETWORK,
|
||||
.serial_rate_min = 9600,
|
||||
.serial_rate_max = 115200,
|
||||
.serial_data_bits = 8,
|
||||
.serial_stop_bits = 1,
|
||||
.serial_parity = RIG_PARITY_NONE,
|
||||
.serial_handshake = RIG_HANDSHAKE_XONXOFF,
|
||||
.write_delay = 0,
|
||||
.post_write_delay = 0,
|
||||
.timeout = 500,
|
||||
.retry = 3,
|
||||
|
||||
// .has_get_func = BARRETT4100_FUNCTIONS,
|
||||
// .has_set_func = BARRETT4100_FUNCTIONS,
|
||||
// .has_get_level = BARRETT4100_LEVELS,
|
||||
.has_set_level = RIG_LEVEL_AGC,
|
||||
.has_get_parm = RIG_PARM_NONE,
|
||||
.has_set_parm = RIG_PARM_NONE,
|
||||
.transceive = RIG_TRN_RIG,
|
||||
.rx_range_list1 = {{
|
||||
.startf = kHz(10), .endf = MHz(30), .modes = BARRETT4100_MODES,
|
||||
.low_power = -1, .high_power = -1, BARRETT4100_MODES, RIG_ANT_1
|
||||
},
|
||||
RIG_FRNG_END,
|
||||
},
|
||||
.rx_range_list2 = {RIG_FRNG_END,},
|
||||
.tx_range_list1 = {RIG_FRNG_END,},
|
||||
.tx_range_list2 = {RIG_FRNG_END,},
|
||||
.tuning_steps = { {BARRETT4100_MODES, 1}, {BARRETT4100_MODES, RIG_TS_ANY}, RIG_TS_END, },
|
||||
.filters = {
|
||||
{RIG_MODE_SSB | RIG_MODE_CW | RIG_MODE_RTTY, kHz(2.4)},
|
||||
{RIG_MODE_CW, Hz(500)},
|
||||
{RIG_MODE_AM, kHz(8)},
|
||||
{RIG_MODE_AM, kHz(2.4)},
|
||||
RIG_FLT_END,
|
||||
},
|
||||
.priv = NULL,
|
||||
|
||||
.rig_init = barrett_init,
|
||||
.rig_cleanup = barrett_cleanup,
|
||||
.rig_open = barrett4100_open,
|
||||
.rig_close = barrett4100_close,
|
||||
|
||||
.set_freq = barrett4100_set_freq,
|
||||
.get_freq = barrett4100_get_freq,
|
||||
// .set_mode = barrett_set_mode,
|
||||
// .get_mode = barrett_get_mode,
|
||||
|
||||
// .set_level = barrett_set_level,
|
||||
// .get_level = barrett_get_level,
|
||||
|
||||
.get_info = barrett4100_get_info,
|
||||
.set_ptt = barrett4100_set_ptt,
|
||||
.get_ptt = barrett4100_get_ptt,
|
||||
// .set_split_freq = barrett_set_split_freq,
|
||||
// .set_split_vfo = barrett_set_split_vfo,
|
||||
// .get_split_vfo = barrett_get_split_vfo,
|
||||
.hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS
|
||||
};
|
|
@ -1,4 +1,4 @@
|
|||
BARRETTSRC = barrett.c barrett.h 950.c 4050.c
|
||||
BARRETTSRC = barrett.c barrett.h 950.c 4050.c 4100.c
|
||||
|
||||
noinst_LTLIBRARIES = libhamlib-barrett.la
|
||||
libhamlib_barrett_la_SOURCES = $(BARRETTSRC)
|
||||
|
|
|
@ -47,12 +47,32 @@ DECLARE_INITRIG_BACKEND(barrett)
|
|||
rig_register(&barrett_caps);
|
||||
rig_register(&barrett950_caps);
|
||||
rig_register(&barrett4050_caps);
|
||||
rig_register(&barrett4100_caps);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: _init back from rig_register\n", __func__);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
||||
// this version is for 4100
|
||||
int barrett_transaction2(RIG *rig, char *cmd, int expected, char **result)
|
||||
{
|
||||
char cmd_buf[MAXCMDLEN];
|
||||
struct rig_state *rs = &rig->state;
|
||||
struct barrett_priv_data *priv = rig->state.priv;
|
||||
int retval;
|
||||
|
||||
SNPRINTF(cmd_buf, sizeof(cmd_buf), "%c%s%s", 0x0a, cmd, EOM);
|
||||
retval = read_block(&rs->rigport, (unsigned char *) priv->ret_data, expected);
|
||||
|
||||
if (retval < 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s(%d): error in read_block\n", __func__, __LINE__);
|
||||
return retval;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
int barrett_transaction(RIG *rig, char *cmd, int expected, char **result)
|
||||
{
|
||||
char cmd_buf[MAXCMDLEN];
|
||||
|
@ -65,7 +85,13 @@ int barrett_transaction(RIG *rig, char *cmd, int expected, char **result)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: cmd=%s\n", __func__, cmd);
|
||||
|
||||
SNPRINTF(cmd_buf, sizeof(cmd_buf), "%s%s", cmd, EOM);
|
||||
if (rig->caps->rig_model == RIG_MODEL_BARRETT_4100)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
SNPRINTF(cmd_buf, sizeof(cmd_buf), "%s%s", cmd, EOM);
|
||||
}
|
||||
|
||||
rig_flush(&rs->rigport);
|
||||
retval = write_block(&rs->rigport, (unsigned char *) cmd_buf, strlen(cmd_buf));
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
extern struct rig_caps barrett_caps;
|
||||
extern struct rig_caps barrett950_caps;
|
||||
extern struct rig_caps barrett4050_caps;
|
||||
extern struct rig_caps barrett4100_caps;
|
||||
|
||||
struct barrett_priv_data {
|
||||
char cmd_str[BARRETT_DATA_LEN]; /* command string buffer */
|
||||
|
@ -48,6 +49,7 @@ struct barrett_priv_data {
|
|||
};
|
||||
|
||||
extern int barrett_transaction(RIG *rig, char *cmd, int expected, char **result);
|
||||
extern int barrett_transaction2(RIG *rig, char *cmd, int expected, char **result);
|
||||
|
||||
extern int barrett_init(RIG *rig);
|
||||
extern int barrett_cleanup(RIG *rig);
|
||||
|
|
|
@ -99,7 +99,7 @@ int elecraft_open(RIG *rig)
|
|||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
char *model = "Unknown";
|
||||
struct rig_state *rs = &rig->state;
|
||||
|
||||
struct hamlib_port *rp = RIGPORT(rig);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called, rig version=%s\n", __func__,
|
||||
rig->caps->version);
|
||||
|
@ -135,7 +135,7 @@ int elecraft_open(RIG *rig)
|
|||
|
||||
strcpy(data, "EMPTY");
|
||||
// Not going to get carried away with retries and such
|
||||
err = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
|
||||
err = write_block(rp, (unsigned char *) cmd, strlen(cmd));
|
||||
|
||||
if (err != RIG_OK)
|
||||
{
|
||||
|
@ -143,7 +143,7 @@ int elecraft_open(RIG *rig)
|
|||
return err;
|
||||
}
|
||||
|
||||
err = read_string(&rs->rigport, (unsigned char *) buf, sizeof(buf),
|
||||
err = read_string(rp, (unsigned char *) buf, sizeof(buf),
|
||||
";", 1, 0, 1);
|
||||
|
||||
if (err < 0)
|
||||
|
|
|
@ -74,7 +74,7 @@ int ic10_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
|
|||
{
|
||||
int retval;
|
||||
int retry_cmd = 0;
|
||||
struct rig_state *rs;
|
||||
struct hamlib_port *rp = RIGPORT(rig);
|
||||
|
||||
if (cmd == NULL)
|
||||
{
|
||||
|
@ -86,12 +86,10 @@ int ic10_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
|
|||
"%s: called cmd='%s', len=%d, data=%p, data_len=%p\n", __func__, cmd, cmd_len,
|
||||
data, data_len);
|
||||
|
||||
rs = &rig->state;
|
||||
|
||||
transaction:
|
||||
rig_flush(&rs->rigport);
|
||||
rig_flush(rp);
|
||||
|
||||
retval = write_block(&rs->rigport, (unsigned char *) cmd, cmd_len);
|
||||
retval = write_block(rp, (unsigned char *) cmd, cmd_len);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
|
@ -103,18 +101,18 @@ transaction:
|
|||
char buffer[50];
|
||||
const struct kenwood_priv_data *priv = rig->state.priv;
|
||||
|
||||
if (RIG_OK != (retval = write_block(&rs->rigport,
|
||||
if (RIG_OK != (retval = write_block(rp,
|
||||
(unsigned char *) priv->verify_cmd, strlen(priv->verify_cmd))))
|
||||
{
|
||||
return retval;
|
||||
}
|
||||
|
||||
// this should be the ID response
|
||||
retval = read_string(&rs->rigport, (unsigned char *) buffer, sizeof(buffer),
|
||||
retval = read_string(rp, (unsigned char *) buffer, sizeof(buffer),
|
||||
";", 1, 0, 1);
|
||||
|
||||
// might be ?; too
|
||||
if (buffer[0] == '?' && retry_cmd++ < rs->rigport.retry)
|
||||
if (buffer[0] == '?' && retry_cmd++ < rp->retry)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: retrying cmd #%d\n", __func__, retry_cmd);
|
||||
goto transaction;
|
||||
|
@ -130,7 +128,7 @@ transaction:
|
|||
return RIG_OK;
|
||||
}
|
||||
|
||||
retval = read_string(&rs->rigport, (unsigned char *) data, 50, ";", 1, 0, 1);
|
||||
retval = read_string(rp, (unsigned char *) data, 50, ";", 1, 0, 1);
|
||||
|
||||
if (retval == -RIG_ETIMEOUT)
|
||||
{
|
||||
|
@ -158,7 +156,7 @@ static int get_ic10_if(RIG *rig, char *data)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
|
||||
|
||||
for (i = 0; retval != RIG_OK && i < rig->state.rigport.retry; i++)
|
||||
for (i = 0; retval != RIG_OK && i < RIGPORT(rig)->retry; i++)
|
||||
{
|
||||
data_len = 37;
|
||||
retval = ic10_transaction(rig, "IF;", 3, data, &data_len);
|
||||
|
|
|
@ -245,6 +245,7 @@ int kenwood_transaction(RIG *rig, const char *cmdstr, char *data,
|
|||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
struct kenwood_priv_caps *caps = kenwood_caps(rig);
|
||||
struct rig_state *rs;
|
||||
struct hamlib_port *rp; /* Pointer to rigport structure */
|
||||
|
||||
if (datasize > 0 && datasize < (cmdstr ? strlen(cmdstr) : 0))
|
||||
{
|
||||
|
@ -265,11 +266,12 @@ int kenwood_transaction(RIG *rig, const char *cmdstr, char *data,
|
|||
}
|
||||
|
||||
rs = &rig->state;
|
||||
rp = RIGPORT(rig);
|
||||
|
||||
rs->transaction_active = 1;
|
||||
|
||||
/* Emulators don't need any post_write_delay */
|
||||
if (priv->is_emulation) { rs->rigport.post_write_delay = 0; }
|
||||
if (priv->is_emulation) { rp->post_write_delay = 0; }
|
||||
|
||||
// if this is an IF cmdstr and not the first time through check cache
|
||||
if (cmdstr && strcmp(cmdstr, "IF") == 0 && priv->cache_start.tv_sec != 0)
|
||||
|
@ -328,9 +330,9 @@ transaction_write:
|
|||
}
|
||||
|
||||
/* flush anything in the read buffer before command is sent */
|
||||
rig_flush(&rs->rigport);
|
||||
rig_flush(rp);
|
||||
|
||||
retval = write_block(&rs->rigport, (unsigned char *) cmd, len);
|
||||
retval = write_block(rp, (unsigned char *) cmd, len);
|
||||
|
||||
free(cmd);
|
||||
|
||||
|
@ -382,7 +384,7 @@ transaction_write:
|
|||
/* no reply expected so we need to write a command that always
|
||||
gives a reply so we can read any error replies from the actual
|
||||
command being sent without blocking */
|
||||
if (RIG_OK != (retval = write_block(&rs->rigport,
|
||||
if (RIG_OK != (retval = write_block(rp,
|
||||
(unsigned char *) priv->verify_cmd, strlen(priv->verify_cmd))))
|
||||
{
|
||||
goto transaction_quit;
|
||||
|
@ -396,7 +398,7 @@ transaction_read:
|
|||
// eventually we should be able to get rid of this but requires testing all Kenwood rigs
|
||||
len = min(datasize ? datasize + 1 : strlen(priv->verify_cmd) + 48,
|
||||
KENWOOD_MAX_BUF_LEN);
|
||||
retval = read_string(&rs->rigport, (unsigned char *) buffer, len,
|
||||
retval = read_string(rp, (unsigned char *) buffer, len,
|
||||
cmdtrm_str, strlen(cmdtrm_str), 0, 1);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: read_string len=%d '%s'\n", __func__,
|
||||
(int)strlen(buffer), buffer);
|
||||
|
@ -404,12 +406,12 @@ transaction_read:
|
|||
if (retval < 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_WARN,
|
||||
"%s: read_string retval < 0, retval = %d, retry_read=%d, rs->rigport.retry=%d\n",
|
||||
"%s: read_string retval < 0, retval = %d, retry_read=%d, rp->retry=%d\n",
|
||||
__func__,
|
||||
retval, retry_read, rs->rigport.retry);
|
||||
retval, retry_read, rp->retry);
|
||||
|
||||
// only retry if we expect a response from the command
|
||||
if (retry_read++ < rs->rigport.retry)
|
||||
if (retry_read++ < rp->retry)
|
||||
{
|
||||
goto transaction_write;
|
||||
// we use to not re-do the write
|
||||
|
@ -439,7 +441,7 @@ transaction_read:
|
|||
rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n",
|
||||
__func__, buffer);
|
||||
|
||||
if (retry_read++ < rs->rigport.retry)
|
||||
if (retry_read++ < rp->retry)
|
||||
{
|
||||
goto transaction_write;
|
||||
}
|
||||
|
@ -471,7 +473,7 @@ transaction_read:
|
|||
rig_debug(RIG_DEBUG_VERBOSE, "%s: Overflow for '%s'\n", __func__, cmdstr);
|
||||
}
|
||||
|
||||
if (retry_read++ < rs->rigport.retry)
|
||||
if (retry_read++ < rp->retry)
|
||||
{
|
||||
goto transaction_write;
|
||||
}
|
||||
|
@ -488,7 +490,7 @@ transaction_read:
|
|||
cmdstr);
|
||||
}
|
||||
|
||||
if (retry_read++ < rs->rigport.retry)
|
||||
if (retry_read++ < rp->retry)
|
||||
{
|
||||
goto transaction_write;
|
||||
}
|
||||
|
@ -531,10 +533,10 @@ transaction_read:
|
|||
}
|
||||
}
|
||||
|
||||
if (retry_read++ < rs->rigport.retry)
|
||||
if (retry_read++ < rp->retry)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Retrying shortly %d of %d\n", __func__,
|
||||
retry_read, rs->rigport.retry);
|
||||
retry_read, rp->retry);
|
||||
hl_usleep(rig->caps->timeout * 1000);
|
||||
goto transaction_write;
|
||||
}
|
||||
|
@ -564,10 +566,10 @@ transaction_read:
|
|||
rig_debug(RIG_DEBUG_ERR, "%s: wrong reply %c%c for command %c%c\n",
|
||||
__func__, buffer[0], buffer[1], cmdstr[0], cmdstr[1]);
|
||||
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: retry_read=%d, rs->rigport.retry=%d\n", __func__,
|
||||
retry_read, rs->rigport.retry);
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: retry_read=%d, rp->retry=%d\n", __func__,
|
||||
retry_read, rp->retry);
|
||||
|
||||
if (retry_read++ < rs->rigport.retry)
|
||||
if (retry_read++ < rp->retry)
|
||||
{
|
||||
if (strlen(buffer) == 0)
|
||||
{
|
||||
|
@ -640,7 +642,7 @@ transaction_read:
|
|||
__func__, buffer[0], buffer[1]
|
||||
, priv->verify_cmd[0], priv->verify_cmd[1]);
|
||||
|
||||
if (retry_read++ < rs->rigport.retry)
|
||||
if (retry_read++ < rp->retry)
|
||||
{
|
||||
goto transaction_write;
|
||||
}
|
||||
|
@ -740,7 +742,7 @@ int kenwood_safe_transaction(RIG *rig, const char *cmd, char *buf,
|
|||
hl_usleep(50 * 1000); // let's do a short wait
|
||||
}
|
||||
}
|
||||
while (err != RIG_OK && ++retry < rig->state.rigport.retry);
|
||||
while (err != RIG_OK && ++retry < RIGPORT(rig)->retry);
|
||||
|
||||
RETURNFUNC2(err);
|
||||
}
|
||||
|
@ -869,12 +871,12 @@ int kenwood_open(RIG *rig)
|
|||
int err, i;
|
||||
char *idptr;
|
||||
char id[KENWOOD_MAX_BUF_LEN];
|
||||
int retry_save = rig->state.rigport.retry;
|
||||
int retry_save = RIGPORT(rig)->retry;
|
||||
|
||||
ENTERFUNC;
|
||||
|
||||
id[0] = 0;
|
||||
rig->state.rigport.retry = 0;
|
||||
RIGPORT(rig)->retry = 0;
|
||||
|
||||
priv->question_mark_response_means_rejected = 0;
|
||||
|
||||
|
@ -946,7 +948,7 @@ int kenwood_open(RIG *rig)
|
|||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: cannot get f/w version, defaulting to 1.0\n",
|
||||
__func__);
|
||||
rig->state.rigport.retry = retry_save;
|
||||
RIGPORT(rig)->retry = retry_save;
|
||||
priv->fw_rev_uint = 100;
|
||||
}
|
||||
else
|
||||
|
@ -964,7 +966,7 @@ int kenwood_open(RIG *rig)
|
|||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: cannot get f/w version\n", __func__);
|
||||
rig->state.rigport.retry = retry_save;
|
||||
RIGPORT(rig)->retry = retry_save;
|
||||
RETURNFUNC(-RIG_EPROTO);
|
||||
}
|
||||
}
|
||||
|
@ -983,7 +985,7 @@ int kenwood_open(RIG *rig)
|
|||
if (RIG_OK != err)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: no response from rig\n", __func__);
|
||||
rig->state.rigport.retry = retry_save;
|
||||
RIGPORT(rig)->retry = retry_save;
|
||||
RETURNFUNC(err);
|
||||
}
|
||||
|
||||
|
@ -1000,7 +1002,7 @@ int kenwood_open(RIG *rig)
|
|||
if (err != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: cannot get identification\n", __func__);
|
||||
rig->state.rigport.retry = retry_save;
|
||||
RIGPORT(rig)->retry = retry_save;
|
||||
RETURNFUNC(err);
|
||||
}
|
||||
}
|
||||
|
@ -1087,7 +1089,7 @@ int kenwood_open(RIG *rig)
|
|||
rig_strvfo(priv->tx_vfo));
|
||||
}
|
||||
|
||||
rig->state.rigport.retry = retry_save;
|
||||
RIGPORT(rig)->retry = retry_save;
|
||||
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
@ -1108,7 +1110,7 @@ int kenwood_open(RIG *rig)
|
|||
|
||||
// we're making this non fatal
|
||||
// mismatched IDs can still be tested
|
||||
rig->state.rigport.retry = retry_save;
|
||||
RIGPORT(rig)->retry = retry_save;
|
||||
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
@ -2866,15 +2868,15 @@ static int kenwood_get_micgain_minmax(RIG *rig, int *micgain_now,
|
|||
// we batch these commands together for speed
|
||||
char *cmd = "MG;MG000;MG;MG255;MG;MG000;";
|
||||
int n;
|
||||
struct rig_state *rs = &rig->state;
|
||||
struct hamlib_port *rp = RIGPORT(rig);
|
||||
|
||||
ENTERFUNC;
|
||||
|
||||
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
|
||||
retval = write_block(rp, (unsigned char *) cmd, strlen(cmd));
|
||||
|
||||
if (retval != RIG_OK) { RETURNFUNC(retval); }
|
||||
|
||||
retval = read_string(&rs->rigport, (unsigned char *) levelbuf, sizeof(levelbuf),
|
||||
retval = read_string(rp, (unsigned char *) levelbuf, sizeof(levelbuf),
|
||||
NULL, 0, 1, 1);
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: retval=%d\n", __func__, retval);
|
||||
|
@ -2928,6 +2930,7 @@ static int kenwood_get_power_minmax(RIG *rig, int *power_now, int *power_min,
|
|||
char *cmd;
|
||||
int n;
|
||||
struct rig_state *rs = &rig->state;
|
||||
struct hamlib_port *rp = RIGPORT(rig);
|
||||
|
||||
ENTERFUNC;
|
||||
|
||||
|
@ -2940,16 +2943,16 @@ static int kenwood_get_power_minmax(RIG *rig, int *power_now, int *power_min,
|
|||
// TS890S can't take power levels outside 5-100 and 5-25
|
||||
// So all we'll do is read power_now
|
||||
case RIG_MODEL_TS890S:
|
||||
rig->state.power_min = *power_min = 5;
|
||||
rig->state.power_max = *power_max = 100;
|
||||
rs->power_min = *power_min = 5;
|
||||
rs->power_max = *power_max = 100;
|
||||
|
||||
if (rig->state.current_mode == RIG_MODE_AM) { *power_max = 50; }
|
||||
if (rs->current_mode == RIG_MODE_AM) { *power_max = 50; }
|
||||
|
||||
if (rig->state.current_freq >= 70)
|
||||
if (rs->current_freq >= 70)
|
||||
{
|
||||
rig->state.power_max = 50;
|
||||
rs->power_max = 50;
|
||||
|
||||
if (rig->state.current_mode == RIG_MODE_AM) { *power_max = 13; }
|
||||
if (rs->current_mode == RIG_MODE_AM) { *power_max = 13; }
|
||||
}
|
||||
|
||||
|
||||
|
@ -2961,18 +2964,18 @@ static int kenwood_get_power_minmax(RIG *rig, int *power_now, int *power_min,
|
|||
}
|
||||
|
||||
// Don't do this if PTT is on...don't want to max out power!!
|
||||
if (rig->state.cache.ptt == RIG_PTT_ON)
|
||||
if (rs->cache.ptt == RIG_PTT_ON)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: ptt on so not checking min/max power levels\n",
|
||||
__func__);
|
||||
// return the last values we got
|
||||
*power_now = rig->state.power_now;
|
||||
*power_min = rig->state.power_min;
|
||||
*power_max = rig->state.power_max;
|
||||
*power_now = rs->power_now;
|
||||
*power_min = rs->power_min;
|
||||
*power_max = rs->power_max;
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
|
||||
retval = write_block(rp, (unsigned char *) cmd, strlen(cmd));
|
||||
|
||||
if (retval != RIG_OK) { RETURNFUNC(retval); }
|
||||
|
||||
|
@ -2985,7 +2988,7 @@ static int kenwood_get_power_minmax(RIG *rig, int *power_now, int *power_min,
|
|||
expected_length = 18;
|
||||
}
|
||||
|
||||
retval = read_string(&rs->rigport, (unsigned char *) levelbuf,
|
||||
retval = read_string(rp, (unsigned char *) levelbuf,
|
||||
expected_length + 1,
|
||||
NULL, 0, 0, 1);
|
||||
|
||||
|
@ -3033,9 +3036,9 @@ static int kenwood_get_power_minmax(RIG *rig, int *power_now, int *power_min,
|
|||
rig_debug(RIG_DEBUG_TRACE, "%s: returning now=%d, min=%d, max=%d\n", __func__,
|
||||
*power_now, *power_min, *power_max);
|
||||
|
||||
rig->state.power_now = *power_now;
|
||||
rig->state.power_min = *power_min;
|
||||
rig->state.power_max = *power_max;
|
||||
rs->power_now = *power_now;
|
||||
rs->power_min = *power_min;
|
||||
rs->power_max = *power_max;
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
||||
|
@ -3780,8 +3783,8 @@ int kenwood_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
// This could be done by rig but easy enough to make it automagic
|
||||
if (priv->ag_format < 0)
|
||||
{
|
||||
int retry_save = rig->state.rigport.retry;
|
||||
rig->state.rigport.retry = 0; // speed up this check so no retries
|
||||
int retry_save = RIGPORT(rig)->retry;
|
||||
RIGPORT(rig)->retry = 0; // speed up this check so no retries
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: AF format check determination...\n", __func__);
|
||||
// Determine AG format
|
||||
// =-1 == Undetermine
|
||||
|
@ -3819,7 +3822,7 @@ int kenwood_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
}
|
||||
}
|
||||
|
||||
rig->state.rigport.retry = retry_save;
|
||||
RIGPORT(rig)->retry = retry_save;
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: ag_format=%d\n", __func__, priv->ag_format);
|
||||
|
@ -5090,7 +5093,7 @@ int kenwood_get_trn(RIG *rig, int *trn)
|
|||
int kenwood_set_powerstat(RIG *rig, powerstat_t status)
|
||||
{
|
||||
int retval;
|
||||
struct rig_state *state = &rig->state;
|
||||
struct hamlib_port *rp = RIGPORT(rig);
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
|
||||
if ((priv->is_k3 || priv->is_k3s) && status == RIG_POWER_ON)
|
||||
|
@ -5101,7 +5104,7 @@ int kenwood_set_powerstat(RIG *rig, powerstat_t status)
|
|||
}
|
||||
|
||||
int i = 0;
|
||||
int retry_save = rig->state.rigport.retry;
|
||||
int retry_save = rp->retry;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called status=%d\n", __func__, status);
|
||||
|
||||
|
@ -5109,11 +5112,11 @@ int kenwood_set_powerstat(RIG *rig, powerstat_t status)
|
|||
{
|
||||
// When powering on a Kenwood rig needs dummy bytes to wake it up,
|
||||
// then wait at least 200ms and within 2 seconds issue the power-on command again
|
||||
write_block(&state->rigport, (unsigned char *) "PS1;", 4);
|
||||
write_block(rp, (unsigned char *) "PS1;", 4);
|
||||
hl_usleep(500000);
|
||||
}
|
||||
|
||||
rig->state.rigport.retry = 0;
|
||||
rp->retry = 0;
|
||||
|
||||
retval = kenwood_transaction(rig,
|
||||
(status == RIG_POWER_ON) ? "PS1;" : "PS0;",
|
||||
|
@ -5129,7 +5132,7 @@ int kenwood_set_powerstat(RIG *rig, powerstat_t status)
|
|||
|
||||
if (retval == RIG_OK)
|
||||
{
|
||||
rig->state.rigport.retry = retry_save;
|
||||
rp->retry = retry_save;
|
||||
RETURNFUNC2(retval);
|
||||
}
|
||||
|
||||
|
@ -5137,7 +5140,7 @@ int kenwood_set_powerstat(RIG *rig, powerstat_t status)
|
|||
}
|
||||
}
|
||||
|
||||
rig->state.rigport.retry = retry_save;
|
||||
rp->retry = retry_save;
|
||||
|
||||
if (i == 9)
|
||||
{
|
||||
|
@ -5157,7 +5160,7 @@ int kenwood_get_powerstat(RIG *rig, powerstat_t *status)
|
|||
{
|
||||
char pwrbuf[6];
|
||||
int result;
|
||||
struct rig_state *state = &rig->state;
|
||||
struct hamlib_port *rp = RIGPORT(rig);
|
||||
struct kenwood_priv_data *priv = rig->state.priv;
|
||||
|
||||
ENTERFUNC;
|
||||
|
@ -5183,19 +5186,19 @@ int kenwood_get_powerstat(RIG *rig, powerstat_t *status)
|
|||
short timeout_retry_save;
|
||||
int timeout_save;
|
||||
|
||||
retry_save = state->rigport.retry;
|
||||
timeout_retry_save = state->rigport.timeout_retry;
|
||||
timeout_save = state->rigport.timeout;
|
||||
retry_save = rp->retry;
|
||||
timeout_retry_save = rp->timeout_retry;
|
||||
timeout_save = rp->timeout;
|
||||
|
||||
state->rigport.retry = 0;
|
||||
state->rigport.timeout_retry = 0;
|
||||
state->rigport.timeout = 500;
|
||||
rp->retry = 0;
|
||||
rp->timeout_retry = 0;
|
||||
rp->timeout = 500;
|
||||
|
||||
result = kenwood_safe_transaction(rig, "PS", pwrbuf, 6, 3);
|
||||
|
||||
state->rigport.retry = retry_save;
|
||||
state->rigport.timeout_retry = timeout_retry_save;
|
||||
state->rigport.timeout = timeout_save;
|
||||
rp->retry = retry_save;
|
||||
rp->timeout_retry = timeout_retry_save;
|
||||
rp->timeout = timeout_save;
|
||||
|
||||
// Rig may respond here already
|
||||
if (result == RIG_OK)
|
||||
|
@ -5222,7 +5225,7 @@ int kenwood_get_powerstat(RIG *rig, powerstat_t *status)
|
|||
// after waiting for at least 200ms and within 2 seconds after dummy data
|
||||
hl_usleep(500000);
|
||||
// Discard any unsolicited data
|
||||
rig_flush(&rig->state.rigport);
|
||||
rig_flush(rp);
|
||||
|
||||
result = kenwood_safe_transaction(rig, "PS", pwrbuf, 6, 3);
|
||||
|
||||
|
|
|
@ -1456,7 +1456,7 @@ static int thd72_get_channel(RIG *rig, vfo_t vfo, channel_t *chan,
|
|||
|
||||
static int thd72_get_block(RIG *rig, int block_num, char *block)
|
||||
{
|
||||
hamlib_port_t *rp = &rig->state.rigport;
|
||||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
char cmd[CMD_SZ] = "R\0\0\0\0";
|
||||
char resp[CMD_SZ];
|
||||
int ret;
|
||||
|
@ -1518,7 +1518,7 @@ static int thd72_get_block(RIG *rig, int block_num, char *block)
|
|||
int thd72_get_chan_all_cb(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg)
|
||||
{
|
||||
int i, j, ret;
|
||||
hamlib_port_t *rp = &rig->state.rigport;
|
||||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
channel_t *chan;
|
||||
chan_t *chan_list = rig->state.chan_list;
|
||||
int chan_next = chan_list[0].start;
|
||||
|
|
|
@ -1448,7 +1448,7 @@ int thd74_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
|||
|
||||
static int thd74_get_block(RIG *rig, int block_num, char *block)
|
||||
{
|
||||
hamlib_port_t *rp = &rig->state.rigport;
|
||||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
char cmd[CMD_SZ] = "R\0\0\0\0";
|
||||
char resp[CMD_SZ];
|
||||
int ret;
|
||||
|
@ -1510,7 +1510,7 @@ static int thd74_get_block(RIG *rig, int block_num, char *block)
|
|||
int thd74_get_chan_all_cb(RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg)
|
||||
{
|
||||
int i, j, ret;
|
||||
hamlib_port_t *rp = &rig->state.rigport;
|
||||
hamlib_port_t *rp = RIGPORT(rig);
|
||||
channel_t *chan;
|
||||
chan_t *chan_list = rig->state.chan_list;
|
||||
int chan_next = chan_list[0].start;
|
||||
|
|
|
@ -519,7 +519,7 @@ static int ts2000_read_meter(RIG *rig, int expected_meter, int *value)
|
|||
{
|
||||
int retval;
|
||||
char cmdbuf[8];
|
||||
struct rig_state *rs = &rig->state;
|
||||
struct hamlib_port *rp = RIGPORT(rig);
|
||||
char ackbuf[32];
|
||||
int expected_len = 8;
|
||||
int read_meter;
|
||||
|
@ -529,7 +529,7 @@ static int ts2000_read_meter(RIG *rig, int expected_meter, int *value)
|
|||
|
||||
SNPRINTF(cmdbuf, sizeof(cmdbuf), "RM;");
|
||||
|
||||
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
|
||||
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: write_block retval=%d\n", __func__, retval);
|
||||
|
||||
|
@ -540,7 +540,7 @@ static int ts2000_read_meter(RIG *rig, int expected_meter, int *value)
|
|||
|
||||
// TS-2000 returns values for a single meter at the same time, for example: RM10000;
|
||||
|
||||
retval = read_string(&rs->rigport, (unsigned char *) ackbuf, expected_len + 1,
|
||||
retval = read_string(rp, (unsigned char *) ackbuf, expected_len + 1,
|
||||
NULL, 0, 0, 1);
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: read_string retval=%d\n", __func__, retval);
|
||||
|
|
|
@ -85,9 +85,9 @@ int ts450_open(RIG *rig)
|
|||
return err;
|
||||
}
|
||||
|
||||
maxtries = rig->state.rigport.retry;
|
||||
maxtries = RIGPORT(rig)->retry;
|
||||
/* no retry for this command that may be missing */
|
||||
rig->state.rigport.retry = 0;
|
||||
RIGPORT(rig)->retry = 0;
|
||||
|
||||
err = kenwood_simple_transaction(rig, "TO", 3);
|
||||
|
||||
|
@ -98,7 +98,7 @@ int ts450_open(RIG *rig)
|
|||
rig->state.has_get_func &= ~RIG_FUNC_TONE;
|
||||
}
|
||||
|
||||
rig->state.rigport.retry = maxtries;
|
||||
RIGPORT(rig)->retry = maxtries;
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -429,13 +429,13 @@ static int ts480_read_meters(RIG *rig, int *swr, int *comp, int *alc)
|
|||
{
|
||||
int retval;
|
||||
char *cmd = "RM;";
|
||||
struct rig_state *rs = &rig->state;
|
||||
struct hamlib_port *rp = RIGPORT(rig);
|
||||
char ackbuf[32];
|
||||
int expected_len = 24;
|
||||
|
||||
ENTERFUNC;
|
||||
|
||||
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
|
||||
retval = write_block(rp, (unsigned char *) cmd, strlen(cmd));
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: write_block retval=%d\n", __func__, retval);
|
||||
|
||||
|
@ -446,7 +446,7 @@ static int ts480_read_meters(RIG *rig, int *swr, int *comp, int *alc)
|
|||
|
||||
// TS-480 returns values for all meters at the same time, for example: RM10000;RM20000;RM30000;
|
||||
|
||||
retval = read_string(&rs->rigport, (unsigned char *) ackbuf, expected_len + 1,
|
||||
retval = read_string(rp, (unsigned char *) ackbuf, expected_len + 1,
|
||||
NULL, 0, 0, 1);
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: read_string retval=%d\n", __func__, retval);
|
||||
|
|
|
@ -218,6 +218,8 @@ static int ts590_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
char kmode = rmode2kenwood(mode, caps->mode_table);
|
||||
char cmd[32], c;
|
||||
int retval = -RIG_EINTERNAL;
|
||||
int hwidth = 0;
|
||||
// int lwidth; // not implemented yet until new API is created
|
||||
|
||||
if (kmode < 0)
|
||||
{
|
||||
|
@ -248,6 +250,70 @@ static int ts590_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
return kenwood_set_mode(rig, vfo, mode, width);
|
||||
}
|
||||
|
||||
if (mode == RIG_MODE_CW || mode == RIG_MODE_CWR)
|
||||
{
|
||||
const int cw_table[] = { 50, 80, 100, 150, 200, 250, 300, 400, 500, 600, 1000, 1500, 2000, 2500 };
|
||||
int twidth = 2500; // maximum
|
||||
|
||||
for (int i = 0; i < sizeof(cw_table) / sizeof(int); ++i)
|
||||
{
|
||||
if (cw_table[i] >= width) { twidth = cw_table[i]; break; }
|
||||
}
|
||||
|
||||
SNPRINTF(cmd, sizeof(cmd), "FW%04d;", twidth);
|
||||
retval = kenwood_transaction(rig, cmd, NULL, 0);
|
||||
return retval;
|
||||
}
|
||||
else if (mode == RIG_MODE_RTTY || mode == RIG_MODE_RTTYR)
|
||||
{
|
||||
const int cw_table[] = { 250, 500, 1000, 1500 };
|
||||
int twidth = 1500; // maximum
|
||||
|
||||
for (int i = 0; i < sizeof(cw_table) / sizeof(int); ++i)
|
||||
{
|
||||
if (cw_table[i] >= width) { twidth = cw_table[i]; break; }
|
||||
}
|
||||
|
||||
SNPRINTF(cmd, sizeof(cmd), "FW%04d;", twidth);
|
||||
retval = kenwood_transaction(rig, cmd, NULL, 0);
|
||||
return retval;
|
||||
}
|
||||
else if (mode == RIG_MODE_PKTUSB || mode == RIG_MODE_PKTLSB)
|
||||
{
|
||||
const int pkt_htable[] = { 1000, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600, 2800, 3000, 3400, 4000, 5000 };
|
||||
|
||||
// not setting SL since no API for it yet
|
||||
// we will just set SH based on requested bandwidth not taking SL into account
|
||||
//const int ssb_ltable[] = { 0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
|
||||
for (int i = 0; i < sizeof(pkt_htable) / sizeof(int); ++i)
|
||||
{
|
||||
if (pkt_htable[i] >= width) { hwidth = i; break; }
|
||||
}
|
||||
}
|
||||
else if (mode == RIG_MODE_AM || mode == RIG_MODE_PKTAM)
|
||||
{
|
||||
const int am_htable[] = { 2500, 3000, 4000, 5000 };
|
||||
|
||||
//const int am_ltable[] = { 0, 100, 200, 300 };
|
||||
for (int i = 0; i < sizeof(am_htable) / sizeof(int); ++i)
|
||||
{
|
||||
if (am_htable[i] >= width) { hwidth = i; break; }
|
||||
}
|
||||
}
|
||||
else if (mode == RIG_MODE_SSB || mode == RIG_MODE_LSB || mode == RIG_MODE_USB)
|
||||
{
|
||||
const int ssb_htable[] = { 1000, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600, 2800, 3000, 3400, 4000, 5000 };
|
||||
|
||||
//const int ssb_ltable[] = { 0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
|
||||
for (int i = 0; i < sizeof(ssb_htable) / sizeof(int); ++i)
|
||||
{
|
||||
if (ssb_htable[i] >= width) { hwidth = i; break; }
|
||||
}
|
||||
}
|
||||
|
||||
SNPRINTF(cmd, sizeof(cmd), "SH%02d;", hwidth);
|
||||
retval = kenwood_transaction(rig, cmd, NULL, 0);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -284,6 +350,23 @@ static int ts590_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
*mode = kenwood2rmode(*mode, caps->mode_table);
|
||||
|
||||
// now let's get our widths
|
||||
// CW is different then other modes
|
||||
if (*mode == RIG_MODE_CW || *mode == RIG_MODE_CWR || *mode == RIG_MODE_RTTY
|
||||
|| *mode == RIG_MODE_RTTYR)
|
||||
{
|
||||
SNPRINTF(cmd, sizeof(cmd), "FW");
|
||||
retval = kenwood_safe_transaction(rig, cmd, ackbuf, sizeof(ackbuf), 6);
|
||||
|
||||
if (retval == RIG_OK)
|
||||
{
|
||||
int twidth;
|
||||
sscanf(ackbuf, "FW%d", &twidth);
|
||||
*width = twidth;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
SNPRINTF(cmd, sizeof(cmd), "SH");
|
||||
retval = kenwood_safe_transaction(rig, cmd, ackbuf, sizeof(ackbuf), 4);
|
||||
|
||||
|
@ -295,12 +378,12 @@ static int ts590_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
}
|
||||
|
||||
int hwidth;
|
||||
sscanf(cmd, "SH%d", &hwidth);
|
||||
sscanf(ackbuf, "SH%d", &hwidth);
|
||||
int lwidth;
|
||||
int shift = 0;
|
||||
SNPRINTF(cmd, sizeof(cmd), "SL");
|
||||
sscanf(cmd, "SH%d", &lwidth);
|
||||
retval = kenwood_safe_transaction(rig, cmd, ackbuf, sizeof(ackbuf), 4);
|
||||
sscanf(ackbuf, "SL%d", &lwidth);
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
|
@ -309,9 +392,7 @@ static int ts590_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
return retval;
|
||||
}
|
||||
|
||||
if (*mode == RIG_MODE_PKTUSB || *mode == RIG_MODE_PKTLSB
|
||||
|| *mode == RIG_MODE_FM || *mode == RIG_MODE_PKTFM || *mode == RIG_MODE_USB
|
||||
|| *mode == RIG_MODE_LSB)
|
||||
if (*mode == RIG_MODE_PKTUSB || *mode == RIG_MODE_PKTLSB)
|
||||
{
|
||||
const int ssb_htable[] = { 1000, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600, 2800, 3000, 3400, 4000, 5000 };
|
||||
const int ssb_ltable[] = { 0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
|
||||
|
@ -326,14 +407,14 @@ static int ts590_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
|
|||
*width = am_htable[hwidth] - am_ltable[lwidth];
|
||||
}
|
||||
|
||||
#if 0 // is this different? Manual is confusing
|
||||
else if (*mode == RIG_MODE_SSB || *mode == RIG_MODE_LSB)
|
||||
else if (*mode == RIG_MODE_SSB || *mode == RIG_MODE_LSB
|
||||
|| *mode == RIG_MODE_USB)
|
||||
{
|
||||
const int ssb_htable[] = { 1000, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600, 2800, 3000, 3400, 4000, 5000 };
|
||||
//const int ssb_ltable[] = { 0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
|
||||
const int ssb_ltable[] = { 0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
|
||||
*width = ssb_htable[hwidth] - ssb_ltable[lwidth];
|
||||
}
|
||||
|
||||
#endif
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: width=%ld, shift=%d, lwidth=%d, hwidth=%d\n",
|
||||
__func__, *width, shift, lwidth, hwidth);
|
||||
|
||||
|
@ -597,13 +678,13 @@ static int ts590_read_meters(RIG *rig, int *swr, int *comp, int *alc)
|
|||
{
|
||||
int retval;
|
||||
char *cmd = "RM;";
|
||||
struct rig_state *rs = &rig->state;
|
||||
struct hamlib_port *rp = RIGPORT(rig);
|
||||
char ackbuf[32];
|
||||
int expected_len = 24;
|
||||
|
||||
ENTERFUNC;
|
||||
|
||||
retval = write_block(&rs->rigport, (unsigned char *) cmd, strlen(cmd));
|
||||
retval = write_block(rp, (unsigned char *) cmd, strlen(cmd));
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: write_block retval=%d\n", __func__, retval);
|
||||
|
||||
|
@ -614,7 +695,7 @@ static int ts590_read_meters(RIG *rig, int *swr, int *comp, int *alc)
|
|||
|
||||
// TS-590 returns values for all meters at the same time, for example: RM10000;RM20000;RM30000;
|
||||
|
||||
retval = read_string(&rs->rigport, (unsigned char *) ackbuf, expected_len + 1,
|
||||
retval = read_string(rp, (unsigned char *) ackbuf, expected_len + 1,
|
||||
NULL, 0, 0, 1);
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: read_string retval=%d\n", __func__, retval);
|
||||
|
@ -1612,7 +1693,7 @@ struct rig_caps ts590_caps =
|
|||
RIG_MODEL(RIG_MODEL_TS590S),
|
||||
.model_name = "TS-590S",
|
||||
.mfg_name = "Kenwood",
|
||||
.version = BACKEND_VER ".12",
|
||||
.version = BACKEND_VER ".13",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
@ -1812,7 +1893,7 @@ struct rig_caps fx4_caps =
|
|||
RIG_MODEL(RIG_MODEL_FX4),
|
||||
.model_name = "FX4/C/CR/L",
|
||||
.mfg_name = "BG2FX",
|
||||
.version = BACKEND_VER ".9",
|
||||
.version = BACKEND_VER ".10",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
@ -2006,7 +2087,7 @@ struct rig_caps ts590sg_caps =
|
|||
RIG_MODEL(RIG_MODEL_TS590SG),
|
||||
.model_name = "TS-590SG",
|
||||
.mfg_name = "Kenwood",
|
||||
.version = BACKEND_VER ".8",
|
||||
.version = BACKEND_VER ".9",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
|
|
@ -198,7 +198,7 @@ int xg3_init(RIG *rig)
|
|||
}
|
||||
|
||||
rig->state.priv = (void *)priv;
|
||||
rig->state.rigport.type.rig = RIG_PORT_SERIAL;
|
||||
RIGPORT(rig)->type.rig = RIG_PORT_SERIAL;
|
||||
// Tried set_trn to turn transceiver on/off but turning it on isn't enabled in hamlib for some reason
|
||||
// So we use PTT instead
|
||||
// rig->state.transceive = RIG_TRN_RIG; // this allows xg3_set_trn to be called
|
||||
|
@ -280,7 +280,7 @@ int xg3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
char cmdbuf[32], replybuf[32];
|
||||
int retval;
|
||||
size_t replysize = sizeof(replybuf);
|
||||
struct rig_state *rs = &rig->state;
|
||||
struct hamlib_port *rp = RIGPORT(rig);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
@ -288,7 +288,7 @@ int xg3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
{
|
||||
case RIG_LEVEL_RFPOWER:
|
||||
SNPRINTF(cmdbuf, sizeof(cmdbuf), "L;");
|
||||
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
|
||||
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
|
@ -297,7 +297,7 @@ int xg3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
|
|||
return retval;
|
||||
}
|
||||
|
||||
retval = read_string(&rs->rigport, (unsigned char *) replybuf, replysize,
|
||||
retval = read_string(rp, (unsigned char *) replybuf, replysize,
|
||||
";", 1, 0, 1);
|
||||
|
||||
if (retval < 0)
|
||||
|
@ -424,7 +424,7 @@ int xg3_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
*/
|
||||
int xg3_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
||||
{
|
||||
struct rig_state *rs;
|
||||
struct hamlib_port *rp;
|
||||
char freqbuf[50];
|
||||
int freqsize = sizeof(freqbuf);
|
||||
char cmdbuf[16];
|
||||
|
@ -441,7 +441,7 @@ int xg3_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
|
||||
tvfo = (vfo == RIG_VFO_CURR ||
|
||||
vfo == RIG_VFO_VFO) ? rig->state.current_vfo : vfo;
|
||||
rs = &rig->state;
|
||||
rp = RIGPORT(rig);
|
||||
|
||||
switch (tvfo)
|
||||
{
|
||||
|
@ -467,7 +467,7 @@ int xg3_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
SNPRINTF(cmdbuf, sizeof(cmdbuf), "F;");
|
||||
}
|
||||
|
||||
retval = write_block(&rs->rigport, (unsigned char *) cmdbuf, strlen(cmdbuf));
|
||||
retval = write_block(rp, (unsigned char *) cmdbuf, strlen(cmdbuf));
|
||||
|
||||
if (retval != RIG_OK)
|
||||
{
|
||||
|
@ -475,7 +475,7 @@ int xg3_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
return retval;
|
||||
}
|
||||
|
||||
retval = read_string(&rs->rigport, (unsigned char *) freqbuf, freqsize,
|
||||
retval = read_string(rp, (unsigned char *) freqbuf, freqsize,
|
||||
";", 1, 0, 1);
|
||||
|
||||
if (retval < 0)
|
||||
|
@ -574,7 +574,7 @@ int xg3_get_mem(RIG *rig, vfo_t vfo, int *ch)
|
|||
char cmdbuf[32];
|
||||
char reply[32];
|
||||
int retval;
|
||||
struct rig_state *rs = &rig->state;
|
||||
struct hamlib_port *rp = RIGPORT(rig);
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
|
@ -586,7 +586,7 @@ int xg3_get_mem(RIG *rig, vfo_t vfo, int *ch)
|
|||
return retval;
|
||||
}
|
||||
|
||||
retval = read_string(&rs->rigport, (unsigned char *) reply, sizeof(reply),
|
||||
retval = read_string(rp, (unsigned char *) reply, sizeof(reply),
|
||||
";", 1, 0, 1);
|
||||
|
||||
if (retval < 0)
|
||||
|
|
|
@ -147,7 +147,7 @@ struct rig_caps ftdx10_caps =
|
|||
.serial_data_bits = 8,
|
||||
.serial_stop_bits = 2,
|
||||
.serial_parity = RIG_PARITY_NONE,
|
||||
.serial_handshake = RIG_HANDSHAKE_NONE,
|
||||
.serial_handshake = RIG_HANDSHAKE_HARDWARE,
|
||||
.write_delay = FTDX10_WRITE_DELAY,
|
||||
.post_write_delay = FTDX10_POST_WRITE_DELAY,
|
||||
.timeout = 2000,
|
||||
|
|
|
@ -7228,7 +7228,7 @@ int newcat_send_morse(RIG *rig, vfo_t vfo, const char *msg)
|
|||
{
|
||||
if (strlen(msg2) > 50)
|
||||
{
|
||||
msg2[50] = 0; // truncate if too long
|
||||
msg2[51] = 0; // truncate if too long
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: msg length of %d truncated to 50\n", __func__,
|
||||
(int)strlen(msg));
|
||||
}
|
||||
|
@ -11266,6 +11266,10 @@ int newcat_set_cmd_validate(RIG *rig)
|
|||
{
|
||||
strcpy(valcmd, "PC;");
|
||||
}
|
||||
else if (strncmp(priv->cmd_str, "AC", 2) == 0)
|
||||
{
|
||||
strcpy(valcmd, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: %s not implemented\n", __func__, priv->cmd_str);
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
typedef char ncboolean;
|
||||
|
||||
/* shared function version */
|
||||
#define NEWCAT_VER "20231230"
|
||||
#define NEWCAT_VER "20240113"
|
||||
|
||||
/* Hopefully large enough for future use, 128 chars plus '\0' */
|
||||
#define NEWCAT_DATA_LEN 129
|
||||
|
|
|
@ -8,7 +8,7 @@ DISTCLEANFILES =
|
|||
|
||||
bin_PROGRAMS =
|
||||
|
||||
check_PROGRAMS = simelecraft simicgeneric simkenwood simyaesu simic9100 simic9700 simft991 simftdx1200 simftdx3000 simjupiter simpowersdr simid5100 simft736 simftdx5000 simtmd700 simrotorez simspid simft817 simts590 simft847 simic7300 simic7000 simic7100 simic7200 simatd578 simic905 simts450 simic7600 simic7610 simic705 simts950 simts990 simic7851 simftdx101 simxiegug90 simqrplabs simft818 simic275 simtrusdx simft1000
|
||||
check_PROGRAMS = simelecraft simicgeneric simkenwood simyaesu simic9100 simic9700 simft991 simftdx1200 simftdx3000 simjupiter simpowersdr simid5100 simft736 simftdx5000 simtmd700 simrotorez simspid simft817 simts590 simft847 simic7300 simic7000 simic7100 simic7200 simatd578 simic905 simts450 simic7600 simic7610 simic705 simts950 simts990 simic7851 simftdx101 simxiegug90 simqrplabs simft818 simic275 simtrusdx simft1000 simtmd710
|
||||
|
||||
simelecraft_SOURCES = simelecraft.c
|
||||
simkenwood_SOURCES = simkenwood.c
|
||||
|
|
|
@ -0,0 +1,149 @@
|
|||
// can run this using rigctl/rigctld and socat pty devices
|
||||
// gcc -o simyaesu simyaesu.c
|
||||
#define _XOPEN_SOURCE 700
|
||||
// since we are POSIX here we need this
|
||||
#if 0
|
||||
struct ip_mreq
|
||||
{
|
||||
int dummy;
|
||||
};
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <hamlib/rig.h>
|
||||
|
||||
#define BUFSIZE 256
|
||||
|
||||
int mysleep = 20;
|
||||
|
||||
float freqA = 14074000;
|
||||
float freqB = 14074500;
|
||||
int filternum = 7;
|
||||
int datamode = 0;
|
||||
int vfo, vfo_tx, ptt, ptt_data, ptt_mic, ptt_tune;
|
||||
|
||||
// ID 0310 == 310, Must drop leading zero
|
||||
typedef enum nc_rigid_e
|
||||
{
|
||||
NC_RIGID_NONE = 0,
|
||||
NC_RIGID_FT450 = 241,
|
||||
NC_RIGID_FT450D = 244,
|
||||
NC_RIGID_FT950 = 310,
|
||||
NC_RIGID_FT891 = 135,
|
||||
NC_RIGID_FT991 = 135,
|
||||
NC_RIGID_FT2000 = 251,
|
||||
NC_RIGID_FT2000D = 252,
|
||||
NC_RIGID_FTDX1200 = 583,
|
||||
NC_RIGID_FTDX9000D = 101,
|
||||
NC_RIGID_FTDX9000Contest = 102,
|
||||
NC_RIGID_FTDX9000MP = 103,
|
||||
NC_RIGID_FTDX5000 = 362,
|
||||
NC_RIGID_FTDX3000 = 460,
|
||||
NC_RIGID_FTDX101D = 681,
|
||||
NC_RIGID_FTDX101MP = 682
|
||||
} nc_rigid_t;
|
||||
|
||||
int
|
||||
getmyline(int fd, char *buf)
|
||||
{
|
||||
char c;
|
||||
int i = 0;
|
||||
memset(buf, 0, BUFSIZE);
|
||||
|
||||
while (read(fd, &c, 1) > 0)
|
||||
{
|
||||
buf[i++] = c;
|
||||
|
||||
if (c == 0x0d) { return strlen(buf); }
|
||||
}
|
||||
|
||||
if (strlen(buf) == 0) { hl_usleep(10 * 1000); }
|
||||
|
||||
return strlen(buf);
|
||||
}
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
int openPort(char *comport) // doesn't matter for using pts devices
|
||||
{
|
||||
int fd;
|
||||
fd = open(comport, O_RDWR);
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
perror(comport);
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
#else
|
||||
int openPort(char *comport) // doesn't matter for using pts devices
|
||||
{
|
||||
int fd = posix_openpt(O_RDWR);
|
||||
char *name = ptsname(fd);
|
||||
|
||||
if (name == NULL)
|
||||
{
|
||||
perror("pstname");
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("name=%s\n", name);
|
||||
|
||||
if (fd == -1 || grantpt(fd) == -1 || unlockpt(fd) == -1)
|
||||
{
|
||||
perror("posix_openpt");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char buf[256];
|
||||
char *pbuf;
|
||||
int fd = openPort(argv[1]);
|
||||
int freqa = 14074000, freqb = 140735000;
|
||||
int modeA = 0; // , modeB = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
buf[0] = 0;
|
||||
|
||||
if (getmyline(fd, buf) > 0) { printf("Cmd:%s\n", buf); }
|
||||
|
||||
if (strncmp(buf, "BC", 2) == 0)
|
||||
{
|
||||
SNPRINTF(buf, sizeof(buf), "BC %d %d%c", vfo, vfo_tx, 0x0d);
|
||||
printf("R:%s\n", buf);
|
||||
write(fd, buf, strlen(buf));
|
||||
continue;
|
||||
}
|
||||
else if (strncmp(buf, "FO", 2) == 0)
|
||||
{
|
||||
if (buf[3]=='0') {
|
||||
SNPRINTF(buf, sizeof(buf), "FO 0 %d%c", freqA, 0x0d);
|
||||
}
|
||||
else {
|
||||
SNPRINTF(buf, sizeof(buf), "FO 1 %d%c", freqB, 0x0d);
|
||||
}
|
||||
printf("R:%s\n", buf);
|
||||
write(fd, buf, strlen(buf));
|
||||
continue;
|
||||
}
|
||||
else if (strlen(buf) > 0)
|
||||
{
|
||||
fprintf(stderr, "Unknown command: %s\n", buf);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -69,7 +69,7 @@ frameGet(int fd, unsigned char *buf)
|
|||
}
|
||||
}
|
||||
|
||||
printf("Error %s\n", strerror(errno));
|
||||
//printf("Error %s\n", strerror(errno));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ libhamlib_la_LIBADD = $(top_builddir)/lib/libmisc.la $(top_builddir)/security/li
|
|||
|
||||
libhamlib_la_DEPENDENCIES = $(top_builddir)/lib/libmisc.la $(top_builddir)/security/libsecurity.la $(BACKENDEPS) $(RIG_BACKENDEPS) $(ROT_BACKENDEPS) $(AMP_BACKENDEPS)
|
||||
|
||||
EXTRA_DIST = Android.mk hamlibdatetime.h.in
|
||||
EXTRA_DIST = Android.mk hamlibdatetime.h.in band_changed.c
|
||||
|
||||
|
||||
# If we have a .git directory then we will generate the hamlibdate.h
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
// This is currently included in rig.c
|
||||
// Can customize during build
|
||||
// Eventually should improved this for external actions when
|
||||
// rigctld gets integrated as a service within Hamlib
|
||||
static int rig_band_changed(RIG *rig, hamlib_bandselect_t band)
|
||||
{
|
||||
// See band_changed.c
|
||||
// Examples:
|
||||
// rig_set_func(rig, RIG_VFO_CURR, RIG_FUNC_TUNER, 1);
|
||||
// rig_set_func(rig, RIG_VFO_CURR, RIG_FUNC_TUNER, 0);
|
||||
// value_t v;
|
||||
// rig_set_ant(rig, RIG_VFO_CURR, 1, v);
|
||||
switch (band)
|
||||
{
|
||||
case RIG_BANDSELECT_2200M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_600M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_160M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_80M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_60M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_40M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_30M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_20M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_17M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_15M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_12M:
|
||||
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_10M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_6M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_WFM:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_MW:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_AIR:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_2M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_1_25M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_70CM:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_33CM:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_23CM:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_13CM:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_9CM:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_5CM:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_3CM:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_GEN:
|
||||
break;
|
||||
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unknown band=%d\n", __func__, band);
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
69
src/misc.c
69
src/misc.c
|
@ -837,7 +837,7 @@ setting_t HAMLIB_API rig_parse_band(const char *s)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
for (i = 0 ; rig_bandselect_str[i].str[0] != '\0'; i++)
|
||||
for (i = 0 ; rig_bandselect_str[i].str != NULL; i++)
|
||||
{
|
||||
if (!strcmp(s, rig_bandselect_str[i].str))
|
||||
{
|
||||
|
@ -2004,9 +2004,10 @@ vfo_t HAMLIB_API vfo_fixup2a(RIG *rig, vfo_t vfo, split_t split,
|
|||
// We need to add some exceptions to this like the ID-5100
|
||||
vfo_t HAMLIB_API vfo_fixup(RIG *rig, vfo_t vfo, split_t split)
|
||||
{
|
||||
vfo_t currvfo = rig->state.current_vfo;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s:(from %s:%d) vfo=%s, vfo_curr=%s, split=%d\n",
|
||||
__func__, funcname, linenum,
|
||||
rig_strvfo(vfo), rig_strvfo(rig->state.current_vfo), split);
|
||||
rig_strvfo(vfo), rig_strvfo(currvfo), split);
|
||||
|
||||
if (rig->caps->rig_model == RIG_MODEL_ID5100
|
||||
|| rig->caps->rig_model == RIG_MODEL_IC9700)
|
||||
|
@ -2023,6 +2024,28 @@ vfo_t HAMLIB_API vfo_fixup(RIG *rig, vfo_t vfo, split_t split)
|
|||
|
||||
return vfo; // no change to requested vfo
|
||||
}
|
||||
else if (RIG_IS_IC9700)
|
||||
{
|
||||
if (vfo == RIG_VFO_A && (currvfo == RIG_VFO_MAIN || currvfo == RIG_VFO_MAIN_A))
|
||||
{
|
||||
vfo = RIG_VFO_MAIN_A;
|
||||
}
|
||||
else if (vfo == RIG_VFO_B && (currvfo == RIG_VFO_MAIN
|
||||
|| currvfo == RIG_VFO_MAIN_A))
|
||||
{
|
||||
vfo = RIG_VFO_MAIN_B;
|
||||
}
|
||||
else if (vfo == RIG_VFO_A && (currvfo == RIG_VFO_SUB
|
||||
|| currvfo == RIG_VFO_SUB_A || currvfo == RIG_VFO_SUB_B))
|
||||
{
|
||||
vfo = RIG_VFO_SUB_A;
|
||||
}
|
||||
else if (vfo == RIG_VFO_B && (currvfo == RIG_VFO_SUB
|
||||
|| currvfo == RIG_VFO_SUB_A || currvfo == RIG_VFO_SUB_B))
|
||||
{
|
||||
vfo = RIG_VFO_SUB_B;
|
||||
}
|
||||
}
|
||||
|
||||
if (vfo == RIG_VFO_NONE) { vfo = RIG_VFO_A; }
|
||||
|
||||
|
@ -2852,9 +2875,25 @@ char *rig_date_strget(char *buf, int buflen, int localtime)
|
|||
return date_strget(buf, buflen, localtime);
|
||||
}
|
||||
|
||||
const char *spaces()
|
||||
const char *spaces(int len)
|
||||
{
|
||||
static char *s = " ";
|
||||
static char s[256];
|
||||
memset(s, '*', sizeof(s));
|
||||
|
||||
if (len > 255)
|
||||
{
|
||||
len = 0;
|
||||
}
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
s[len + 1] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
s[1] = 0;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -2866,7 +2905,7 @@ const char *rig_get_band_str(RIG *rig, hamlib_band_t band, int which)
|
|||
|
||||
if (which == 0)
|
||||
{
|
||||
for (i = 0; rig_bandselect_str[i].str[0] != '\0'; i++)
|
||||
for (i = 0; rig_bandselect_str[i].str != NULL; i++)
|
||||
{
|
||||
if (rig_bandselect_str[i].bandselect == band)
|
||||
{
|
||||
|
@ -2896,7 +2935,7 @@ const char *rig_get_band_str(RIG *rig, hamlib_band_t band, int which)
|
|||
{
|
||||
if (n == band)
|
||||
{
|
||||
for (i = 0; rig_bandselect_str[i].str[0] != '\0'; i++)
|
||||
for (i = 0; rig_bandselect_str[i].str != NULL; i++)
|
||||
{
|
||||
if (strcmp(rig_bandselect_str[i].str, token) == 0)
|
||||
{
|
||||
|
@ -2952,7 +2991,7 @@ hamlib_band_t rig_get_band(RIG *rig, freq_t freq, int band)
|
|||
return RIG_BAND_UNUSED;
|
||||
}
|
||||
|
||||
for (i = 0 ; rig_bandselect_str[i].str[0] != '\0'; i++)
|
||||
for (i = 0 ; rig_bandselect_str[i].str != NULL; i++)
|
||||
{
|
||||
if (freq >= rig_bandselect_str[i].start && freq <= rig_bandselect_str[i].stop)
|
||||
{
|
||||
|
@ -2969,12 +3008,26 @@ int rig_get_band_rig(RIG *rig, freq_t freq, const char *band)
|
|||
char bandlist[512];
|
||||
int i;
|
||||
|
||||
if (freq == 0 && band == NULL)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: bad combo of freq==0 && band==NULL\n", __func__);
|
||||
return RIG_BAND_GEN;
|
||||
}
|
||||
|
||||
if (freq == 0)
|
||||
{
|
||||
rig_sprintf_parm_gran(bandlist, sizeof(bandlist) - 1, RIG_PARM_BANDSELECT,
|
||||
rig->caps->parm_gran);
|
||||
bandlist[0] = 0;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: bandlist=%s\n", __func__, bandlist);
|
||||
|
||||
// e.g. BANDSELECT(BAND160M,BAND80M,BANDUNUSED,BAND40M)
|
||||
if (strlen(bandlist) == 0)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: rig does not have bandlist\n", __func__);
|
||||
return RIG_BAND_GEN;
|
||||
}
|
||||
|
||||
char *p = strchr(bandlist, '(') + 1;
|
||||
char *token;
|
||||
|
||||
|
@ -2998,7 +3051,7 @@ int rig_get_band_rig(RIG *rig, freq_t freq, const char *band)
|
|||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0 ; rig_bandselect_str[i].str[0] != '\0'; i++)
|
||||
for (i = 0 ; rig_bandselect_str[i].str != NULL; i++)
|
||||
{
|
||||
if (freq >= rig_bandselect_str[i].start && freq <= rig_bandselect_str[i].stop)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
__BEGIN_DECLS
|
||||
|
||||
// a function to return just a string of spaces for indenting rig debug lines
|
||||
HAMLIB_EXPORT (const char *) spaces();
|
||||
HAMLIB_EXPORT (const char *) spaces(int len);
|
||||
/*
|
||||
* Do a hex dump of the unsigned char array.
|
||||
*/
|
||||
|
@ -158,7 +158,7 @@ extern HAMLIB_EXPORT(char *)date_strget(char *buf, int buflen, int localtime);
|
|||
void errmsg(int err, char *s, const char *func, const char *file, int line);
|
||||
#define ERRMSG(err, s) errmsg(err, s, __func__, __FILENAME__, __LINE__)
|
||||
#define ENTERFUNC { ++rig->state.depth; \
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%.*s%d:%s(%d):%s entered\n", rig->state.depth-1, spaces(), rig->state.depth, __FILENAME__, __LINE__, __func__); \
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s%d:%s(%d):%s entered\n", spaces(rig->state.depth), rig->state.depth, __FILENAME__, __LINE__, __func__); \
|
||||
}
|
||||
#define ENTERFUNC2 { rig_debug(RIG_DEBUG_VERBOSE, "%s(%d):%s entered\n", __FILENAME__, __LINE__, __func__); \
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ void errmsg(int err, char *s, const char *func, const char *file, int line);
|
|||
// could be a function call
|
||||
#define RETURNFUNC(rc) {do { \
|
||||
int rctmp = rc; \
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%.*s%d:%s(%d):%s returning(%ld) %s\n", rig->state.depth, spaces(), rig->state.depth, __FILENAME__, __LINE__, __func__, (long int) (rctmp), rctmp<0?rigerror2(rctmp):""); \
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s%d:%s(%d):%s returning(%ld) %s\n", spaces(rig->state.depth), rig->state.depth, __FILENAME__, __LINE__, __func__, (long int) (rctmp), rctmp<0?rigerror2(rctmp):""); \
|
||||
--rig->state.depth; \
|
||||
return (rctmp); \
|
||||
} while(0);}
|
||||
|
|
109
src/rig.c
109
src/rig.c
|
@ -1033,6 +1033,7 @@ int HAMLIB_API rig_open(RIG *rig)
|
|||
if (RIG_BACKEND_NUM(rig->caps->rig_model) == RIG_ICOM)
|
||||
{
|
||||
// Xiegu X6100 does TCP and does not support UDP spectrum that I know of
|
||||
#if 0
|
||||
if (rig->caps->rig_model != RIG_MODEL_X6100)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s(%d): Icom rig UDP network enabled\n", __FILE__,
|
||||
|
@ -1040,6 +1041,7 @@ int HAMLIB_API rig_open(RIG *rig)
|
|||
rs->rigport.type.rig = RIG_PORT_UDP_NETWORK;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1327,17 +1329,19 @@ int HAMLIB_API rig_open(RIG *rig)
|
|||
}
|
||||
|
||||
#if defined(HAVE_PTHREAD)
|
||||
|
||||
if (!skip_init)
|
||||
{
|
||||
status = async_data_handler_start(rig);
|
||||
status = async_data_handler_start(rig);
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
port_close(&rs->rigport, rs->rigport.type.rig);
|
||||
rig->state.comm_status = RIG_COMM_STATUS_ERROR;
|
||||
RETURNFUNC2(status);
|
||||
}
|
||||
if (status < 0)
|
||||
{
|
||||
port_close(&rs->rigport, rs->rigport.type.rig);
|
||||
rig->state.comm_status = RIG_COMM_STATUS_ERROR;
|
||||
RETURNFUNC2(status);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
rs->comm_state = 1;
|
||||
|
@ -1391,11 +1395,13 @@ int HAMLIB_API rig_open(RIG *rig)
|
|||
{
|
||||
remove_opened_rig(rig);
|
||||
#if defined(HAVE_PTHREAD)
|
||||
|
||||
if (!skip_init)
|
||||
{
|
||||
async_data_handler_stop(rig);
|
||||
morse_data_handler_stop(rig);
|
||||
{
|
||||
async_data_handler_stop(rig);
|
||||
morse_data_handler_stop(rig);
|
||||
}
|
||||
|
||||
#endif
|
||||
port_close(&rs->rigport, rs->rigport.type.rig);
|
||||
memcpy(&rs->rigport_deprecated, &rs->rigport, sizeof(hamlib_port_t_deprecated));
|
||||
|
@ -1449,7 +1455,8 @@ int HAMLIB_API rig_open(RIG *rig)
|
|||
rig_strvfo(rs->current_vfo));
|
||||
}
|
||||
}
|
||||
if (skip_init) return RIG_OK;
|
||||
|
||||
if (skip_init) { return RIG_OK; }
|
||||
|
||||
#if defined(HAVE_PTHREAD)
|
||||
status = morse_data_handler_start(rig);
|
||||
|
@ -1484,13 +1491,21 @@ int HAMLIB_API rig_open(RIG *rig)
|
|||
|
||||
if (rig->caps->get_freq)
|
||||
{
|
||||
retval = rig_get_freq(rig, RIG_VFO_A, &freq);
|
||||
vfo_t myvfo = RIG_VFO_A;
|
||||
|
||||
if (rig->caps->rig_model == RIG_MODEL_IC9700) { myvfo = RIG_VFO_MAIN_A; }
|
||||
|
||||
retval = rig_get_freq(rig, myvfo, &freq);
|
||||
|
||||
if (retval == RIG_OK && rig->caps->rig_model != RIG_MODEL_F6K)
|
||||
{
|
||||
split_t split = RIG_SPLIT_OFF;
|
||||
vfo_t tx_vfo = RIG_VFO_NONE;
|
||||
rig_get_freq(rig, RIG_VFO_B, &freq);
|
||||
myvfo = RIG_VFO_B;
|
||||
|
||||
if (rig->caps->rig_model == RIG_MODEL_IC9700) { myvfo = RIG_VFO_MAIN_B; }
|
||||
|
||||
rig_get_freq(rig, myvfo, &freq);
|
||||
rig_get_split_vfo(rig, RIG_VFO_RX, &split, &tx_vfo);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): Current split=%d, tx_vfo=%s\n", __func__,
|
||||
__LINE__, split, rig_strvfo(tx_vfo));
|
||||
|
@ -1499,13 +1514,21 @@ int HAMLIB_API rig_open(RIG *rig)
|
|||
|
||||
if (rig->caps->get_mode)
|
||||
{
|
||||
rig_get_mode(rig, RIG_VFO_A, &mode, &width);
|
||||
myvfo = RIG_VFO_A;
|
||||
|
||||
if (rig->caps->rig_model == RIG_MODEL_IC9700) { myvfo = RIG_VFO_MAIN_A; }
|
||||
|
||||
rig_get_mode(rig, myvfo, &mode, &width);
|
||||
|
||||
if (split)
|
||||
{
|
||||
myvfo = RIG_VFO_B;
|
||||
|
||||
if (rig->caps->rig_model == RIG_MODEL_IC9700) { myvfo = RIG_VFO_MAIN_A; }
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "xxxsplit=%d\n", split);
|
||||
HAMLIB_TRACE;
|
||||
rig_get_mode(rig, RIG_VFO_B, &mode, &width);
|
||||
rig_get_mode(rig, myvfo, &mode, &width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1602,14 +1625,16 @@ int HAMLIB_API rig_close(RIG *rig)
|
|||
rig->state.comm_status = RIG_COMM_STATUS_DISCONNECTED;
|
||||
|
||||
#if defined(HAVE_PTHREAD)
|
||||
|
||||
if (!skip_init)
|
||||
{
|
||||
morse_data_handler_stop(rig);
|
||||
async_data_handler_stop(rig);
|
||||
rig_poll_routine_stop(rig);
|
||||
network_multicast_receiver_stop(rig);
|
||||
network_multicast_publisher_stop(rig);
|
||||
morse_data_handler_stop(rig);
|
||||
async_data_handler_stop(rig);
|
||||
rig_poll_routine_stop(rig);
|
||||
network_multicast_receiver_stop(rig);
|
||||
network_multicast_publisher_stop(rig);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -1907,6 +1932,8 @@ static int twiddling(RIG *rig)
|
|||
RETURNFUNC2(0);
|
||||
}
|
||||
|
||||
#include "band_changed.c"
|
||||
|
||||
/**
|
||||
* \brief set the frequency of the target VFO
|
||||
* \param rig The rig handle
|
||||
|
@ -1933,6 +1960,8 @@ int rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
int retcode;
|
||||
freq_t freq_new = freq;
|
||||
vfo_t vfo_save;
|
||||
static int last_band = -1;
|
||||
int curr_band;
|
||||
|
||||
if (CHECK_RIG_ARG(rig))
|
||||
{
|
||||
|
@ -1940,9 +1969,21 @@ int rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
curr_band = rig_get_band(rig, freq, -1);
|
||||
|
||||
if (rig->state.tx_vfo == vfo && curr_band != last_band)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: band changing to %s\n", __func__,
|
||||
rig_get_band_str(rig, curr_band, 0));
|
||||
rig_band_changed(rig, curr_band);
|
||||
last_band = curr_band;
|
||||
}
|
||||
|
||||
ELAPSED1;
|
||||
ENTERFUNC;
|
||||
LOCK(1);
|
||||
|
||||
|
||||
#if BUILTINFUNC
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, freq=%.0f, called from %s\n",
|
||||
__func__,
|
||||
|
@ -1957,7 +1998,8 @@ int rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN || (vfo == RIG_VFO_CURR
|
||||
&& rig->state.current_vfo == RIG_VFO_A))
|
||||
{
|
||||
if (rig->state.cache.freqMainA != freq && (((int)freq % 10) != 0))
|
||||
if (rig->state.cache.freqMainA != freq && (((int)freq % 10) != 0)
|
||||
&& (((int)freq % 100) != 55))
|
||||
{
|
||||
rig->state.doppler = 1;
|
||||
rig_debug(RIG_DEBUG_VERBOSE,
|
||||
|
@ -1970,7 +2012,8 @@ int rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
else if (vfo == RIG_VFO_B || vfo == RIG_VFO_SUB || (vfo == RIG_VFO_CURR
|
||||
&& rig->state.current_vfo == RIG_VFO_B))
|
||||
{
|
||||
if (rig->state.cache.freqMainB != freq && ((int)freq % 10) != 0)
|
||||
if (rig->state.cache.freqMainB != freq && ((int)freq % 10) != 0
|
||||
&& (((int)freq % 100) != 55))
|
||||
{
|
||||
rig->state.doppler = 1;
|
||||
rig_debug(RIG_DEBUG_VERBOSE,
|
||||
|
@ -2248,6 +2291,8 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
vfo_t curr_vfo;
|
||||
rmode_t mode;
|
||||
pbwidth_t width;
|
||||
int curr_band;
|
||||
static int last_band = -1;
|
||||
|
||||
if (CHECK_RIG_ARG(rig))
|
||||
{
|
||||
|
@ -2509,6 +2554,21 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
rig_cache_show(rig, __func__, __LINE__);
|
||||
}
|
||||
|
||||
// we only want to look for band change on main vfo for now
|
||||
if (*freq != 0 && (rig->state.current_vfo == RIG_VFO_A
|
||||
|| rig->state.current_vfo == RIG_VFO_MAIN))
|
||||
{
|
||||
curr_band = rig_get_band(rig, *freq, -1);
|
||||
|
||||
if (rig->state.tx_vfo == vfo && curr_band != last_band)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: band changing to %s\n", __func__,
|
||||
rig_get_band_str(rig, curr_band, 0));
|
||||
rig_band_changed(rig, curr_band);
|
||||
last_band = curr_band;
|
||||
}
|
||||
}
|
||||
|
||||
ELAPSED2;
|
||||
LOCK(0);
|
||||
RETURNFUNC(retcode);
|
||||
|
@ -2925,8 +2985,7 @@ pbwidth_t HAMLIB_API rig_passband_normal(RIG *rig, rmode_t mode)
|
|||
{
|
||||
if (rs->filters[i].modes & mode)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%.*s%d:%s: return filter#%d, width=%d\n",
|
||||
rig->state.depth, spaces(), rig->state.depth, __func__, i,
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: return filter#%d, width=%d\n", __func__, i,
|
||||
(int)rs->filters[i].width);
|
||||
RETURNFUNC(rs->filters[i].width);
|
||||
}
|
||||
|
@ -3090,7 +3149,7 @@ int HAMLIB_API rig_set_vfo(RIG *rig, vfo_t vfo)
|
|||
|
||||
if (vfo == RIG_VFO_B || vfo == RIG_VFO_SUB)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s ********************** called vfo=%s\n",
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s\n",
|
||||
__func__, rig_strvfo(vfo));
|
||||
}
|
||||
|
||||
|
|
|
@ -522,6 +522,7 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp)
|
|||
* Set stop bits to requested values.
|
||||
*
|
||||
*/
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: stopbits=%d\n", __func__, rp->parm.serial.stop_bits);
|
||||
switch (rp->parm.serial.stop_bits)
|
||||
{
|
||||
case 1:
|
||||
|
|
|
@ -933,6 +933,7 @@ void usage(void)
|
|||
" -h, --help display this help and exit\n"
|
||||
" -V, --version output version information and exit\n"
|
||||
" -!, --cookie use cookie control\n\n"
|
||||
" -#, --skipinit skips rig initialization\n"
|
||||
);
|
||||
|
||||
usage_rig(stdout);
|
||||
|
|
Ładowanie…
Reference in New Issue