From d12ca2291659064a06ea3522e16b18c61094fc41 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Fri, 3 Jun 2022 08:11:32 -0500 Subject: [PATCH] Add PTT check in set_freq since rig cannot set freq while transmitting VOX mode was a problem so this ptt check should fix it. https://github.com/Hamlib/Hamlib/issues/1052 --- rigs/yaesu/ft857.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/rigs/yaesu/ft857.c b/rigs/yaesu/ft857.c index 9d5387f99..6edc4a933 100644 --- a/rigs/yaesu/ft857.c +++ b/rigs/yaesu/ft857.c @@ -248,7 +248,7 @@ const struct rig_caps ft857_caps = RIG_MODEL(RIG_MODEL_FT857), .model_name = "FT-857", .mfg_name = "Yaesu", - .version = "20220407.0", + .version = "20220603.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -936,11 +936,24 @@ int ft857_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) int ft857_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { unsigned char data[YAESU_CMD_LENGTH - 1]; + int retval; + int i; + ptt_t ptt = RIG_PTT_ON; rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "ft857: requested freq = %"PRIfreq" Hz\n", freq); + // cannot set freq while PTT is on + for (i = 0; i < 10 && ptt == RIG_PTT_ON; ++i) + { + retval = rig_get_ptt(rig, vfo, &ptt); + + if (retval != RIG_OK) { return retval; } + + hl_usleep(100 * 1000); + } + /* fill in the frequency */ to_bcd_be(data, (freq + 5) / 10, 8);