[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. 1de9a5cede92b4847a329
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: n0nb <n0...@us...> - 2024-03-17 16:02:46
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Hamlib -- Ham radio control libraries". The branch, master has been updated via 1de9a5cede92b4847a32966c6b087ca91b74d113 (commit) via 0e572f631b8f4d75984f5b8f03b83ddce36eaf50 (commit) via 84d5f367f6b6631114e12fcf84e9b949411b1e55 (commit) via 6d257841a6e79dcb16b0e9efe1c1a9007904255f (commit) via 8449ac3c436065cbca6886a7ad469d1229268fdf (commit) via 1045620313669792c24f49df570d66a596faf95b (commit) via b9e59f205e029147c0e9fac12cc457c47582a954 (commit) via 6220da1eaf73d212b4d082035ef9de3ab8598522 (commit) via f119f5976aaa49fd7eca4997fbbd7b38796b49bf (commit) via 96ec37a276fd773b1a14f699bc033c4c2ef75a74 (commit) via 789d863f9779160ea6b204e84db1aaae29a702ae (commit) via c7665cb7d115acc12f57144c4f3431196241852f (commit) via aa0d83df959ec7dcd76546be45a72a17552db98f (commit) via 609065775c49da604d38b46b3fee601910d06e5d (commit) via 5ab1122139e4227fe124124fea6c4a8e9386db24 (commit) via 24135bd7d704dbf61c1f3cdf674cbb4159c59045 (commit) via b358cdbd2eb04ee89c6c6819775fb2adc8bbb039 (commit) via f3b8330331b145f893868a97420d5c6f428d2939 (commit) via 61211976872a798b709416a6671622cb93d4ed29 (commit) via 15a2b5a0dc3e40a57aac485b63499a1a06992255 (commit) via b9df1c7bda84092ab114838078b58a5133ef7eba (commit) via 4f3e40f3c6ec6b9a6e4dc72c31399f799f62e199 (commit) via bafb88432aced418aaaab73d70099eabbc0c6b1d (commit) via 2212c47ad7660f8228246ae4d8f72cf84e1cfc86 (commit) via f122f6422b86da02f8b101e55266acc253d0ae47 (commit) via 0868edbd659284f84290f2503680e52ec0342941 (commit) via dc38d19449a0a7e0c97298a46876887e484fb80c (commit) via c74b3c10c657aa14880eb860baf4cc540cc7e5eb (commit) via a96a97ae3ce24df355cf2cc774b8da4034bd2857 (commit) via 7831dfc311cec469e7d0dfc9af2574e05cd9fe88 (commit) via bb9b1f1783f23a415f22863de7b63611021f0c0a (commit) via 12404aa8a6498e871b664993a1320e433069f70e (commit) via cef2525d0f09ee6557736cdd7c98aeb6abf5924c (commit) via 728db84c0c1d0ec22a096ee1bcfba1182fed8df1 (commit) via 07f8023d17f96ffc2898d5713a33221ce494301c (commit) via 55db73894fb71b3fcb3a676dc421cd88a419806f (commit) via 0fdc78c6043ebb3f9dd0df9b2d913ddfabe9e02f (commit) via 0f74a23b142e8e3ec33ed0907fb9c0c1798baeb7 (commit) via 7f02c35562da9946c4ab398eeb781deaeac1b171 (commit) via a8f7da8fc4e325ac5a87ad7f665e43e54d00233b (commit) via c15f5b0da01ee8308d94d42bac71ecb501a3782b (commit) via c6371a14a1786f8ed2eb00e121efb200287cd2fd (commit) via 65d2023b95695e14493024246ceec7013c44fb32 (commit) via c68ef118e9cbb10807e9f1eebf0823e60624a7e1 (commit) via 25ee5d65d592e80f7471806c2959ded06ece1b69 (commit) via eaae02ef008e117d8ad5f2568776a6c2b393a193 (commit) via 45db5d32c3cb61cbf0ac0ffd0d482cf0f57df126 (commit) via 7bda13f0e0f7a257b9e36fe7b13dee3ceb3a42c7 (commit) via b65997a24929edfa4809e7912413ddb25ebfacac (commit) via 7ee8c358cd056ff5f5ccc965da605f3329f7d6c3 (commit) via 5f92b19ef4882da83bbbfcf30ea61384ca9b7791 (commit) via 5089949f100ed31f8e321d84221b90efbc2793af (commit) via 83f5655a9fec53811250e8d20d2c04342700b304 (commit) via 1b2f6a84f7a2b322593eead90f3f278008ee8464 (commit) via 9f87279b0b2b3e9dad4391f4daae657ed6b33806 (commit) via c1f8b091abe305dadbf9a08777532bd1b9ce23ad (commit) via 3967e41fcf2463a5b11fea12f4527b44d47d06d6 (commit) via 2849a756762fd73ced678de01958ed73b1c1eb4b (commit) via fff8e83c111ff7476c4accae27d99b849da39530 (commit) via c23948c8f4711e6d2dc8422bf904a912c2579d42 (commit) via 911692c715f658600d4c5c1a90aea3cc24b222f2 (commit) via db6dc9251330e953423cfeaba79825858f2bde41 (commit) via 8ff07c47f9d0c3cf13aaed05dfcc9607933ba014 (commit) via f247ee20888acb9dfb66f9e4455fbc14a2d41d36 (commit) via 878117ab1f342d0e04b7bbd9998accb30665bbee (commit) from 8cc6ce131926b49a2a6bd5e1b1268f98fa00fc78 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1de9a5cede92b4847a32966c6b087ca91b74d113 Author: Mike Black W9MDB <mdb...@ya...> Date: Sun Mar 17 09:01:58 2024 -0500 Fix compile warning on rig_debug messages https://github.com/Hamlib/Hamlib/issues/1525 diff --git a/rigs/kenwood/elecraft.c b/rigs/kenwood/elecraft.c index e349882cb..05b32835f 100644 --- a/rigs/kenwood/elecraft.c +++ b/rigs/kenwood/elecraft.c @@ -457,12 +457,12 @@ int verify_kenwood_id(RIG *rig, char *id) if (strcmp("017", idptr) != 0) { - rig_debug(RIG_DEBUG_VERBOSE, "%s: Rig (%s) is not a K2 or K3\n", __func__, id); + rig_debug(RIG_DEBUG_VERBOSE, "%s: Rig (%.4095s) is not a K2 or K3\n", __func__, id); // return -RIG_EPROTO; } else { - rig_debug(RIG_DEBUG_VERBOSE, "%s: Rig ID is %s\n", __func__, id); + rig_debug(RIG_DEBUG_VERBOSE, "%s: Rig ID is %.4095s\n", __func__, id); } return RIG_OK; diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 41e21f89d..4ff44d1cb 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -270,7 +270,7 @@ int kenwood_transaction(RIG *rig, const char *cmdstr, char *data, if (datasize > 0 && datasize < (cmdstr ? strlen(cmdstr) : 0)) { rig_debug(RIG_DEBUG_WARN, - "%s called cmd=%s datasize=%d, datasize < cmd length?\n", __func__, + "%s called cmd=%.4095s datasize=%d, datasize < cmd length?\n", __func__, cmdstr ? cmdstr : "(NULL)", (int)datasize); } diff --git a/rigs/winradio/g313-posix.c b/rigs/winradio/g313-posix.c index 4ee963d7d..1fb7ac798 100644 --- a/rigs/winradio/g313-posix.c +++ b/rigs/winradio/g313-posix.c @@ -553,7 +553,7 @@ int g313_set_conf(RIG *rig, hamlib_token_t token, const char *val) case TOK_SHM_AUDIO: if (len > (FIFO_PATHNAME_SIZE - 1)) { - rig_debug(RIG_DEBUG_WARN, "%s: set audio_path %s is too long\n", __func__, val); + rig_debug(RIG_DEBUG_WARN, "%s: set audio_path %.4095s is too long\n", __func__, val); return -RIG_EINVAL; } @@ -566,7 +566,7 @@ int g313_set_conf(RIG *rig, hamlib_token_t token, const char *val) case TOK_SHM_IF: if (len > (FIFO_PATHNAME_SIZE - 1)) { - rig_debug(RIG_DEBUG_WARN, "%s: set if_path %s is too long\n", __func__, val); + rig_debug(RIG_DEBUG_WARN, "%s: set if_path %.4095s is too long\n", __func__, val); return -RIG_EINVAL; } @@ -579,7 +579,7 @@ int g313_set_conf(RIG *rig, hamlib_token_t token, const char *val) case TOK_SHM_SPECTRUM: if (len > (FIFO_PATHNAME_SIZE - 1)) { - rig_debug(RIG_DEBUG_WARN, "%s: set spectrum_path %s is too long\n", __func__, + rig_debug(RIG_DEBUG_WARN, "%s: set spectrum_path %.4095s is too long\n", __func__, val); return -RIG_EINVAL; } commit 0e572f631b8f4d75984f5b8f03b83ddce36eaf50 Author: Mike Black W9MDB <mdb...@ya...> Date: Sun Mar 17 08:53:53 2024 -0500 Update simft897.c diff --git a/simulators/simft897.c b/simulators/simft897.c index f473f96d9..892d39fde 100644 --- a/simulators/simft897.c +++ b/simulators/simft897.c @@ -129,7 +129,11 @@ again: case 0xF5: printf("FREQ\n"); break; - case 0x81: printf("VFO TOGGLE\n"); break; + case 0x81: + rx_vfo = rx_vfo == 0? 1: 0; + printf("VFO TOGGLE to %dE\n", rx_vfo); + break; + case 0x02: printf("SPLIT ON\n"); break; @@ -147,7 +151,14 @@ again: case 0xE7: printf("READ RX STATUS\n"); break; - case 0xF7: printf("READ TX STATUS\n"); break; + case 0xF7: + printf("READ TX STATUS\n"); + buf[0] = 0x01; + buf[1] = 0x40; + buf[2] = 0x74; + buf[3] = 0x00; + buf[4] = 0x03; n = write(fd, buf, 5); + break; case 0x03: printf("READ RX STATUS\n"); commit 84d5f367f6b6631114e12fcf84e9b949411b1e55 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Mar 15 22:51:19 2024 -0500 Fix compile warning on testrig.c diff --git a/tests/testrig.c b/tests/testrig.c index 212d356fa..e73a4cd79 100644 --- a/tests/testrig.c +++ b/tests/testrig.c @@ -80,7 +80,7 @@ int main(int argc, const char *argv[]) uint64_t levels = rig_get_caps_int(my_rig->caps->rig_model, RIG_CAPS_HAS_GET_LEVEL); - printf("HAS_GET_LEVEL=0x%8llx, SWR=%8llx,true=%d\n", levels, + printf("HAS_GET_LEVEL=0x%8lx, SWR=%8llx,true=%d\n", levels, levels & RIG_LEVEL_SWR, (levels & RIG_LEVEL_SWR) == RIG_LEVEL_SWR); char val[256]; commit 6d257841a6e79dcb16b0e9efe1c1a9007904255f Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Mar 15 16:46:14 2024 -0500 Fix some memory leaks in rigctl_parse.c diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index e92fb5660..5c6a24b76 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -1175,12 +1175,14 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc, if (!input_line) { fprintf_flush(fout, "\n"); + free(rp_hist_buf); return (RIGCTL_PARSE_END); } /* Q or q to quit */ if (!(strncasecmp(input_line, "q", 1))) { + free(rp_hist_buf); return (RIGCTL_PARSE_END); } @@ -1189,12 +1191,14 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc, { usage_rig(fout); fflush(fout); + free(rp_hist_buf); return (RIG_OK); } /* '#' for comment */ if (!(strncmp(input_line, "#", 1))) { + free(rp_hist_buf); return (RIG_OK); } @@ -1203,6 +1207,7 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc, { fprintf(fout, "? for help, q to quit.\n"); fflush(fout); + free(rp_hist_buf); return (RIG_OK); } @@ -1227,6 +1232,7 @@ readline_repeat: { /* Oops! Invoke GDB!! */ fprintf_flush(fout, "\n"); + free(rp_hist_buf); return (RIGCTL_PARSE_END); } @@ -1286,6 +1292,7 @@ readline_repeat: { fprintf(stderr, "Valid multiple character command names contain alphanumeric characters plus '_'\n"); + free(rp_hist_buf); return (RIG_OK); } } @@ -1295,12 +1302,14 @@ readline_repeat: /* Single '\' entered, prompt again */ else if ((*parsed_input[0] == '\\') && (strlen(parsed_input[0]) == 1)) { + free(rp_hist_buf); return (RIG_OK); } /* Multiple characters but no leading '\' */ else { fprintf(stderr, "Precede multiple character command names with '\\'\n"); + free(rp_hist_buf); return (RIG_OK); } @@ -1317,6 +1326,7 @@ readline_repeat: fprintf(stderr, "Command '%c' not found!\n", cmd); } + free(rp_hist_buf); return (RIG_OK); } @@ -1342,6 +1352,7 @@ readline_repeat: if (!input_line) { fprintf_flush(fout, "\n"); + free(rp_hist_buf); return (RIGCTL_PARSE_END); } @@ -1350,6 +1361,7 @@ readline_repeat: { fprintf(fout, "? for help, q to quit.\n"); fflush(fout); + free(rp_hist_buf); return (RIG_OK); } @@ -1365,6 +1377,7 @@ readline_repeat: else { fprintf_flush(fout, "\n"); + free(rp_hist_buf); return (RIGCTL_PARSE_END); } } @@ -1444,6 +1457,7 @@ readline_repeat: { fprintf(fout, "? for help, q to quit.\n"); fflush(fout); + free(rp_hist_buf); return (RIG_OK); } @@ -1454,6 +1468,7 @@ readline_repeat: else { fprintf_flush(fout, "\n"); + free(rp_hist_buf); return (RIGCTL_PARSE_END); } } @@ -1506,6 +1521,7 @@ readline_repeat: { fprintf(fout, "? for help, q to quit.\n"); fflush(fout); + free(rp_hist_buf); return (RIG_OK); } @@ -1518,6 +1534,7 @@ readline_repeat: else { fprintf_flush(fout, "\n"); + free(rp_hist_buf); return (RIGCTL_PARSE_END); } } @@ -1572,6 +1589,7 @@ readline_repeat: { fprintf(fout, "? for help, q to quit.\n"); fflush(fout); + free(rp_hist_buf); return (RIG_OK); } @@ -1584,6 +1602,7 @@ readline_repeat: else { fprintf_flush(fout, "\n"); + free(rp_hist_buf); return (RIGCTL_PARSE_END); } } @@ -1638,6 +1657,7 @@ readline_repeat: { fprintf(fout, "? for help, q to quit.\n"); fflush(fout); + free(rp_hist_buf); return (RIG_OK); } @@ -1650,6 +1670,7 @@ readline_repeat: else { fprintf_flush(fout, "\n"); + free(rp_hist_buf); return (RIGCTL_PARSE_END); } } commit 8449ac3c436065cbca6886a7ad469d1229268fdf Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Mar 15 07:29:03 2024 -0500 Update simulators diff --git a/simulators/Makefile.am b/simulators/Makefile.am index 2ea8fee66..12c290686 100644 --- a/simulators/Makefile.am +++ b/simulators/Makefile.am @@ -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 simtmd710 simts890 simxiegux108g simxiegux6100 simic910 simft450 +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 simts890 simxiegux108g simxiegux6100 simic910 simft450 simelecraftk4 simelecraft_SOURCES = simelecraft.c simkenwood_SOURCES = simkenwood.c diff --git a/simulators/simelecraft.c b/simulators/simelecraft.c index 9296d7dbc..10fbee1f2 100644 --- a/simulators/simelecraft.c +++ b/simulators/simelecraft.c @@ -35,6 +35,8 @@ int rxattenuatorB = 0; int keyspd = 20; int ai = 0; int dt = 0; +int modea = 2; +int modeb = 2; // ID 0310 == 310, Must drop leading zero typedef enum nc_rigid_e @@ -122,14 +124,13 @@ int main(int argc, char *argv[]) char *pbuf; int n; int fd = openPort(argv[1]); - int modea = 3, modeb = 3; int freqa = 14074000, freqb = 14073500; while (1) { buf[0] = 0; - if ((n = getmyline(fd, buf)) > 0) { printf("Cmd:%s, len=%d\n", buf, n); } + if ((n = getmyline(fd, buf)) > 0) { if (strstr(buf,"BW")) printf("Cmd:%s, len=%d\n", buf, n); } else {continue; } if (strcmp(buf, "RM5;") == 0) diff --git a/simulators/simelecraft.c b/simulators/simelecraftk4.c similarity index 93% copy from simulators/simelecraft.c copy to simulators/simelecraftk4.c index 9296d7dbc..1aa4cad2f 100644 --- a/simulators/simelecraft.c +++ b/simulators/simelecraftk4.c @@ -19,14 +19,14 @@ struct ip_mreq #define BUFSIZE 256 -float freqA = 14074000; -float freqB = 14074500; +int freqA = 14074000; +int freqB = 14074500; int afgain = 180; int rfgain = 190; int micgain = 30; int noiseblanker = 0; -int bandwidthA = 2200; -int bandwidthB = 2400; +int bandwidthA = 200; +int bandwidthB = 200; int ifshift = 0; int preampA = 0; int preampB = 0; @@ -35,6 +35,9 @@ int rxattenuatorB = 0; int keyspd = 20; int ai = 0; int dt = 0; +int modeA = 2; +int modeB = 2; +// int freqa = 14074000, freqb = 14073500; // ID 0310 == 310, Must drop leading zero typedef enum nc_rigid_e @@ -122,14 +125,12 @@ int main(int argc, char *argv[]) char *pbuf; int n; int fd = openPort(argv[1]); - int modea = 3, modeb = 3; - int freqa = 14074000, freqb = 14073500; while (1) { buf[0] = 0; - if ((n = getmyline(fd, buf)) > 0) { printf("Cmd:%s, len=%d\n", buf, n); } + if ((n = getmyline(fd, buf)) > 0) { if (strstr(buf,"BW0")) printf("Cmd:%s, len=%d\n", buf, n); } else {continue; } if (strcmp(buf, "RM5;") == 0) @@ -317,37 +318,37 @@ int main(int argc, char *argv[]) } else if (strcmp(buf, "MD;") == 0) { - SNPRINTF(buf, sizeof(buf), "MD%d;", modea); + SNPRINTF(buf, sizeof(buf), "MD%d;", modeA); WRITE(fd, buf, strlen(buf)); } else if (strcmp(buf, "MD$;") == 0) { - SNPRINTF(buf, sizeof(buf), "MD$%d;", modeb); + SNPRINTF(buf, sizeof(buf), "MD$%d;", modeB); WRITE(fd, buf, strlen(buf)); } else if (strncmp(buf, "MD", 2) == 0) { - if (buf[2] == '$') { sscanf(buf, "MD$%d;", &modeb); } - else { sscanf(buf, "MD%d;", &modea); } + if (buf[2] == '$') { sscanf(buf, "MD$%d;", &modeB); } + else { sscanf(buf, "MD%d;", &modeA); } } else if (strcmp(buf, "FA;") == 0) { - SNPRINTF(buf, sizeof(buf), "FA%011d;", freqa); + SNPRINTF(buf, sizeof(buf), "FA%011d;", freqA); WRITE(fd, buf, strlen(buf)); } else if (strcmp(buf, "FB;") == 0) { - SNPRINTF(buf, sizeof(buf), "FB%011d;", freqb); + SNPRINTF(buf, sizeof(buf), "FB%011d;", freqB); WRITE(fd, buf, strlen(buf)); } else if (strncmp(buf, "FA", 2) == 0) { - sscanf(buf, "FA%d", &freqa); + sscanf(buf, "FA%d", &freqA); } else if (strncmp(buf, "FB", 2) == 0) { - sscanf(buf, "FB%d", &freqb); + sscanf(buf, "FB%d", &freqB); } else if (strncmp(buf, "FR;", 3) == 0) { diff --git a/simulators/simic910.c b/simulators/simic910.c index 9038f09c8..4b539de50 100644 --- a/simulators/simic910.c +++ b/simulators/simic910.c @@ -28,7 +28,7 @@ struct ip_mreq #define BUFSIZE 256 -#define X25 +//#define X25 int civ_731_mode = 0; vfo_t current_vfo = RIG_VFO_A; commit 1045620313669792c24f49df570d66a596faf95b Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Mar 15 07:27:19 2024 -0500 Return error on bad read_icom_frame diff --git a/rigs/icom/frame.c b/rigs/icom/frame.c index 946040c73..5a4d58f60 100644 --- a/rigs/icom/frame.c +++ b/rigs/icom/frame.c @@ -301,6 +301,12 @@ again2: buf[0] = 0; frm_len = read_icom_frame(rp, buf, sizeof(buf)); + if (frm_len <= 0) + { + set_transaction_inactive(rig); + return frm_len; + } + if (frm_len > 4 && memcmp(buf, sendbuf, frm_len) == 0) { priv->serial_USB_echo_off = 0; commit b9e59f205e029147c0e9fac12cc457c47582a954 Author: Mike Black W9MDB <mdb...@ya...> Date: Thu Mar 14 22:43:10 2024 -0500 Fix compile error https://github.com/Hamlib/Hamlib/issues/1524 diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 59c9b3663..e92fb5660 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -101,7 +101,7 @@ extern int read_history(); #define ARG_OUT (ARG_OUT1|ARG_OUT2|ARG_OUT3|ARG_OUT4|ARG_OUT5) static int chk_vfo_executed; -char rigctld_password[64]; +char rigctld_password[65]; int is_passwordOK; int is_rigctld; extern int lock_mode; // used by rigctld commit 6220da1eaf73d212b4d082035ef9de3ab8598522 Merge: f119f5976 96ec37a27 Author: Mike Black W9MDB <mdb...@ya...> Date: Thu Mar 14 17:10:39 2024 -0500 Merge branch 'master' of https://github.com/Hamlib/Hamlib commit f119f5976aaa49fd7eca4997fbbd7b38796b49bf Author: Mike Black W9MDB <mdb...@ya...> Date: Thu Mar 14 17:09:36 2024 -0500 Fix build warning https://github.com/Hamlib/Hamlib/issues/1524 diff --git a/src/rig.c b/src/rig.c index f7bc8961f..3db6567e7 100644 --- a/src/rig.c +++ b/src/rig.c @@ -999,10 +999,10 @@ int HAMLIB_API rig_open(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s: cwd=%s\n", __func__, cwd); char *path = calloc(1, 4096); - extern char *settings_file; + extern char settings_file[4096]; const char *xdgpath = getenv("XDG_CONFIG_HOME"); - settings_file = "hamlib_settings"; + strcpy(settings_file,"hamlib_settings"); if (xdgpath) { commit 96ec37a276fd773b1a14f699bc033c4c2ef75a74 Author: Mike Black W9MDB <mdb...@ya...> Date: Thu Mar 14 17:09:36 2024 -0500 Fix build warning diff --git a/src/rig.c b/src/rig.c index f7bc8961f..3db6567e7 100644 --- a/src/rig.c +++ b/src/rig.c @@ -999,10 +999,10 @@ int HAMLIB_API rig_open(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s: cwd=%s\n", __func__, cwd); char *path = calloc(1, 4096); - extern char *settings_file; + extern char settings_file[4096]; const char *xdgpath = getenv("XDG_CONFIG_HOME"); - settings_file = "hamlib_settings"; + strcpy(settings_file,"hamlib_settings"); if (xdgpath) { commit 789d863f9779160ea6b204e84db1aaae29a702ae Merge: 5ab112213 c7665cb7d Author: Michael Black <mdb...@ya...> Date: Sun Mar 10 09:04:26 2024 -0500 Merge pull request #1523 from GeoBaltz/rp7 Convert all cache references to pointers commit c7665cb7d115acc12f57144c4f3431196241852f Author: George Baltz N3GB <Geo...@gm...> Date: Sat Mar 9 21:23:01 2024 -0500 All struct rig_cache referenced converted to pointers. diff --git a/tests/rigctlcom.c b/tests/rigctlcom.c index f1a285576..cadcb6904 100644 --- a/tests/rigctlcom.c +++ b/tests/rigctlcom.c @@ -665,7 +665,7 @@ static rmode_t ts2000_get_mode() { rmode_t mode; pbwidth_t width; - rig_get_mode(my_rig, vfo_fixup(my_rig, RIG_VFO_A, my_rig->state.cache.split), + rig_get_mode(my_rig, vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split), &mode, &width); kwidth = width; #if 0 @@ -802,8 +802,8 @@ static int handle_ts2000(void *arg) int p13 = 0; // P13(1) Tone dummy value for now int p14 = 0; // P14(2) Tone Freq dummy value for now int p15 = 0; // P15(1) Shift status dummy value for now - int retval = rig_get_freq(my_rig, vfo_fixup(my_rig, RIG_VFO_A, - my_rig->state.cache.split), &freq); + int retval = rig_get_freq(my_rig, vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split), + &freq); char response[64]; char *fmt = // cppcheck-suppress * @@ -815,8 +815,8 @@ static int handle_ts2000(void *arg) } mode = ts2000_get_mode(); - retval = rig_get_ptt(my_rig, vfo_fixup(my_rig, RIG_VFO_A, - my_rig->state.cache.split), &ptt); + retval = rig_get_ptt(my_rig, vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split), + &ptt); if (retval != RIG_OK) { @@ -900,8 +900,8 @@ static int handle_ts2000(void *arg) freq_t freq = 0; char response[32]; - int retval = rig_get_freq(my_rig, vfo_fixup(my_rig, RIG_VFO_A, - my_rig->state.cache.split), &freq); + int retval = rig_get_freq(my_rig, vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split), + &freq); if (retval != RIG_OK) { @@ -917,8 +917,8 @@ static int handle_ts2000(void *arg) { char response[32]; freq_t freq = 0; - int retval = rig_get_freq(my_rig, vfo_fixup(my_rig, RIG_VFO_B, - my_rig->state.cache.split), &freq); + int retval = rig_get_freq(my_rig, vfo_fixup(my_rig, RIG_VFO_B, CACHE(my_rig)->split), + &freq); if (retval != RIG_OK) { @@ -941,7 +941,7 @@ static int handle_ts2000(void *arg) { char response[32]; - rig_set_ptt(my_rig, vfo_fixup(my_rig, RIG_VFO_A, my_rig->state.cache.split), 0); + rig_set_ptt(my_rig, vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split), 0); SNPRINTF(response, sizeof(response), "RX0;"); return write_block2((void *)__func__, &my_com, response, strlen(response)); } @@ -972,8 +972,7 @@ static int handle_ts2000(void *arg) } else if (strcmp(arg, "TX;") == 0) { - return rig_set_ptt(my_rig, vfo_fixup(my_rig, RIG_VFO_A, - my_rig->state.cache.split), 1); + return rig_set_ptt(my_rig, vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split), 1); } else if (strcmp(arg, "AI0;") == 0) { @@ -987,13 +986,11 @@ static int handle_ts2000(void *arg) } else if (strcmp(arg, "FR0;") == 0) { - return rig_set_vfo(my_rig, vfo_fixup(my_rig, RIG_VFO_A, - my_rig->state.cache.split)); + return rig_set_vfo(my_rig, vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split)); } else if (strcmp(arg, "FR1;") == 0) { - return rig_set_vfo(my_rig, vfo_fixup(my_rig, RIG_VFO_B, - my_rig->state.cache.split)); + return rig_set_vfo(my_rig, vfo_fixup(my_rig, RIG_VFO_B, CACHE(my_rig)->split)); } else if (strcmp(arg, "FR;") == 0) { @@ -1013,8 +1010,8 @@ static int handle_ts2000(void *arg) } - if (vfo == vfo_fixup(my_rig, RIG_VFO_A, my_rig->state.cache.split)) { nvfo = 0; } - else if (vfo == vfo_fixup(my_rig, RIG_VFO_B, my_rig->state.cache.split)) { nvfo = 1; } + if (vfo == vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split)) { nvfo = 0; } + else if (vfo == vfo_fixup(my_rig, RIG_VFO_B, CACHE(my_rig)->split)) { nvfo = 1; } else { retval = -RIG_EPROTO; @@ -1029,7 +1026,7 @@ static int handle_ts2000(void *arg) else if (strcmp(arg, "FT;") == 0) { char response[32]; - vfo_t vfo, vfo_curr = vfo_fixup(my_rig, RIG_VFO_A, my_rig->state.cache.split); + vfo_t vfo, vfo_curr = vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split); split_t split; int nvfo = 0; int retval = rig_get_split_vfo(my_rig, vfo_curr, &split, &vfo); @@ -1042,8 +1039,8 @@ static int handle_ts2000(void *arg) } - if (vfo == vfo_fixup(my_rig, RIG_VFO_A, my_rig->state.cache.split)) { nvfo = 0; } - else if (vfo == vfo_fixup(my_rig, RIG_VFO_B, my_rig->state.cache.split)) { nvfo = 1; } + if (vfo == vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split)) { nvfo = 0; } + else if (vfo == vfo_fixup(my_rig, RIG_VFO_B, CACHE(my_rig)->split)) { nvfo = 1; } else { retval = -RIG_EPROTO; @@ -1092,9 +1089,8 @@ static int handle_ts2000(void *arg) { char response[32]; int valA; - int retval = rig_get_func(my_rig, vfo_fixup(my_rig, RIG_VFO_A, - my_rig->state.cache.split), RIG_FUNC_AIP, - &valA); + int retval = rig_get_func(my_rig, vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split), + RIG_FUNC_AIP, &valA); int valB; if (retval != RIG_OK) @@ -1112,9 +1108,8 @@ static int handle_ts2000(void *arg) return retval; } - retval = rig_get_func(my_rig, vfo_fixup(my_rig, RIG_VFO_B, - my_rig->state.cache.split), RIG_FUNC_AIP, - &valB); + retval = rig_get_func(my_rig, vfo_fixup(my_rig, RIG_VFO_B, CACHE(my_rig)->split), + RIG_FUNC_AIP, &valB); if (retval != RIG_OK) { @@ -1139,8 +1134,8 @@ static int handle_ts2000(void *arg) (char *)arg); } - retval = rig_set_func(my_rig, vfo_fixup(my_rig, RIG_VFO_A, - my_rig->state.cache.split), RIG_FUNC_AIP, valA); + retval = rig_set_func(my_rig, vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split), + RIG_FUNC_AIP, valA); if (retval != RIG_OK) { @@ -1149,8 +1144,8 @@ static int handle_ts2000(void *arg) return retval; } - retval = rig_set_func(my_rig, vfo_fixup(my_rig, RIG_VFO_B, - my_rig->state.cache.split), RIG_FUNC_AIP, valB); + retval = rig_set_func(my_rig, vfo_fixup(my_rig, RIG_VFO_B, CACHE(my_rig)->split), + RIG_FUNC_AIP, valB); if (retval != RIG_OK) { @@ -1515,7 +1510,7 @@ static int handle_ts2000(void *arg) } else if (strcmp(arg, "DC;") == 0) { - vfo_t vfo, vfo_curr = vfo_fixup(my_rig, RIG_VFO_A, my_rig->state.cache.split); + vfo_t vfo, vfo_curr = vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split); split_t split; char response[32]; int retval = rig_get_split_vfo(my_rig, vfo_curr, &split, &vfo); @@ -1534,7 +1529,7 @@ static int handle_ts2000(void *arg) } else if (strncmp(arg, "DC", 2) == 0) { - vfo_t vfo_curr = vfo_fixup(my_rig, RIG_VFO_A, my_rig->state.cache.split); + vfo_t vfo_curr = vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split); split_t split; int isplit; int retval; @@ -1565,15 +1560,13 @@ static int handle_ts2000(void *arg) } else if (strcmp(arg, "FT0;") == 0) { - return rig_set_split_vfo(my_rig, vfo_fixup(my_rig, RIG_VFO_A, - my_rig->state.cache.split), vfo_fixup(my_rig, - RIG_VFO_A, my_rig->state.cache.split), 0); + return rig_set_split_vfo(my_rig, vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split), + vfo_fixup(my_rig, RIG_VFO_A, CACHE(my_rig)->split), 0); } else if (strcmp(arg, "FT1;") == 0) { - return rig_set_split_vfo(my_rig, vfo_fixup(my_rig, RIG_VFO_B, - my_rig->state.cache.split), vfo_fixup(my_rig, - RIG_VFO_B, my_rig->state.cache.split), 0); + return rig_set_split_vfo(my_rig, vfo_fixup(my_rig, RIG_VFO_B, CACHE(my_rig)->split), + vfo_fixup(my_rig, RIG_VFO_B, CACHE(my_rig)->split), 0); } else if (strncmp(arg, "FA0", 3) == 0) { @@ -1583,16 +1576,14 @@ static int handle_ts2000(void *arg) if (mapa2b) { vfo = RIG_VFO_B; } sscanf((char *)arg + 2, "%"SCNfreq, &freq); - return rig_set_freq(my_rig, vfo_fixup(my_rig, vfo, - my_rig->state.cache.split), freq); + return rig_set_freq(my_rig, vfo_fixup(my_rig, vfo, CACHE(my_rig)->split), freq); } else if (strncmp(arg, "FB0", 3) == 0) { freq_t freq; sscanf((char *)arg + 2, "%"SCNfreq, &freq); - return rig_set_freq(my_rig, vfo_fixup(my_rig, RIG_VFO_B, - my_rig->state.cache.split), freq); + return rig_set_freq(my_rig, vfo_fixup(my_rig, RIG_VFO_B, CACHE(my_rig)->split), freq); } else if (strncmp(arg, "MD", 2) == 0) { commit aa0d83df959ec7dcd76546be45a72a17552db98f Author: George Baltz N3GB <Geo...@gm...> Date: Sat Mar 9 14:25:59 2024 -0500 Use pointers for all cache references in rigs/* diff --git a/rigs/kenwood/ts2000.c b/rigs/kenwood/ts2000.c index 817156439..a1e2bf999 100644 --- a/rigs/kenwood/ts2000.c +++ b/rigs/kenwood/ts2000.c @@ -692,7 +692,7 @@ static int ts2000_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) return RIG_OK; case RIG_LEVEL_STRENGTH: - if (rig->state.cache.ptt != RIG_PTT_OFF) + if (CACHE(rig)->ptt != RIG_PTT_OFF) { val->i = -9 * 6; break; @@ -879,7 +879,7 @@ static int ts2000_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) int raw_value; char read_vfo_num; - if (rig->state.cache.ptt == RIG_PTT_OFF) + if (CACHE(rig)->ptt == RIG_PTT_OFF) { val->f = 0; break; diff --git a/rigs/kenwood/ts480.c b/rigs/kenwood/ts480.c index 3cd3579c1..f9034ad7b 100644 --- a/rigs/kenwood/ts480.c +++ b/rigs/kenwood/ts480.c @@ -581,7 +581,7 @@ kenwood_ts480_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) return RIG_OK; case RIG_LEVEL_STRENGTH: - if (rig->state.cache.ptt != RIG_PTT_OFF) + if (CACHE(rig)->ptt != RIG_PTT_OFF) { val->i = -9 * 6; break; @@ -708,7 +708,7 @@ kenwood_ts480_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { int raw_value; - if (rig->state.cache.ptt == RIG_PTT_OFF) + if (CACHE(rig)->ptt == RIG_PTT_OFF) { val->f = 0; break; @@ -2198,15 +2198,16 @@ int malachite_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) int malachite_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { int retval; + struct rig_cache *cachep = CACHE(rig); ENTERFUNC; rig_debug(RIG_DEBUG_TRACE, "%s: freqMainA=%g, freq=%g\n", __func__, - rig->state.cache.freqMainA, freq); + cachep->freqMainA, freq); - if ((rig->state.cache.freqMainA < 400000000 && freq >= 400000000) - || (rig->state.cache.freqMainA >= 400000000 && freq < 400000000) - || rig->state.cache.freqMainA == 0) + if ((cachep->freqMainA < 400000000 && freq >= 400000000) + || (cachep->freqMainA >= 400000000 && freq < 400000000) + || cachep->freqMainA == 0) { // Malachite has a bug where it takes two freq set to make it work // under band changes -- so we just do this all the time diff --git a/rigs/kenwood/ts590.c b/rigs/kenwood/ts590.c index a995182e3..84903494c 100644 --- a/rigs/kenwood/ts590.c +++ b/rigs/kenwood/ts590.c @@ -240,7 +240,7 @@ static int ts590_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) if (!sf_fails) { SNPRINTF(cmd, sizeof(cmd), "SF%d%011.0f%c", vfo == RIG_VFO_A ? 0 : 1, - vfo == RIG_VFO_A ? rig->state.cache.freqMainA : rig->state.cache.freqMainB, + vfo == RIG_VFO_A ? CACHE(rig)->freqMainA : CACHE(rig)->freqMainB, c); retval = kenwood_transaction(rig, cmd, NULL, 0); } @@ -328,7 +328,7 @@ static int ts590_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) if (vfo == RIG_VFO_CURR) { vfo = rig->state.current_vfo; } - if (vfo == RIG_VFO_TX || vfo == RIG_VFO_RX) { vfo = vfo_fixup(rig, vfo, rig->state.cache.split); } + if (vfo == RIG_VFO_TX || vfo == RIG_VFO_RX) { vfo = vfo_fixup(rig, vfo, CACHE(rig)->split); } retval = RIG_OK; @@ -875,7 +875,7 @@ static int ts590_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) return RIG_OK; case RIG_LEVEL_STRENGTH: - if (rig->state.cache.ptt != RIG_PTT_OFF) + if (CACHE(rig)->ptt != RIG_PTT_OFF) { val->i = -9 * 6; break; @@ -1022,7 +1022,7 @@ static int ts590_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) int raw_value; - if (rig->state.cache.ptt == RIG_PTT_OFF) + if (CACHE(rig)->ptt == RIG_PTT_OFF) { val->f = 0; break; diff --git a/rigs/yaesu/ft100.c b/rigs/yaesu/ft100.c index e243f0341..47623ddeb 100644 --- a/rigs/yaesu/ft100.c +++ b/rigs/yaesu/ft100.c @@ -914,7 +914,7 @@ int ft100_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { unsigned char cmd_index; - int split = rig->state.cache.split; + int split = CACHE(rig)->split; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -971,8 +971,8 @@ int ft100_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { int ret; - int split = rig->state.cache.split; - int ptt = rig->state.cache.ptt; + int split = CACHE(rig)->split; + int ptt = CACHE(rig)->ptt; FT100_METER_INFO ft100_meter; diff --git a/rigs/yaesu/ft1000d.c b/rigs/yaesu/ft1000d.c index bf99876ce..bb67ec7c0 100644 --- a/rigs/yaesu/ft1000d.c +++ b/rigs/yaesu/ft1000d.c @@ -4121,11 +4121,11 @@ static int ft1000_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) if (vfo == RIG_VFO_A) { - *freq = rig->state.cache.freqMainA; + *freq = CACHE(rig)->freqMainA; } else { - *freq = rig->state.cache.freqMainB; + *freq = CACHE(rig)->freqMainB; } return RIG_OK; @@ -4135,11 +4135,11 @@ static int ft1000_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { if (vfo == RIG_VFO_A) { - *mode = rig->state.cache.modeMainA; + *mode = CACHE(rig)->modeMainA; } else { - *mode = rig->state.cache.modeMainB; + *mode = CACHE(rig)->modeMainB; } return RIG_OK; @@ -4153,7 +4153,7 @@ static int ft1000_get_vfo(RIG *rig, vfo_t *vfo) static int ft1000_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { - *ptt = rig->state.cache.ptt; + *ptt = CACHE(rig)->ptt; return RIG_OK; } diff --git a/rigs/yaesu/ft1000mp.c b/rigs/yaesu/ft1000mp.c index 7e171da55..084a9c7c4 100644 --- a/rigs/yaesu/ft1000mp.c +++ b/rigs/yaesu/ft1000mp.c @@ -932,11 +932,11 @@ static int ft1000mp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) if (vfo == RIG_VFO_A) { - *freq = rig->state.cache.freqMainA; + *freq = CACHE(rig)->freqMainA; } else { - *freq = rig->state.cache.freqMainB; + *freq = CACHE(rig)->freqMainB; } return RIG_OK; @@ -1818,8 +1818,8 @@ static int ft1000mp_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t freq, if (retval == RIG_OK) { - rig->state.cache.freqMainB = freq; - rig->state.cache.modeMainB = mode; + CACHE(rig)->freqMainB = freq; + CACHE(rig)->modeMainB = mode; } RETURNFUNC(retval); @@ -1842,8 +1842,8 @@ static int ft1000mp_get_split_freq_mode(RIG *rig, vfo_t vfo, freq_t *freq, if (retval == RIG_OK) { - rig->state.cache.freqMainB = *freq; - rig->state.cache.modeMainB = *mode; + CACHE(rig)->freqMainB = *freq; + CACHE(rig)->modeMainB = *mode; } RETURNFUNC(retval); diff --git a/rigs/yaesu/ft736.c b/rigs/yaesu/ft736.c index 69cf8d2e6..68f62d43a 100644 --- a/rigs/yaesu/ft736.c +++ b/rigs/yaesu/ft736.c @@ -298,7 +298,7 @@ int ft736_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__); - if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN) { *freq = rig->state.cache.freqMainA; } + if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN) { *freq = CACHE(rig)->freqMainA; } else { rig_get_cache_freq(rig, vfo, freq, NULL); } return RIG_OK; diff --git a/rigs/yaesu/ft747.c b/rigs/yaesu/ft747.c index 52f951565..74a45c7d0 100644 --- a/rigs/yaesu/ft747.c +++ b/rigs/yaesu/ft747.c @@ -579,18 +579,19 @@ int ft747_set_freq(RIG *rig, vfo_t vfo, freq_t freq) int ft747_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct ft747_priv_data *p; + struct rig_cache *cachep = CACHE(rig); freq_t f; int ret; rig_debug(RIG_DEBUG_VERBOSE, "%s: called vfo=%s, freqMainA=%.0f, freqMainB=%.0f\n", __func__, - rig_strvfo(vfo), rig->state.cache.freqMainA, rig->state.cache.freqMainB); + rig_strvfo(vfo), cachep->freqMainA, cachep->freqMainB); - if (vfo == RIG_VFO_CURR) { vfo = rig->state.cache.vfo; } + if (vfo == RIG_VFO_CURR) { vfo = cachep->vfo; } - if (rig->state.cache.ptt == RIG_PTT_ON) + if (cachep->ptt == RIG_PTT_ON) { - *freq = RIG_VFO_B ? rig->state.cache.freqMainB : rig->state.cache.freqMainA; + *freq = RIG_VFO_B ? cachep->freqMainB : cachep->freqMainA; return RIG_OK; } @@ -1005,7 +1006,7 @@ static int ft747_get_update_data(RIG *rig) p = (struct ft747_priv_data *)rig->state.priv; rigport = RIGPORT(rig); - if (rig->state.cache.ptt == RIG_PTT_ON + if (CACHE(rig)->ptt == RIG_PTT_ON || !rig_check_cache_timeout(&p->status_tv, FT747_CACHE_TIMEOUT)) { return RIG_OK; diff --git a/rigs/yaesu/ft817.c b/rigs/yaesu/ft817.c index 950379e0b..4d239014f 100644 --- a/rigs/yaesu/ft817.c +++ b/rigs/yaesu/ft817.c @@ -988,16 +988,17 @@ static int ft817_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv; freq_t f1 = 0, f2 = 0; + struct rig_cache *cachep = CACHE(rig); int retries = RIGPORT(rig)->retry + 1; // +1 because, because 2 steps are needed even in best scenario rig_debug(RIG_DEBUG_VERBOSE, "%s: called, vfo=%s, ptt=%d, split=%d\n", __func__, - rig_strvfo(vfo), rig->state.cache.ptt, rig->state.cache.split); + rig_strvfo(vfo), cachep->ptt, cachep->split); // we can't query VFOB while in transmit and split mode - if (rig->state.cache.ptt && vfo == RIG_VFO_B && rig->state.cache.split) + if (cachep->ptt && vfo == RIG_VFO_B && cachep->split) { - *freq = rig->state.cache.freqMainB; + *freq = cachep->freqMainB; return RIG_OK; } @@ -2127,7 +2128,7 @@ static int ft817_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) return n; } - rig->state.cache.split = split; + CACHE(rig)->split = split; return RIG_OK; diff --git a/rigs/yaesu/ft857.c b/rigs/yaesu/ft857.c index 935a0b8ab..ace4e7874 100644 --- a/rigs/yaesu/ft857.c +++ b/rigs/yaesu/ft857.c @@ -615,14 +615,14 @@ int ft857_get_vfo(RIG *rig, vfo_t *vfo) // Some 857's cannot read so we'll just return the cached value if we've seen an error if (ignore) { - *vfo = rig->state.cache.vfo; + *vfo = CACHE(rig)->vfo; return RIG_OK; } if (ft857_read_eeprom(rig, 0x0068, &c) < 0) /* get vfo status */ { ignore = 1; - *vfo = rig->state.cache.vfo; + *vfo = CACHE(rig)->vfo; return RIG_OK; } diff --git a/rigs/yaesu/ft990v12.c b/rigs/yaesu/ft990v12.c index 1d165ee76..00eed8314 100644 --- a/rigs/yaesu/ft990v12.c +++ b/rigs/yaesu/ft990v12.c @@ -701,7 +701,7 @@ int ft990v12_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) else { // M0EZP: Uni use cache -// *freq = vfo == RIG_VFO_A ? rig->state.cache.freqMainA : rig->state.cache.freqMainB; +// *freq = vfo == RIG_VFO_A ? CACHE(rig)->freqMainA : CACHE(rig)->freqMainB; return (RIG_OK); } } diff --git a/rigs/yaesu/ft991.c b/rigs/yaesu/ft991.c index 47d9d484f..70e3e8b5f 100644 --- a/rigs/yaesu/ft991.c +++ b/rigs/yaesu/ft991.c @@ -458,7 +458,7 @@ ft991_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) return (rval); } - if (rig->state.cache.freqMainB == tx_freq) + if (CACHE(rig)->freqMainB == tx_freq) { rig_debug(RIG_DEBUG_TRACE, "%s: freq %.0f already set on VFOB\n", __func__, tx_freq); @@ -635,7 +635,7 @@ static int ft991_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, return -RIG_EINVAL; } - if (rig->state.cache.modeMainB == tx_mode) + if (CACHE(rig)->modeMainB == tx_mode) { rig_debug(RIG_DEBUG_TRACE, "%s: mode %s already set on VFOB\n", __func__, rig_strrmode(tx_mode)); diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 6242a8b40..5b5665543 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -936,17 +936,18 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq) char target_vfo; int err; struct rig_caps *caps; + struct rig_cache *cachep = CACHE(rig); struct newcat_priv_data *priv; int special_60m = 0; vfo_t vfo_mode; ENTERFUNC; - if (newcat_60m_exception(rig, freq, rig->state.cache.modeMainA)) + if (newcat_60m_exception(rig, freq, cachep->modeMainA)) { // we don't try to set freq on 60m for some rigs since we must be in memory mode // and we can't run split mode on 60M memory mode either - if (rig->state.cache.split == RIG_SPLIT_ON) + if (cachep->split == RIG_SPLIT_ON) { rig_set_split_vfo(rig, RIG_VFO_A, RIG_VFO_A, RIG_SPLIT_OFF); } @@ -1029,16 +1030,16 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq) // some rigs like FTDX101D cannot change non-TX vfo freq // but they can change the TX vfo - if ((is_ftdx101d || is_ftdx101mp) && rig->state.cache.ptt == RIG_PTT_ON) + if ((is_ftdx101d || is_ftdx101mp) && cachep->ptt == RIG_PTT_ON) { rig_debug(RIG_DEBUG_TRACE, "%s: ftdx101 check vfo OK, vfo=%s, tx_vfo=%s\n", __func__, rig_strvfo(vfo), rig_strvfo(rig->state.tx_vfo)); // when in split we can change VFOB but not VFOA - if (rig->state.cache.split == RIG_SPLIT_ON && target_vfo == '0') { return -RIG_ENTARGET; } + if (cachep->split == RIG_SPLIT_ON && target_vfo == '0') { return -RIG_ENTARGET; } // when not in split we can't change VFOA at all - if (rig->state.cache.split == RIG_SPLIT_OFF && target_vfo == '0') { return -RIG_ENTARGET; } + if (cachep->split == RIG_SPLIT_OFF && target_vfo == '0') { return -RIG_ENTARGET; } if (vfo != rig->state.tx_vfo) { return -RIG_ENTARGET; } } @@ -1077,7 +1078,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq) and select the correct VFO before setting the frequency */ // Plus we can't do the VFO swap if transmitting - if (target_vfo == '1' && rig->state.cache.ptt == RIG_PTT_ON) { RETURNFUNC(-RIG_ENTARGET); } + if (target_vfo == '1' && cachep->ptt == RIG_PTT_ON) { RETURNFUNC(-RIG_ENTARGET); } SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "VS%c", cat_term); @@ -1147,7 +1148,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq) if (newcat_valid_command(rig, "BS") && changing && !rig->state.disable_yaesu_bandselect // remove the split check here -- hopefully works OK - //&& !rig->state.cache.split + //&& !cachep->split // seems some rigs are problematic // && !(is_ftdx3000 || is_ftdx3000dm) // some rigs can't do BS command on 60M @@ -1331,8 +1332,8 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq) // just drop through } - rig_debug(RIG_DEBUG_ERR, "%s: is_ft991=%d, rig->state.cache.split=%d, vfo=%s\n", - __func__, is_ft991, rig->state.cache.split, rig_strvfo(vfo)); + rig_debug(RIG_DEBUG_ERR, "%s: is_ft991=%d, CACHE(rig)->split=%d, vfo=%s\n", + __func__, is_ft991, cachep->split, rig_strvfo(vfo)); if (priv->band_index < 0) { priv->band_index = newcat_band_index(freq); } @@ -1340,7 +1341,7 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq) // there are multiple bandstacks so we just use the 1st one if (is_ft991 && vfo == RIG_VFO_A && priv->band_index != newcat_band_index(freq)) { - if (rig->state.cache.split) + if (cachep->split) { // FT991/991A bandstack does not work in split mode // so for a VFOA change we stop split, change bands, change freq, enable split @@ -1493,16 +1494,17 @@ int newcat_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct newcat_priv_data *priv; + struct rig_cache *cachep = CACHE(rig); int err; rmode_t tmode; pbwidth_t twidth; - split_t split_save = rig->state.cache.split; + split_t split_save = cachep->split; priv = (struct newcat_priv_data *)rig->state.priv; ENTERFUNC; - if (newcat_60m_exception(rig, rig->state.cache.freqMainA, mode)) { RETURNFUNC(RIG_OK); } // we don't set mode in this case + if (newcat_60m_exception(rig, cachep->freqMainA, mode)) { RETURNFUNC(RIG_OK); } // we don't set mode in this case if (!newcat_valid_command(rig, "MD")) { @@ -1571,11 +1573,11 @@ int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN) { - rig->state.cache.modeMainA = mode; + cachep->modeMainA = mode; } else { - rig->state.cache.modeMainB = mode; + cachep->modeMainB = mode; } if (RIG_PASSBAND_NOCHANGE == width) { RETURNFUNC(err); } @@ -1705,7 +1707,7 @@ int newcat_set_vfo(RIG *rig, vfo_t vfo) rig_strvfo(vfo)); // we can't change VFO while transmitting - if (rig->state.cache.ptt == RIG_PTT_ON) { RETURNFUNC(RIG_OK); } + if (CACHE(rig)->ptt == RIG_PTT_ON) { RETURNFUNC(RIG_OK); } if (!newcat_valid_command(rig, command)) { @@ -2712,11 +2714,11 @@ int newcat_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, if (vfo == RIG_VFO_A || vfo == RIG_VFO_MAIN) { - rig->state.cache.modeMainA = tx_mode; + CACHE(rig)->modeMainA = tx_mode; } else { - rig->state.cache.modeMainB = tx_mode; + CACHE(rig)->modeMainB = tx_mode; } @@ -2758,8 +2760,8 @@ int newcat_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) RETURNFUNC(err); } - if (newcat_60m_exception(rig, rig->state.cache.freqMainA, - rig->state.cache.modeMainA)) + if (newcat_60m_exception(rig, CACHE(rig)->freqMainA, + CACHE(rig)->modeMainA)) { rig_debug(RIG_DEBUG_VERBOSE, "%s: force set_split off since we're on 60M exception\n", __func__); @@ -4088,7 +4090,8 @@ static int band2rig(hamlib_band_t band) int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { - struct rig_state *state = &rig->state; + struct rig_state *state = STATE(rig); + struct rig_cache *cachep = CACHE(rig); struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; int err; int i; @@ -4300,9 +4303,9 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) rmode_t exclude = RIG_MODE_CW | RIG_MODE_CWR | RIG_MODE_RTTY | RIG_MODE_RTTYR; - if ((rig->state.tx_vfo == RIG_VFO_A && (rig->state.cache.modeMainA & exclude)) - || (rig->state.tx_vfo == RIG_VFO_B && (rig->state.cache.modeMainB & exclude)) - || (rig->state.tx_vfo == RIG_VFO_C && (rig->state.cache.modeMainC & exclude))) + if ((rig->state.tx_vfo == RIG_VFO_A && (cachep->modeMainA & exclude)) + || (rig->state.tx_vfo == RIG_VFO_B && (cachep->modeMainB & exclude)) + || (rig->state.tx_vfo == RIG_VFO_C && (cachep->modeMainC & exclude))) { rig_debug(RIG_DEBUG_VERBOSE, "%s: rig cannot set MG in CW/RTTY modes\n", __func__); @@ -4906,7 +4909,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) if (is_ftdx101d || is_ftdx101mp) { rmode_t curmode = rig->state.current_vfo == RIG_VFO_A ? - rig->state.cache.modeMainA : rig->state.cache.modeMainB; + cachep->modeMainA : cachep->modeMainB; float valf = val.f / level_info->step.f; switch (curmode) @@ -4960,7 +4963,8 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { - struct rig_state *state = &rig->state; + struct rig_state *state = STATE(rig); + struct rig_cache *cachep = CACHE(rig); struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv; int err; int ret_data_len; @@ -5117,9 +5121,9 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) rmode_t exclude = RIG_MODE_CW | RIG_MODE_CWR | RIG_MODE_RTTY | RIG_MODE_RTTYR; - if ((rig->state.tx_vfo == RIG_VFO_A && (rig->state.cache.modeMainA & exclude)) - || (rig->state.tx_vfo == RIG_VFO_B && (rig->state.cache.modeMainB & exclude)) - || (rig->state.tx_vfo == RIG_VFO_C && (rig->state.cache.modeMainC & exclude))) + if ((rig->state.tx_vfo == RIG_VFO_A && (cachep->modeMainA & exclude)) + || (rig->state.tx_vfo == RIG_VFO_B && (cachep->modeMainB & exclude)) + || (rig->state.tx_vfo == RIG_VFO_C && (cachep->modeMainC & exclude))) { rig_debug(RIG_DEBUG_VERBOSE, "%s: rig cannot read MG in CW/RTTY modes\n", __func__); @@ -5502,7 +5506,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) if (is_ftdx101d || is_ftdx101mp) { rmode_t curmode = rig->state.current_vfo == RIG_VFO_A ? - rig->state.cache.modeMainA : rig->state.cache.modeMainB; + cachep->modeMainA : cachep->modeMainB; switch (curmode) { @@ -5544,7 +5548,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) if (is_ftdx101d || is_ftdx101mp) { rmode_t curmode = rig->state.current_vfo == RIG_VFO_A ? - rig->state.cache.modeMainA : rig->state.cache.modeMainB; + cachep->modeMainA : cachep->modeMainB; switch (curmode) { commit 609065775c49da604d38b46b3fee601910d06e5d Author: George Baltz N3GB <Geo...@gm...> Date: Fri Mar 8 10:28:03 2024 -0500 Update some of rigs/* to use pointer to cache Issue #536 diff --git a/rigs/dummy/dummy.c b/rigs/dummy/dummy.c index b61f24f8e..239a8a3d6 100644 --- a/rigs/dummy/dummy.c +++ b/rigs/dummy/dummy.c @@ -446,7 +446,7 @@ static int dummy_set_freq(RIG *rig, vfo_t vfo, freq_t freq) if (vfo == RIG_VFO_CURR) { vfo = priv->curr_vfo; } - if (vfo == RIG_VFO_CURR || vfo == RIG_VFO_TX) { vfo = vfo_fixup(rig, vfo, rig->state.cache.split); } + if (vfo == RIG_VFO_CURR || vfo == RIG_VFO_TX) { vfo = vfo_fixup(rig, vfo, CACHE(rig)->split); } // if needed for testing enable this to emulate a rig with 100hz resolution #if 0 @@ -534,6 +534,7 @@ static int dummy_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; + struct rig_cache *cachep = CACHE(rig); char buf[16]; ENTERFUNC; @@ -542,7 +543,7 @@ static int dummy_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s %s %s\n", __func__, rig_strvfo(vfo), rig_strrmode(mode), buf); - vfo = vfo_fixup(rig, vfo, rig->state.cache.split); + vfo = vfo_fixup(rig, vfo, cachep->split); if (vfo == RIG_VFO_CURR) { vfo = priv->curr_vfo; } @@ -587,7 +588,7 @@ static int dummy_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) RETURNFUNC(-RIG_EINVAL); } - vfo = vfo_fixup(rig, vfo, rig->state.cache.split); + vfo = vfo_fixup(rig, vfo, cachep->split); if (RIG_PASSBAND_NOCHANGE == width) { RETURNFUNC(RIG_OK); } @@ -1085,7 +1086,7 @@ static int dummy_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) if (tx_vfo == RIG_VFO_NONE || tx_vfo == RIG_VFO_CURR) { tx_vfo = priv->curr_vfo; } - if (tx_vfo == RIG_VFO_CURR || tx_vfo == RIG_VFO_TX) { tx_vfo = vfo_fixup(rig, vfo, rig->state.cache.split); } + if (tx_vfo == RIG_VFO_CURR || tx_vfo == RIG_VFO_TX) { tx_vfo = vfo_fixup(rig, vfo, CACHE(rig)->split); } priv->split = split; priv->tx_vfo = tx_vfo; diff --git a/rigs/icom/ic7300.c b/rigs/icom/ic7300.c index 9536beb35..98d010e60 100644 --- a/rigs/icom/ic7300.c +++ b/rigs/icom/ic7300.c @@ -2218,12 +2218,13 @@ int ic9700_set_vfo(RIG *rig, vfo_t vfo) int ack_len = sizeof(ackbuf); int retval; int vfo_is_main_or_sub = (vfo == RIG_VFO_MAIN) || (vfo == RIG_VFO_SUB); + struct rig_cache *cachep = CACHE(rig); ENTERFUNC; rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s\n", __func__, rig_strvfo(vfo)); - if (rig->state.cache.satmode && !vfo_is_main_or_sub) + if (cachep->satmode && !vfo_is_main_or_sub) { // Translate VFO A/B to Main/Sub in satellite mode if (vfo == RIG_VFO_A) @@ -2247,7 +2248,7 @@ int ic9700_set_vfo(RIG *rig, vfo_t vfo) } else if (vfo == RIG_VFO_B) { - if (rig->state.cache.satmode) + if (cachep->satmode) { rig_debug(RIG_DEBUG_WARN, "%s: cannot switch to VFOB when in satmode\n", __func__); @@ -2267,7 +2268,7 @@ int ic9700_set_vfo(RIG *rig, vfo_t vfo) return retval; } - if (rig->state.cache.satmode && vfo == RIG_VFO_MAIN_B) + if (cachep->satmode && vfo == RIG_VFO_MAIN_B) { rig_debug(RIG_DEBUG_WARN, "%s: cannot switch to VFOB when in satmode\n", __func__); // we return RIG_OK anyways as this should just be a bad request @@ -2290,7 +2291,7 @@ int ic9700_set_vfo(RIG *rig, vfo_t vfo) return retval; } - if (rig->state.cache.satmode && vfo == RIG_VFO_SUB_B) + if (cachep->satmode && vfo == RIG_VFO_SUB_B) { rig_debug(RIG_DEBUG_WARN, "%s: cannot switch to VFOB when in satmode\n", __func__); // we return RIG_OK anyways as this should just be a bad request diff --git a/rigs/icom/ic821h.c b/rigs/icom/ic821h.c index e8f4d33ea..3b6000f7a 100644 --- a/rigs/icom/ic821h.c +++ b/rigs/icom/ic821h.c @@ -64,10 +64,10 @@ int ic821h_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) if (tx_vfo == RIG_VFO_MAIN) { - rig->state.cache.satmode = + CACHE(rig)->satmode = split; // we emulate satmode of other rigs since we apparently can't query rig_debug(RIG_DEBUG_TRACE, "%s: tx_vfo==MAIN so assuming sat mode=%d\n", - __func__, rig->state.cache.satmode); + __func__, CACHE(rig)->satmode); rig->state.tx_vfo = split == RIG_SPLIT_ON ? RIG_VFO_SUB : RIG_VFO_MAIN; // the IC821 seems to be backwards in satmode -- setting Main select Sub and vice versa retval = rig_set_vfo(rig, RIG_VFO_SUB); diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index a5894f681..921259642 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -934,7 +934,8 @@ static vfo_t icom_current_vfo(RIG *rig) freq_t freq_current, freq_other, f... [truncated message content] |