hamlib-cvs-digest Mailing List for Ham Radio Control Libraries (Page 15)
Library to control radio transceivers and receivers
Brought to you by:
n0nb
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(57) |
Nov
(27) |
Dec
(25) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(41) |
Feb
(101) |
Mar
(60) |
Apr
(32) |
May
(32) |
Jun
(198) |
Jul
(95) |
Aug
(60) |
Sep
(48) |
Oct
(96) |
Nov
(27) |
Dec
(222) |
2002 |
Jan
(180) |
Feb
(46) |
Mar
(68) |
Apr
(11) |
May
(36) |
Jun
(34) |
Jul
(113) |
Aug
(42) |
Sep
(71) |
Oct
(65) |
Nov
(116) |
Dec
(40) |
2003 |
Jan
(32) |
Feb
(92) |
Mar
(29) |
Apr
(102) |
May
(21) |
Jun
(34) |
Jul
(3) |
Aug
(60) |
Sep
(30) |
Oct
(62) |
Nov
(57) |
Dec
(33) |
2004 |
Jan
(28) |
Feb
(46) |
Mar
(16) |
Apr
(14) |
May
(31) |
Jun
(21) |
Jul
(10) |
Aug
(80) |
Sep
(42) |
Oct
(11) |
Nov
(28) |
Dec
(13) |
2005 |
Jan
(35) |
Feb
(26) |
Mar
(20) |
Apr
(118) |
May
(2) |
Jun
(5) |
Jul
|
Aug
|
Sep
(5) |
Oct
(1) |
Nov
(13) |
Dec
(1) |
2006 |
Jan
(9) |
Feb
(25) |
Mar
(22) |
Apr
(6) |
May
|
Jun
|
Jul
(2) |
Aug
(1) |
Sep
(3) |
Oct
(46) |
Nov
(13) |
Dec
(7) |
2007 |
Jan
(9) |
Feb
(14) |
Mar
(3) |
Apr
|
May
(6) |
Jun
(1) |
Jul
|
Aug
(11) |
Sep
(7) |
Oct
(8) |
Nov
(41) |
Dec
(3) |
2008 |
Jan
(27) |
Feb
(16) |
Mar
(13) |
Apr
(23) |
May
(39) |
Jun
(4) |
Jul
(7) |
Aug
(1) |
Sep
(13) |
Oct
(52) |
Nov
(44) |
Dec
(55) |
2009 |
Jan
(72) |
Feb
(69) |
Mar
|
Apr
|
May
|
Jun
(13) |
Jul
(1) |
Aug
(6) |
Sep
(15) |
Oct
(11) |
Nov
(31) |
Dec
(20) |
2010 |
Jan
(24) |
Feb
(21) |
Mar
(22) |
Apr
(40) |
May
(38) |
Jun
(4) |
Jul
(2) |
Aug
(22) |
Sep
(19) |
Oct
(14) |
Nov
(5) |
Dec
(8) |
2011 |
Jan
(14) |
Feb
(36) |
Mar
(6) |
Apr
|
May
|
Jun
(23) |
Jul
(13) |
Aug
(8) |
Sep
(7) |
Oct
|
Nov
(3) |
Dec
(9) |
2012 |
Jan
(17) |
Feb
(13) |
Mar
(10) |
Apr
|
May
(1) |
Jun
(14) |
Jul
(4) |
Aug
(12) |
Sep
(2) |
Oct
(24) |
Nov
(14) |
Dec
(2) |
2013 |
Jan
(4) |
Feb
(3) |
Mar
(3) |
Apr
(3) |
May
(10) |
Jun
(4) |
Jul
(7) |
Aug
|
Sep
(15) |
Oct
(5) |
Nov
(1) |
Dec
(2) |
2014 |
Jan
|
Feb
(8) |
Mar
(1) |
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
(3) |
Oct
(7) |
Nov
(6) |
Dec
(3) |
2015 |
Jan
(4) |
Feb
(5) |
Mar
(8) |
Apr
(8) |
May
(2) |
Jun
|
Jul
(4) |
Aug
(7) |
Sep
(8) |
Oct
|
Nov
(6) |
Dec
(4) |
2016 |
Jan
(6) |
Feb
(26) |
Mar
(3) |
Apr
(10) |
May
(6) |
Jun
(5) |
Jul
(1) |
Aug
(4) |
Sep
(3) |
Oct
(4) |
Nov
(3) |
Dec
(10) |
2017 |
Jan
(11) |
Feb
(11) |
Mar
(2) |
Apr
(1) |
May
(7) |
Jun
(2) |
Jul
(11) |
Aug
(9) |
Sep
(5) |
Oct
(5) |
Nov
(1) |
Dec
(2) |
2018 |
Jan
(5) |
Feb
(2) |
Mar
(19) |
Apr
(7) |
May
(11) |
Jun
(3) |
Jul
(4) |
Aug
(10) |
Sep
(2) |
Oct
(8) |
Nov
(6) |
Dec
(9) |
2019 |
Jan
(9) |
Feb
(6) |
Mar
(2) |
Apr
(4) |
May
(6) |
Jun
(9) |
Jul
(6) |
Aug
(3) |
Sep
(5) |
Oct
(2) |
Nov
(8) |
Dec
(9) |
2020 |
Jan
(15) |
Feb
(1) |
Mar
(18) |
Apr
(33) |
May
(43) |
Jun
(87) |
Jul
(45) |
Aug
(8) |
Sep
(43) |
Oct
(3) |
Nov
(5) |
Dec
(42) |
2021 |
Jan
(116) |
Feb
(40) |
Mar
(58) |
Apr
(48) |
May
(29) |
Jun
(2) |
Jul
|
Aug
(22) |
Sep
(18) |
Oct
(1) |
Nov
|
Dec
(3) |
2022 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
(1) |
May
(2) |
Jun
(1) |
Jul
|
Aug
(1) |
Sep
|
Oct
(6) |
Nov
(2) |
Dec
(9) |
2023 |
Jan
(10) |
Feb
|
Mar
|
Apr
(10) |
May
(3) |
Jun
(1) |
Jul
(2) |
Aug
(4) |
Sep
(1) |
Oct
|
Nov
(2) |
Dec
(3) |
2024 |
Jan
(4) |
Feb
(1) |
Mar
(2) |
Apr
(2) |
May
(5) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(9) |
2025 |
Jan
(5) |
Feb
(5) |
Mar
|
Apr
(10) |
May
(20) |
Jun
(43) |
Jul
(24) |
Aug
(47) |
Sep
(38) |
Oct
(5) |
Nov
|
Dec
|
From: Nate B. <n0...@us...> - 2021-05-17 02:27:17
|
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 fbd07524e2291974b32b75241115c35b974b0dba (commit) via b679b0c75350bafd1404ccdca61ef3845d77abaf (commit) via 55ec759a75041897bec3dd114dc38b5f2bcc3c39 (commit) via 0ed6b110889286a7773f893b6d36e02e3fcefceb (commit) from 47cf24582626e44d028aaa66fe1ebc9b3d6fd760 (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 fbd07524e2291974b32b75241115c35b974b0dba Merge: 47cf2458 b679b0c7 Author: Nate Bargmann <n0...@n0...> Date: Sun May 16 21:26:14 2021 -0500 Merge pull request #701 from N0NB/doxygen_work Doxygen work commit b679b0c75350bafd1404ccdca61ef3845d77abaf Author: Nate Bargmann <n0...@n0...> Date: Sun May 16 21:14:04 2021 -0500 Update NEWS for 4.2 release diff --git a/NEWS b/NEWS index 683d706c..c82c9727 100644 --- a/NEWS +++ b/NEWS @@ -7,14 +7,14 @@ Copyright (C) 2000-2021 Michael Black W9MDB, and others Please send Hamlib bug reports to ham...@li... Version 4.2 - * 2021-04-27 + * 2021-05-17 * New rig_get_mode_bandwidths -- returns token set for bandwidths for given mode Rig command: \get_mode_bandwidths CW Mode=CW Normal=500Hz Narrow=50Hz Wide=2400Hz - * New rig_get_info -- returns token set for all vfos where order does not matter + * New rig_get_info -- returns token set for all vfos where order does not matter This is a string return to allow for easy future expansion without changing the API New tokens may be introduced and can be skipped if not used by clients Rig command: \get_rig_info @@ -37,13 +37,18 @@ Version 4.2 * USRP lib and gnuradio are deprecated and will be removed in 5.0 * Added Radan rotator - * Added Malachite SDR + * Added Malachite SDR * Major rework for PRM80 * Add twiddle_timeout and twiddle_rit --set-conf options - rigctld --set-conf=twiddle_timeout=5,twiddle_rit=1 + rigctld --set-conf=twiddle_timeout=5,twiddle_rit=1 This will set the twiddle timeout to 5 seconds and turn on twiddle_rit - For twiddle timeout VFOB will not be polled for 5 seconds after VFO twiddling is detected - rigctld --twiddle is deprecated and will be removed in 5.0 along with get_twiddle and set_twiddle + For twiddle timeout VFOB will not be polled for 5 seconds after VFO twiddling + is detected + * rigctld --twiddle is deprecated and will be removed in 5.0 along with + get_twiddle and set_twiddle + * Rework Doxygen manual including default layout for Doxygen 1.9.1. So far + the amplifier, rotator, and utilities API sections have been updated. The + rig (radio) section remains to be updated. Version 4.1 2021-01-31 commit 55ec759a75041897bec3dd114dc38b5f2bcc3c39 Author: Nate Bargmann <n0...@n0...> Date: Sun May 16 21:11:10 2021 -0500 Format to break lines before 80 characters diff --git a/README.freqranges b/README.freqranges index 6fe68b84..9d5ca122 100644 --- a/README.freqranges +++ b/README.freqranges @@ -1,9 +1,15 @@ -Frequency ranges are being changed to reflect rig capabilities instead of region restrictions +Frequency ranges are being changed to reflect rig capabilities instead of +region restrictions + As of 2020-05-05 the behavior is: + #1 Any range which shows ITU# or TBD has not been modified to this convention -#2 Ranges on the backends are being change to USA/EUR/KOR/TPE/ITR per the IC-9700 convention. So if you see one of those monikers on a rig's freq range it should accurately reflect the rig's capabilities. +#2 Ranges on the backends are being change to USA/EUR/KOR/TPE/ITR per the + IC-9700 convention. So if you see one of those monikers on a rig's freq + range it should accurately reflect the rig's capabilities. -Note that most rigs will have just USA or USA/EUR models. Not too many rigs have more than 2 models but it appears at least Icom is headed that way. +Note that most rigs will have just USA or USA/EUR models. Not too many rigs +have more than 2 models but it appears at least Icom is headed that way. USA - United States of America EUR - Europe @@ -12,5 +18,3 @@ TPE - Japan ITR - ?? AUS - Australia CHN - China - - commit 0ed6b110889286a7773f893b6d36e02e3fcefceb Author: Nate Bargmann <n0...@n0...> Date: Sun May 16 21:10:31 2021 -0500 Update Doxygen comments and main page diff --git a/doc/index.doxygen b/doc/index.doxygen index 366239c1..1d6103f0 100644 --- a/doc/index.doxygen +++ b/doc/index.doxygen @@ -1,10 +1,5 @@ /*! \mainpage Hamlib API Reference -\section auth Authors - -Stéphane Fillod, F8CFE, and Frank Singleton, VK3FCS and the Hamlib Group -\n Documentation revisions by Martin Ewing, AA6E, Nate Bargmann, N0NB, Michael Black, W9MDB - \section s1 Preface This document describes the Hamlib library Application Programming Interface @@ -14,18 +9,24 @@ We attempt to document the complete API of the core modules of Hamlib, i.e. the API seen by end-user application developers. You may navigate the documentation through the tabs at the top of this page. +\note This documentation is a work in progress. + Please report any problems to ham...@li.... \section txtfil Distributed information files These text files are distributed with the Hamlib package. -Readme files: \subpage Rdme "General"; +\li Readme files: \subpage Rdme "General"; \subpage Rdmebeta "Beta Tester"; \subpage Rdmedevel "Developer"; -\subpage Rdmewin "MS Windows" +\subpage Rdmewin "MS Windows"; +\subpage Rdmeosx "Mac OS X"; +\subpage Rdmefrq "Frequency range changes"; +\subpage Rdmemulti "Multicast support"; +\subpage Security "Security policy"; -Other files: \subpage INSTALL; +\li Other files: \subpage INSTALL; \subpage AUTHORS; \subpage COPYING; \subpage COPYING.LIB; @@ -44,10 +45,20 @@ Other files: \subpage INSTALL; \section slic Documentation License \li \subpage doclicense + +\section auth Authors + +\li Stéphane Fillod, F8CFE, and Frank Singleton, VK3FCS and the Hamlib Group +\li Documentation revisions by Martin Ewing, AA6E, Nate Bargmann, N0NB, +Michael Black, W9MDB and many others. */ + + +/* Subpage definitions follow. */ + /*! \page doclicense License for Documentation This documentation is free; you can redistribute it without -any restrictions. The modification or derived work must retain +any restrictions. The modification or derived work must retain copyright and list all authors. This documentation is distributed in the hope that it will be @@ -58,48 +69,81 @@ of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. /*! \page Rdme README (general) \verbinclude README */ + /*! \page Rdmebeta README.betatester \verbinclude README.betatester */ + /*! \page Rdmedevel README.developer \verbinclude README.developer */ + /*! \page Rdmewin Cross-compiling Hamlib on Linux for MS Windows This page contains the `scripts/README.build-Windows` instructions and the -`scripts/build-w32.sh` file that describe cross-compiling Hamlib for MS -Windows 32 bit on Debian GNU/Linux. +`scripts/build-w32.sh` and `scripts/build-w64.h` files that describe +cross-compiling Hamlib for MS Windows 32 and 64 bit versions on Debian +GNU/Linux. +\tableofcontents \section Build README.build-Windows \verbinclude README.build-Windows \subsection W32 The build-w32.sh script -\verbinclude build-w32.sh +\include{lineno} build-w32.sh \subsection W64 The build-w64.sh script -\verbinclude build-w64.sh +\include{lineno} build-w64.sh +*/ + +/*! \page Rdmeosx README.osx +\verbinclude README.osx */ + +/*! \page Rdmefrq README.freqranges +\verbinclude README.freqranges +*/ + +/*! \page Rdmemulti README.multicast +\verbinclude README.multicast +*/ + +/* FIXME: figure out how to include Markdown for HTML output. */ +/*! \page Security SECURITY.md +\include SECURITY.md +*/ + /*! \page INSTALL INSTALL \verbinclude INSTALL */ + /*! \page AUTHORS AUTHORS \verbinclude AUTHORS */ + /*! \page COPYING COPYING \verbinclude COPYING */ + /*! \page COPYING.LIB COPYING.LIB \verbinclude COPYING.LIB */ + /*! \page LICENSE LICENSE \verbinclude LICENSE */ + /*! \page NEWS NEWS \verbinclude NEWS */ + /*! \page PLAN PLAN \verbinclude PLAN */ + /*! \page THANKS THANKS \verbinclude THANKS */ + +/* Defined API groups--sections included with addtogroup in sources. */ + /*! Define groups for Doxygen * \defgroup rig Rig (transceiver) API * \defgroup rig_internal Rig (transceiver) Internal API diff --git a/src/locator.c b/src/locator.c index b7679549..07bd653b 100644 --- a/src/locator.c +++ b/src/locator.c @@ -1,17 +1,3 @@ -/** - * \addtogroup utilities - * @{ - */ - -/** - * \file src/locator.c - * \brief locator and bearing conversion interface - * \author Stephane Fillod and the Hamlib Group - * \date 2000-2010 - * - * Hamlib Interface - locator, bearing, and conversion calls - */ - /* * Hamlib Interface - locator and bearing conversion calls * Copyright (c) 2001-2010 by Stephane Fillod @@ -47,12 +33,49 @@ * */ -/*! \page hamlib Hamlib general purpose API + +/** + * \addtogroup utilities + * @{ + */ + +/** + * \file src/locator.c + * + * \brief QRA locator (Maidenhead grid square) and latitude/longitude bearing + * conversion interface. + * + * \author Stephane Fillod + * \author Nate Bargmann + * \author Dave Hines + * \author The Hamlib Group + * \date 2000-2020 + */ + +/** + * \page hamlib Hamlib general purpose API + * + * Hamlib function call interface for determining QRA locator (Maidenhead grid + * square), bearing, and conversion between QRA locator and latitude/longitude + * formats. + * + * \par Sources used in writing these routines * - * Here are grouped some often used functions, like locator conversion - * routines. + * \parblock + * Code to determine bearing and range was taken from the Great Circle, + * by Steven R. Sampson, N5OWK.<br /> + * Ref: "Air Navigation", Air Force Manual 51-40, 1 February 1987<br /> + * Ref: "ARRL Satellite Experimenters Handbook", August 1990 + * + * Code to calculate distance and azimuth between two QRA locators, taken from + * wwl, by IK0ZSN, Mirko Caserta. + * + * New bearing code added by N0NB was found at: + * http://williams.best.vwh.net/avform.htm#Crs + * \endparblock */ + #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -67,74 +90,93 @@ #include <hamlib/rotator.h> -#ifndef DOC_HIDDEN - +/** \brief Standard definition of a radian. */ #define RADIAN (180.0 / M_PI) -/* arc length for 1 degree, 60 Nautical Miles */ +/** \brief arc length for 1 degree in kilometers, i.e. 60 Nautical Miles */ #define ARC_IN_KM 111.2 + /* The following is contributed by Dave Hines M1CXW * * begin dph */ -/* - * These are the constants used when converting between Maidenhead grid - * locators and longitude/latitude values. MAX_LOCATOR_PAIRS is the maximum - * number of locator character pairs to convert. This number MUST NOT exceed - * the number of pairs of values in loc_char_range[]. - * Setting MAX_LOCATOR_PAIRS to 3 will convert the currently defined 6 - * character locators. A value of 4 will convert the extended 8 character - * locators described in section 3L of "The IARU region 1 VHF managers - * handbook". Values of 5 and 6 will extent the format even more, to the - * longest definition I have seen for locators, see - * http://www.btinternet.com/~g8yoa/geog/non-ra.html - * Beware that there seems to be no universally accepted standard for 10 & 12 - * character locators. - * - * The ranges of characters which will be accepted by locator2longlat, and - * generated by longlat2locator, are specified by the loc_char_range[] array. - * This array may be changed without requiring any other code changes. + +/* At this time documenting a single static variable as in loc_char_range[] + * below is not supported by Doxygen. Hide this section until support exists + * or a work-around becomes available. + */ +#ifndef DOC_HIDDEN + +/** + * \brief Constants used when converting between Maidenhead grid + * locators and longitude/latitude values. + * + * \ref MAX_LOCATOR_PAIRS is the maximum number of locator character pairs to + * convert. This number MUST NOT exceed the number of pairs of values in + * loc_char_range[]. Setting \ref MAX_LOCATOR_PAIRS to 3 will convert the + * currently defined 6 character locators. A value of 4 will convert the + * extended 8 character locators described in section 3L of "The IARU region 1 + * VHF managers handbook". Values of 5 and 6 will extent the format even + * more, to the longest definition I have seen for locators, see + * http://www.btinternet.com/~g8yoa/geog/non-ra.html (currently a dead + * link. -N0NB). Be aware that there seems to be no universally accepted + * standard for 10 & 12 character locators. + * + * The ranges of characters which will be accepted by locator2longlat(), and + * generated by longlat2locator(), are specified by the \ref loc_char_range[] + * array. This array may be changed without requiring any other code changes. * * For the fifth pair to range from aa to xx use: - * const static int loc_char_range[] = { 18, 10, 24, 10, 24, 10 }; + * \code const static int loc_char_range[] = { 18, 10, 24, 10, 24, 10 };\endcode * * For the fifth pair to range from aa to yy use: - * const static int loc_char_range[] = { 18, 10, 24, 10, 25, 10 }; - * - * MAX_LOCATOR_PAIRS now sets the limit locator2longlat() will convert and - * sets the maximum length longlat2locator() will generate. Each function - * properly handles any value from 1 to 6 so MAX_LOCATOR_PAIRS should be - * left at 6. MIN_LOCATOR_PAIRS sets a floor on the shortest locator that - * should be handled. -N0NB + * \code const static int loc_char_range[] = { 18, 10, 24, 10, 25, 10 };\endcode */ const static int loc_char_range[] = { 18, 10, 24, 10, 24, 10 }; +#endif /* !DOC_HIDDEN */ + +/** \def MAX_LOCATOR_PAIRS + * + * \brief Longest locator to process, e.g. AA00AA00AA00. + * + * Sets the limit locator2longlat() will convert and sets the maximum length + * longlat2locator() will generate. Each function properly handles any value + * from `1` to `6` so \ref MAX_LOCATOR_PAIRS should be left at `6`. + * + * \def MIN_LOCATOR_PAIRS + * + * \brief Shortest locator to process, e.g. AA. + * + * Sets a floor on the shortest locator that should be handled. + */ #define MAX_LOCATOR_PAIRS 6 #define MIN_LOCATOR_PAIRS 1 /* end dph */ -#endif /* !DOC_HIDDEN */ - /** - * \brief Convert DMS to decimal degrees - * \param degrees Degrees, whole degrees - * \param minutes Minutes, whole minutes - * \param seconds Seconds, decimal seconds - * \param sw South or West + * \brief Convert Degrees Minutes Seconds (DMS) notation to decimal degrees + * (D.DDD) angle. + * + * \param degrees Degrees, whole degrees. + * \param minutes Minutes, whole minutes. + * \param seconds Seconds, decimal seconds. + * \param sw South or West. * - * Convert degree/minute/second angle to decimal degrees angle. - * \a degrees >360, \a minutes > 60, and \a seconds > 60.0 are allowed, - * but resulting angle won't be normalized. + * Convert a Degrees Minutes Seconds (DMS) notation value to a decimal degrees + * (D.DDD) angle value. * - * When the variable sw is passed a value of 1, the returned decimal - * degrees value will be negative (south or west). When passed a - * value of 0 the returned decimal degrees value will be positive - * (north or east). + * \note For the parameters \a degrees >360, \a minutes > 60, and \a seconds > + * 60.0 are allowed, but the resulting angle will not be normalized. * - * \return The angle in decimal degrees. + * When the variable \a sw is passed a value of 1, the returned decimal + * degrees value will be negative (*South* or *West*). When passed a value of 0 + * the returned decimal degrees value will be positive (*North* or *East*). + * + * \return The signed angle in decimal degrees (D.DDD). * * \sa dec2dms() */ @@ -173,23 +215,25 @@ double HAMLIB_API dms2dec(int degrees, int minutes, double seconds, int sw) /** - * \brief Convert D M.MMM notation to decimal degrees - * \param degrees Degrees, whole degrees - * \param minutes Minutes, decimal minutes - * \param sw South or West + * \brief Convert degrees decimal minutes (D M.MMM) notation to decimal + * degrees (D.DDD) angle. + * + * \param degrees Degrees, whole degrees. + * \param minutes Minutes, decimal minutes. + * \param seconds Seconds, decimal seconds. + * \param sw South or West. * - * Convert a degrees, decimal minutes notation common on - * many GPS units to its decimal degrees value. + * Convert a degrees decimal minutes (D M.MMM) notation common on many GPS + * units to a decimal degrees (D.DDD) angle value. * - * \a degrees > 360, \a minutes > 60.0 are allowed, but - * resulting angle won't be normalized. + * \note For the parameters \a degrees > 360, \a minutes > 60.0, \a seconds > + * 60.0 are allowed, but the resulting angle will not be normalized. * - * When the variable sw is passed a value of 1, the returned decimal - * degrees value will be negative (south or west). When passed a - * value of 0 the returned decimal degrees value will be positive - * (north or east). + * When the variable \a sw is passed a value of 1, the returned decimal + * degrees value will be negative (*South* or *West*). When passed a value of + * 0 the returned decimal degrees value will be positive (*North* or *East*). * - * \return The angle in decimal degrees. + * \return The signed angle in decimal degrees (D.DDD). * * \sa dec2dmmm() */ @@ -223,29 +267,33 @@ double HAMLIB_API dmmm2dec(int degrees, double minutes, double seconds, int sw) /** - * \brief Convert decimal degrees angle into DMS notation - * \param dec Decimal degrees - * \param degrees Pointer for the calculated whole Degrees - * \param minutes Pointer for the calculated whole Minutes - * \param seconds Pointer for the calculated decimal Seconds - * \param sw Pointer for the calculated SW flag + * \brief Convert a decimal degrees (D.DDD) angle into Degrees Minutes + * Seconds (DMS) notation. + * + * \param dec Decimal degrees (D.DDD). + * \param degrees Pointer for the calculated whole Degrees. + * \param minutes Pointer for the calculated whole Minutes. + * \param seconds Pointer for the calculated decimal Seconds. + * \param sw Pointer for the calculated SW (South/West) flag. + * + * Convert decimal degrees angle (D.DDD) into its Degree Minute Second (DMS) + * notation. * - * Convert decimal degrees angle into its degree/minute/second - * notation. + * When \a dec < -180 or \a dec > 180, the angle will be normalized within + * these limits and the sign set appropriately. * - * When \a dec < -180 or \a dec > 180, the angle will be normalized - * within these limits and the sign set appropriately. + * Upon return, guarantees 0 >= \a degrees <= 180, 0 >= \a minutes < 60, and + * 0.0 >= \a seconds < 60.0. * - * Upon return dec2dms guarantees 0 >= \a degrees <= 180, - * 0 >= \a minutes < 60, and 0.0 >= \a seconds < 60.0. + * When \a dec is < 0.0 \a sw will be set to 1. When \a dec is >= 0.0 \a sw + * will be set to 0. This flag allows the application to determine whether + * the DMS angle should be treated as negative (*South* or *West*). * - * When \a dec is < 0.0 \a sw will be set to 1. When \a dec is - * >= 0.0 \a sw will be set to 0. This flag allows the application - * to determine whether the DMS angle should be treated as negative - * (south or west). + * \return RIG_OK if the operation has been successful, otherwise a **negative + * value** if an error occurred (in which case, cause is set appropriately). * - * \retval -RIG_EINVAL if any of the pointers are NULL. - * \retval RIG_OK if conversion went OK. + * \retval RIG_OK The conversion was successful. + * \retval RIG_EINVAL Either of the pointers are NULL. * * \sa dms2dec() */ @@ -317,28 +365,33 @@ int HAMLIB_API dec2dms(double dec, /** - * \brief Convert a decimal angle into D M.MMM notation - * \param dec Decimal degrees - * \param degrees Pointer for the calculated whole Degrees - * \param minutes Pointer for the calculated decimal Minutes - * \param sw Pointer for the calculated SW flag + * \brief Convert a decimal degrees (D.DDD) angle into degrees decimal minutes + * (D M.MMM) notation. * - * Convert a decimal angle into its degree, decimal minute - * notation common on many GPS units. + * \param dec Decimal degrees angle. + * \param degrees Pointer for the calculated whole Degrees. + * \param minutes Pointer for the calculated decimal Minutes. + * \param sw Pointer for the calculated SW flag. * - * When passed a value < -180 or > 180, the value will be normalized - * within these limits and the sign set apropriately. + * Convert a decimal angle into its degree, decimal minute + * notation common on many GPS units. * - * Upon return dec2dmmm guarantees 0 >= \a degrees <= 180, - * 0.0 >= \a minutes < 60.0. + * When passed a value < -180 or > 180, the value will be normalized + * within these limits and the sign set apropriately. * - * When \a dec is < 0.0 \a sw will be set to 1. When \a dec is - * >= 0.0 \a sw will be set to 0. This flag allows the application - * to determine whether the D M.MMM angle should be treated as negative - * (south or west). + * Upon return dec2dmmm guarantees 0 >= \a degrees <= 180, + * 0.0 >= \a minutes < 60.0. * - * \retval -RIG_EINVAL if any of the pointers are NULL. - * \retval RIG_OK if conversion went OK. + * When \a dec is < 0.0 \a sw will be set to 1. When \a dec is + * >= 0.0 \a sw will be set to 0. This flag allows the application + * to determine whether the D M.MMM angle should be treated as negative + * (south or west). + * + * \return RIG_OK if the operation has been successful, otherwise a **negative + * value** if an error occurred (in which case, cause is set appropriately). + * + * \retval RIG_OK The conversion was successful. + * \retval RIG_EINVAL Either of the pointers are NULL. * * \sa dmmm2dec() */ @@ -369,23 +422,27 @@ int HAMLIB_API dec2dmmm(double dec, int *degrees, double *minutes, int *sw) /** - * \brief Convert Maidenhead grid locator to Longitude/Latitude - * \param longitude Pointer for the calculated Longitude - * \param latitude Pointer for the calculated Latitude - * \param locator The Maidenhead grid locator--2 through 12 char + nul string + * \brief Convert QRA locator (Maidenhead grid square) to Longitude/Latitude. + * + * \param longitude Pointer for the calculated Longitude. + * \param latitude Pointer for the calculated Latitude. + * \param locator The QRA locator--2 through 12 characters + nul string. + * + * Convert a QRA locator string to Longitude/Latitude in decimal degrees + * (D.DDD). The locator should be 2 through 12 chars long format. + * \a locator2longlat is case insensitive, however it checks for locator + * validity. * - * Convert Maidenhead grid locator to Longitude/Latitude (decimal degrees). - * The locator should be in 2 through 12 chars long format. - * \a locator2longlat is case insensitive, however it checks for - * locator validity. + * Decimal long/lat is computed to center of grid square, i.e. given + * `EM19` will return coordinates equivalent to the southwest corner + * of `EM19mm`. * - * Decimal long/lat is computed to center of grid square, i.e. given - * EM19 will return coordinates equivalent to the southwest corner - * of EM19mm. + * \return RIG_OK if the operation has been successful, otherwise a **negative + * value** if an error occurred (in which case, cause is set appropriately). * - * \retval -RIG_EINVAL if locator exceeds RR99xx99xx99 or exceeds length - * limit--currently 1 to 6 lon/lat pairs. - * \retval RIG_OK if conversion went OK. + * \retval RIG_OK The conversion was successful. + * \retval RIG_EINVAL The QRA locator exceeds RR99xx99xx99 or exceeds length + * limit--currently 1 to 6 lon/lat pairs--or is otherwise malformed. * * \bug The fifth pair ranges from aa to xx, there is another convention * that ranges from aa to yy. At some point both conventions should be @@ -461,23 +518,29 @@ int HAMLIB_API locator2longlat(double *longitude, /** - * \brief Convert longitude/latitude to Maidenhead grid locator - * \param longitude Longitude, decimal degrees - * \param latitude Latitude, decimal degrees - * \param locator Pointer for the Maidenhead Locator - * \param pair_count Precision expressed as lon/lat pairs in the locator + * \brief Convert longitude/latitude to QRA locator (Maidenhead grid square). * - * Convert longitude/latitude (decimal degrees) to Maidenhead grid locator. - * \a locator must point to an array at least \a pair_count * 2 char + '\\0'. + * \param longitude Longitude, decimal degrees. + * \param latitude Latitude, decimal degrees. + * \param locator Pointer for the QRA Locator. + * \param pair_count Requested precision expressed as lon/lat pairs in the + * returned QRA locator string. * - * \retval -RIG_EINVAL if \a locator is NULL or \a pair_count exceeds - * length limit. Currently 1 to 6 lon/lat pairs. - * \retval RIG_OK if conversion went OK. + * Convert longitude/latitude given in decimal degrees (D.DDD) to a QRA + * locator (Maidenhead grid square). \a locator must point to an array length + * that is at least \a pair_count * 2 char + '\\0'. + * + * \return RIG_OK if the operation has been successful, otherwise a **negative + * value** if an error occurred (in which case, cause is set appropriately). + * + * \retval RIG_OK The conversion was successful. + * \retval RIG_EINVAL if \a locator is NULL or \a pair_count exceeds length + * limit. Currently 1 to 6 lon/lat pairs. * * \bug \a locator is not tested for overflow. * \bug The fifth pair ranges from aa to yy, there is another convention - * that ranges from aa to xx. At some point both conventions should be - * supported. + * that ranges from aa to xx. At some point both conventions should be + * supported. * * \sa locator2longlat() */ @@ -531,26 +594,28 @@ int HAMLIB_API longlat2locator(double longitude, /** * \brief Calculate the distance and bearing between two points. - * \param lon1 The local Longitude, decimal degrees - * \param lat1 The local Latitude, decimal degrees - * \param lon2 The remote Longitude, decimal degrees - * \param lat2 The remote Latitude, decimal degrees - * \param distance Pointer for the distance, km - * \param azimuth Pointer for the bearing, decimal degrees * - * Calculate the QRB between \a lon1, \a lat1 and \a lon2, \a lat2. + * \param lon1 The local Longitude, decimal degrees. + * \param lat1 The local Latitude, decimal degrees, + * \param lon2 The remote Longitude, decimal degrees. + * \param lat2 The remote Latitude, decimal degrees. + * \param distance Pointer for the distance, km. + * \param azimuth Pointer for the bearing, decimal degrees. * - * This version will calculate the QRB to a precision sufficient - * for 12 character locators. Antipodal points, which are easily - * calculated, are considered equidistant and the bearing is - * simply resolved to be true north (0.0). + * Calculate the distance and bearing (QRB) between \a lon1, \a lat1 and + * \a lon2, \a lat2. * - * \retval -RIG_EINVAL if NULL pointer passed or lat and lon values - * exceed -90 to 90 or -180 to 180. - * \retval RIG_OK if calculations are successful. + * This version will calculate the QRB to a precision sufficient for 12 + * character locators. Antipodal points, which are easily calculated, are + * considered equidistant and the bearing is simply resolved to be true north, + * e.g. \a azimuth = 0.0. * - * \return The distance in kilometers and azimuth in decimal degrees - * for the short path are stored in \a distance and \a azimuth. + * \return RIG_OK if the operation has been successful, otherwise a **negative + * value** if an error occurred (in which case, cause is set appropriately). + * + * \retval RIG_OK The calculations were successful. + * \retval RIG_EINVAL If a NULL pointer passed or \a lat and \a lon values + * exceed -90 to 90 or -180 to 180. * * \sa distance_long_path(), azimuth_long_path() */ @@ -664,12 +729,13 @@ int HAMLIB_API qrb(double lon1, /** * \brief Calculate the long path distance between two points. - * \param distance The shortpath distance * - * Calculate the long path (respective of the short path) - * of a given distance. + * \param distance The shortpath distance in kilometers. * - * \return the distance in kilometers for the opposite path. + * Calculate the long path (opposite bearing of the short path) of a given + * distance. + * + * \return The distance in kilometers for the opposite path. * * \sa qrb() */ @@ -683,13 +749,13 @@ double HAMLIB_API distance_long_path(double distance) /** * \brief Calculate the long path bearing between two points. - * \param azimuth The shortpath bearing--0.0 to 360.0 degrees * - * Calculate the long path (respective of the short path) - * of a given bearing. + * \param azimuth The shortpath bearing--0.0 to 360.0 degrees. + * + * Calculate the long path (opposite of the short path) of a given bearing. * - * \return the azimuth in decimal degrees for the opposite path or - * -RIG_EINVAL upon input error (outside the range of 0.0 to 360.0). + * \return the azimuth in decimal degrees for the opposite path or RIG_EINVAL + * (negated value) upon input error (outside the range of 0.0 to 360.0). * * \sa qrb() */ ----------------------------------------------------------------------- Summary of changes: NEWS | 17 ++- README.freqranges | 14 +- doc/index.doxygen | 70 ++++++++-- src/locator.c | 384 ++++++++++++++++++++++++++++++++---------------------- 4 files changed, 302 insertions(+), 183 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-05-13 03:46:37
|
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 47cf24582626e44d028aaa66fe1ebc9b3d6fd760 (commit) from dd4e631e598084355e7d6ea9cd855d7af2370096 (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 47cf24582626e44d028aaa66fe1ebc9b3d6fd760 Author: Mike Black W9MDB <mdb...@ya...> Date: Wed May 12 22:44:33 2021 -0500 Fix +\get_vfo_list to put RPRT on a separate line diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 69df31ab..da3ff16d 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -2294,7 +2294,7 @@ declare_proto_rig(get_vfo_list) fprintf(fout, "%s: ", cmd->arg1); } - fprintf(fout, "%s%c", prntbuf[0] ? prntbuf : "None", ext_resp); + fprintf(fout, "%s%c\n", prntbuf[0] ? prntbuf : "None", ext_resp); RETURNFUNC(RIG_OK); } ----------------------------------------------------------------------- Summary of changes: tests/rigctl_parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-05-12 21:50:20
|
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 dd4e631e598084355e7d6ea9cd855d7af2370096 (commit) via 252a3ead630d6fecd312455ab8cd309db685f3c7 (commit) from 94410f7a7176586190386119ad90275fbc9e3005 (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 dd4e631e598084355e7d6ea9cd855d7af2370096 Merge: 94410f7a 252a3ead Author: Michael Black <mdb...@ya...> Date: Wed May 12 16:42:46 2021 -0500 Merge pull request #699 from mikaelnousiainen/fix-yaesu-targetable-roofing-filter Fix Yaesu roofing filter VFO targeting commit 252a3ead630d6fecd312455ab8cd309db685f3c7 Author: Mikael Nousiainen <mik...@ik...> Date: Wed May 12 23:51:35 2021 +0300 Add RIG_TARGETABLE_ROOFING to allow Yaesu roofing filter targeting by VFO only for FTDX5000 and FTDX101. Fix TS-480 VOXDELAY level definition. diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index c148b433..68014eb9 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -503,6 +503,7 @@ typedef unsigned int vfo_t; #define RIG_TARGETABLE_MEM (1<<8) #define RIG_TARGETABLE_BANK (1<<9) #define RIG_TARGETABLE_ANT (1<<10) +#define RIG_TARGETABLE_ROOFING (1<<11) // roofing filter targetable by VFO #define RIG_TARGETABLE_COMMON (RIG_TARGETABLE_RITXIT | RIG_TARGETABLE_PTT | RIG_TARGETABLE_MEM | RIG_TARGETABLE_BANK) #define RIG_TARGETABLE_ALL 0x7fffffff //! @endcond diff --git a/rigs/kenwood/ts480.c b/rigs/kenwood/ts480.c index a18237dc..112bce34 100644 --- a/rigs/kenwood/ts480.c +++ b/rigs/kenwood/ts480.c @@ -1382,7 +1382,7 @@ const struct rig_caps ts480_caps = .vfo_ops = TS480_VFO_OPS, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, - [LVL_VOXDELAY] = { .min = { .i = 0 }, .max = { .i = 3000 }, .step = { .i = 150 } }, + [LVL_VOXDELAY] = { .min = { .i = 0 }, .max = { .i = 30 }, .step = { .i = 1 } }, [LVL_KEYSPD] = {.min = {.i = 10}, .max = {.i = 60}, .step = {.i = 1}}, [LVL_CWPITCH] = {.min = {.i = 400}, .max = {.i = 1000}, .step = {.i = 50}}, [LVL_BKIN_DLYMS] = {.min = {.i = 0}, .max = {.i = 1000}, .step = {.i = 50}}, diff --git a/rigs/yaesu/ft5000.c b/rigs/yaesu/ft5000.c index 4baeecb3..eef1d3b0 100644 --- a/rigs/yaesu/ft5000.c +++ b/rigs/yaesu/ft5000.c @@ -126,7 +126,7 @@ const struct rig_caps ftdx5000_caps = .max_xit = Hz(9999), .max_ifshift = Hz(1000), .vfo_ops = FTDX5000_VFO_OPS, - .targetable_vfo = RIG_TARGETABLE_FREQ | RIG_TARGETABLE_MODE | RIG_TARGETABLE_FUNC | RIG_TARGETABLE_LEVEL | RIG_TARGETABLE_ANT, + .targetable_vfo = RIG_TARGETABLE_FREQ | RIG_TARGETABLE_MODE | RIG_TARGETABLE_FUNC | RIG_TARGETABLE_LEVEL | RIG_TARGETABLE_ANT | RIG_TARGETABLE_ROOFING, .transceive = RIG_TRN_OFF, /* May enable later as the 5000 has an Auto Info command */ .bank_qty = 0, .chan_desc_sz = 0, diff --git a/rigs/yaesu/ftdx101.c b/rigs/yaesu/ftdx101.c index b7220ce0..a85dbbb7 100644 --- a/rigs/yaesu/ftdx101.c +++ b/rigs/yaesu/ftdx101.c @@ -113,7 +113,7 @@ const struct rig_caps ftdx101d_caps = .max_xit = Hz(9999), .max_ifshift = Hz(1200), .vfo_ops = FTDX101_VFO_OPS, - .targetable_vfo = RIG_TARGETABLE_FREQ | RIG_TARGETABLE_MODE | RIG_TARGETABLE_FUNC | RIG_TARGETABLE_LEVEL | RIG_TARGETABLE_COMMON | RIG_TARGETABLE_ANT, + .targetable_vfo = RIG_TARGETABLE_FREQ | RIG_TARGETABLE_MODE | RIG_TARGETABLE_FUNC | RIG_TARGETABLE_LEVEL | RIG_TARGETABLE_COMMON | RIG_TARGETABLE_ANT | RIG_TARGETABLE_ROOFING, .transceive = RIG_TRN_OFF, /* May enable later as the FTDX101 has an Auto Info command */ .bank_qty = 0, .chan_desc_sz = 0, diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 8ed66d2d..32439aa9 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -7994,7 +7994,7 @@ static int set_roofing_filter(RIG *rig, vfo_t vfo, int index) roofing_filters = priv_caps->roofing_filters; - if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_ROOFING) { main_sub_vfo = (RIG_VFO_B == vfo || RIG_VFO_SUB == vfo) ? '1' : '0'; } @@ -8100,7 +8100,7 @@ static int get_roofing_filter(RIG *rig, vfo_t vfo, roofing_filters = priv_caps->roofing_filters; - if (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE) + if (rig->caps->targetable_vfo & RIG_TARGETABLE_ROOFING) { main_sub_vfo = (RIG_VFO_B == vfo || RIG_VFO_SUB == vfo) ? '1' : '0'; } ----------------------------------------------------------------------- Summary of changes: include/hamlib/rig.h | 1 + rigs/kenwood/ts480.c | 2 +- rigs/yaesu/ft5000.c | 2 +- rigs/yaesu/ftdx101.c | 2 +- rigs/yaesu/newcat.c | 4 ++-- 5 files changed, 6 insertions(+), 5 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-05-11 16:59:51
|
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 94410f7a7176586190386119ad90275fbc9e3005 (commit) via 9902ec796cc4928831c46d7c6d32aa005465d4bd (commit) via 62d9da91decaa00f66069a46a98a1bdc9dbe7d8b (commit) via 62a35a41c64e1083e1428a458093f7c3add4c49a (commit) via 7d4ac08ca618f6cea3cc162763fc0af78c6c8f22 (commit) via b849e00e1da2b12fca21e67dbb0399bffc051bdd (commit) via 3da8bb344a6ee7083259909193be1521cbc1217a (commit) from 1bbe783e05ef0c089a3739be2a486e6c95d89934 (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 94410f7a7176586190386119ad90275fbc9e3005 Author: Mike Black W9MDB <mdb...@ya...> Date: Tue May 11 11:59:20 2021 -0500 Increase FLRig timeout to 5 seconds diff --git a/rigs/dummy/flrig.c b/rigs/dummy/flrig.c index fca7c0e6..fa72bcb6 100644 --- a/rigs/dummy/flrig.c +++ b/rigs/dummy/flrig.c @@ -144,7 +144,7 @@ const struct rig_caps flrig_caps = RIG_MODEL(RIG_MODEL_FLRIG), .model_name = "FLRig", .mfg_name = "FLRig", - .version = "20210409", + .version = "20210511", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -153,7 +153,7 @@ const struct rig_caps flrig_caps = .port_type = RIG_PORT_NETWORK, .write_delay = 0, .post_write_delay = 0, - .timeout = 2000, + .timeout = 5000, .retry = 2, .has_get_func = RIG_FUNC_NONE, commit 9902ec796cc4928831c46d7c6d32aa005465d4bd Author: Mike Black W9MDB <mdb...@ya...> Date: Sun May 9 15:16:23 2021 -0500 Reduce rigctld verbosity when using direct commands from rigctl client https://github.com/Hamlib/Hamlib/issues/690 diff --git a/tests/Makefile.am b/tests/Makefile.am index df6cdb60..7d7a835e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -31,7 +31,7 @@ rigctl_CPPFLAGS = -I$(top_builddir)/tests -I$(top_builddir)/src -I$(srcdir) $(AM # all the programs need this LDADD = $(top_builddir)/src/libhamlib.la $(top_builddir)/lib/libmisc.la $(DL_LIBS) -rigmem_CFLAGS = $(AM_CFLAGS) $(LIBXML2_CFLAGS) +rigmem_CFLAGS = $(AM_CFLAGS) $(LIBXML2_CFLAGS) -I$(top_builddir)/src rigctld_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_builddir)/src rotctl_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_builddir)/src rotctld_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_builddir)/src diff --git a/tests/rigctld.c b/tests/rigctld.c index f43a1491..4dd07053 100644 --- a/tests/rigctld.c +++ b/tests/rigctld.c @@ -1088,7 +1088,7 @@ void *handle_socket(void *arg) sync_callback, 1, 0, &handle_data_arg->vfo_mode, send_cmd_term, &ext_resp, &resp_sep); - if (retcode != 0) { rig_debug(RIG_DEBUG_ERR, "%s: rigctl_parse retcode=%d\n", __func__, retcode); } + if (retcode != 0) { rig_debug(RIG_DEBUG_VERBOSE, "%s: rigctl_parse retcode=%d\n", __func__, retcode); } } else { commit 62d9da91decaa00f66069a46a98a1bdc9dbe7d8b Merge: 62a35a41 7d4ac08c Author: Mike Black W9MDB <mdb...@ya...> Date: Sun May 9 13:51:09 2021 -0500 Merge branch 'master' of https://github.com/Hamlib/Hamlib commit 62a35a41c64e1083e1428a458093f7c3add4c49a Author: Mike Black W9MDB <mdb...@ya...> Date: Sun May 9 13:48:03 2021 -0500 Adding proposal for multicast rig status/control https://github.com/Hamlib/Hamlib/issues/695 diff --git a/README.multicast b/README.multicast new file mode 100644 index 00000000..150788d1 --- /dev/null +++ b/README.multicast @@ -0,0 +1,54 @@ +Planned for version 4.3 -- comments/suggestions about this are more than welcome +Multicast UDP broadcast on port 4531 (one below rigctld 4532) +Bidirectional rig control and status +Choice of token pairs or JSON +All packets will be tagged with ID=[unique name] -- so multiple rigs can broadcast/rx on the same port + + +Broadcast packet contents to be based on get_rig_info output +This will be the text format of name=value pairs +Can be multiple VFO lines +Parsers should allow for unknown tags that may be added in the future + +Rig command: \get_rig_info +Rig command: \get_rig_info +VFO=Main Freq=145000000 Mode=None Width=0 RX=1 TX=1 +VFO=VFOB Freq=145000000 Mode=FM Width=15000 RX=0 TX=0 +Split=0 SatMode=0 +PTT=1 (1=On, 0=Off) +Rig=Dummy (name of connected rig) +App=Hamlib (name of application providing the packet) +Version=20210429 (version YYYYMMDD) -- reverse compatibilty will be maintained +Status=OK (possible values OK, Offline, Error) +ErrorMsg=msg text (pipe delimited multi-line error message) +CRC=0xf49f4708 (this is just an example CRC and not accurate for this example) + +Example JSON +{ + "VFO1": { // unlimited number of VFOs possible + "VFO": "VFOA", + "Freq": 14074000, // Hz + "Mode": "USB", + "Width": 5000, .. // Hz + "RX": 0, // boolean values 0 = off, 1 = on + "TX": 0, + }, + "VFO2": { + "VFO": "VFOB", + "Freq": 14076000, + "Mode": "USB", + "Width": 5000, + "RX": 0, + "TX": 0, + }, + "Split": 0, + "SatMode": 0 + "ID": "Rig#1", // customizable rig identification + "Rig": "Dummy", + "App": "Hamlib", + "Version": "20210429", // protocol version date YYYYMMDD + "Seq": 1, // 1-up sequence number 32-bit -- wraps around to 1 from 2^32-1 + "CRC": "0xf49f4708" // 32-bit CRC of all data replacing the CRC value with 0x00000000 +} + +Will be able to set freq, mode, width, ptt commit 7d4ac08ca618f6cea3cc162763fc0af78c6c8f22 Author: Mike Black W9MDB <mdb...@ya...> Date: Sun May 9 13:48:03 2021 -0500 Adding proposal for multicast rig status/control diff --git a/README.multicast b/README.multicast new file mode 100644 index 00000000..150788d1 --- /dev/null +++ b/README.multicast @@ -0,0 +1,54 @@ +Planned for version 4.3 -- comments/suggestions about this are more than welcome +Multicast UDP broadcast on port 4531 (one below rigctld 4532) +Bidirectional rig control and status +Choice of token pairs or JSON +All packets will be tagged with ID=[unique name] -- so multiple rigs can broadcast/rx on the same port + + +Broadcast packet contents to be based on get_rig_info output +This will be the text format of name=value pairs +Can be multiple VFO lines +Parsers should allow for unknown tags that may be added in the future + +Rig command: \get_rig_info +Rig command: \get_rig_info +VFO=Main Freq=145000000 Mode=None Width=0 RX=1 TX=1 +VFO=VFOB Freq=145000000 Mode=FM Width=15000 RX=0 TX=0 +Split=0 SatMode=0 +PTT=1 (1=On, 0=Off) +Rig=Dummy (name of connected rig) +App=Hamlib (name of application providing the packet) +Version=20210429 (version YYYYMMDD) -- reverse compatibilty will be maintained +Status=OK (possible values OK, Offline, Error) +ErrorMsg=msg text (pipe delimited multi-line error message) +CRC=0xf49f4708 (this is just an example CRC and not accurate for this example) + +Example JSON +{ + "VFO1": { // unlimited number of VFOs possible + "VFO": "VFOA", + "Freq": 14074000, // Hz + "Mode": "USB", + "Width": 5000, .. // Hz + "RX": 0, // boolean values 0 = off, 1 = on + "TX": 0, + }, + "VFO2": { + "VFO": "VFOB", + "Freq": 14076000, + "Mode": "USB", + "Width": 5000, + "RX": 0, + "TX": 0, + }, + "Split": 0, + "SatMode": 0 + "ID": "Rig#1", // customizable rig identification + "Rig": "Dummy", + "App": "Hamlib", + "Version": "20210429", // protocol version date YYYYMMDD + "Seq": 1, // 1-up sequence number 32-bit -- wraps around to 1 from 2^32-1 + "CRC": "0xf49f4708" // 32-bit CRC of all data replacing the CRC value with 0x00000000 +} + +Will be able to set freq, mode, width, ptt commit b849e00e1da2b12fca21e67dbb0399bffc051bdd Author: Mike Black W9MDB <mdb...@ya...> Date: Sun May 9 13:47:21 2021 -0500 Fix caching error -- check value instead of pointer....duh.... https://github.com/Hamlib/Hamlib/issues/694 diff --git a/src/rig.c b/src/rig.c index 40f2bea0..ef78b831 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1977,7 +1977,7 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) cache_show(rig, __func__, __LINE__); - if (freq != 0 && cache_ms_freq < rig->state.cache.timeout_ms) + if (*freq != 0 && cache_ms_freq < rig->state.cache.timeout_ms) { rig_debug(RIG_DEBUG_TRACE, "%s: %s cache hit age=%dms, freq=%.0f\n", __func__, rig_strvfo(vfo), cache_ms_freq, *freq); commit 3da8bb344a6ee7083259909193be1521cbc1217a Author: Mike Black W9MDB <mdb...@ya...> Date: Sun May 9 13:46:33 2021 -0500 New format for freq in memcsv.c diff --git a/tests/memcsv.c b/tests/memcsv.c index d6dc9439..241a5ece 100644 --- a/tests/memcsv.c +++ b/tests/memcsv.c @@ -607,7 +607,7 @@ int dump_csv_chan(RIG *rig, if (mem_caps->freq) { - fprintf(f, "%.0"PRIfreq"%c", chan.freq, csv_sep); + fprintf(f, "%"PRIfreq"%c", chan.freq, csv_sep); } if (mem_caps->mode) @@ -622,7 +622,7 @@ int dump_csv_chan(RIG *rig, if (mem_caps->tx_freq) { - fprintf(f, "%.0"PRIfreq"%c", chan.tx_freq, csv_sep); + fprintf(f, "%"PRIfreq"%c", chan.tx_freq, csv_sep); } if (mem_caps->tx_mode) ----------------------------------------------------------------------- Summary of changes: README.multicast | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ rigs/dummy/flrig.c | 4 ++-- src/rig.c | 2 +- tests/Makefile.am | 2 +- tests/memcsv.c | 4 ++-- tests/rigctld.c | 2 +- 6 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 README.multicast hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-05-08 17:48:28
|
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 1bbe783e05ef0c089a3739be2a486e6c95d89934 (commit) via d012d5e71401c9fede74aaadf4cedcc32a208110 (commit) from 27eb0087cb9c2c6332f88ae228c9c8ea11535972 (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 1bbe783e05ef0c089a3739be2a486e6c95d89934 Author: Mike Black W9MDB <mdb...@ya...> Date: Sat May 8 12:47:59 2021 -0500 Change freq printout in ft1000mp.c diff --git a/rigs/yaesu/ft1000mp.c b/rigs/yaesu/ft1000mp.c index 814f6b59..260150a1 100644 --- a/rigs/yaesu/ft1000mp.c +++ b/rigs/yaesu/ft1000mp.c @@ -770,8 +770,8 @@ int ft1000mp_set_freq(RIG *rig, vfo_t vfo, freq_t freq) to_bcd(p->p_cmd, freq / 10, 8); /* store bcd format in in p_cmd */ // cppcheck-suppress * - rig_debug(RIG_DEBUG_TRACE, "%s: freq = %"PRIll" Hz\n", __func__, - (int64_t)from_bcd(p->p_cmd, 8) * 10); + rig_debug(RIG_DEBUG_TRACE, "%s: freq = %"PRIfreq" Hz\n", __func__, + (freq_t)from_bcd(p->p_cmd, 8) * 10); cmd = p->p_cmd; /* get native sequence */ write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH); commit d012d5e71401c9fede74aaadf4cedcc32a208110 Author: Mike Black W9MDB <mdb...@ya...> Date: Sat May 8 12:47:10 2021 -0500 Change default freq print to zero decimal places diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 1f1c781e..c148b433 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -355,7 +355,7 @@ typedef double freq_t; /** * \brief printf(3) format to be used for freq_t type */ -#define PRIfreq "f" +#define PRIfreq ".0f" /** * \brief scanf(3) format to be used for freq_t type ----------------------------------------------------------------------- Summary of changes: include/hamlib/rig.h | 2 +- rigs/yaesu/ft1000mp.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-05-08 12:49:55
|
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 27eb0087cb9c2c6332f88ae228c9c8ea11535972 (commit) from 493860dae806c650325ae430147fa06be827266f (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 27eb0087cb9c2c6332f88ae228c9c8ea11535972 Author: Mike Black W9MDB <mdb...@ya...> Date: Sat May 8 07:49:01 2021 -0500 Fix buffer overflow in radant.c https://github.com/Hamlib/Hamlib/commit/0165d81e479965c17f0cd1fcbf1662bc2e9d41f3#commitcomment-50545346 diff --git a/rotators/radant/radant.c b/rotators/radant/radant.c index c9b7d7eb..aa3084a3 100644 --- a/rotators/radant/radant.c +++ b/rotators/radant/radant.c @@ -102,12 +102,12 @@ transaction_quit: static int radant_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) { - char cmdstr[13]; + char cmdstr[32]; int retval; rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __func__, az, el); - sprintf(cmdstr, "Q%.1f %1.f\r", az, el); + snprintf(cmdstr, sizeof(cmdstr), "Q%.1f %1.f\r", az, el); retval = radant_transaction(rot, cmdstr, NULL, 0); @@ -128,7 +128,7 @@ radant_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); - sprintf(cmdstr, "Y\r"); + snprintf(cmdstr, sizeof(cmdstr), "Y\r"); retval = radant_transaction(rot, cmdstr, ackbuf, sizeof(ackbuf)); @@ -182,7 +182,7 @@ const struct rot_caps radant_rot_caps = ROT_MODEL(ROT_MODEL_RADANT), .model_name = "AZ-1/AZV-1", .mfg_name = "Radant", - .version = "20210409.0", + .version = "20210508.0", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rot_type = ROT_TYPE_OTHER, ----------------------------------------------------------------------- Summary of changes: rotators/radant/radant.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-05-07 17:31:04
|
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 493860dae806c650325ae430147fa06be827266f (commit) from ce470548b2b3f5bd4b9681ab188fedd900578161 (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 493860dae806c650325ae430147fa06be827266f Author: Mike Black W9MDB <mdb...@ya...> Date: Fri May 7 12:30:14 2021 -0500 Add ; to k3.c to please the eye diff --git a/rigs/kenwood/k3.c b/rigs/kenwood/k3.c index de9594c0..d477edc9 100644 --- a/rigs/kenwood/k3.c +++ b/rigs/kenwood/k3.c @@ -1155,7 +1155,7 @@ int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) c = 'A' + kmode - 10; } - rig_debug(RIG_DEBUG_VERBOSE, "%s: kmode=%d, cmode=%c\n", __func__, kmode, c) + rig_debug(RIG_DEBUG_VERBOSE, "%s: kmode=%d, cmode=%c\n", __func__, kmode, c); if (vfo == RIG_VFO_B) { ----------------------------------------------------------------------- Summary of changes: rigs/kenwood/k3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-05-07 16:44:18
|
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 ce470548b2b3f5bd4b9681ab188fedd900578161 (commit) from e84b8a3c99e09c71db45c86849d4e31825895e3f (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 ce470548b2b3f5bd4b9681ab188fedd900578161 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri May 7 11:43:53 2021 -0500 Promote IC821H to stable diff --git a/rigs/icom/ic821h.c b/rigs/icom/ic821h.c index b58ef84c..930cc5fd 100644 --- a/rigs/icom/ic821h.c +++ b/rigs/icom/ic821h.c @@ -99,7 +99,7 @@ const struct rig_caps ic821h_caps = .mfg_name = "Icom", .version = BACKEND_VER ".1", .copyright = "LGPL", - .status = RIG_STATUS_BETA, + .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, ----------------------------------------------------------------------- Summary of changes: rigs/icom/ic821h.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-05-07 16:43:29
|
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 e84b8a3c99e09c71db45c86849d4e31825895e3f (commit) via 29013fd02196aa829a0f29d57766e35f24f29cd3 (commit) via 102439be15cb42d7d82ecb5f5a9ab2726d2b4876 (commit) from dd2f0f380eb1207352b07803db16a0d59f4bbdc5 (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 e84b8a3c99e09c71db45c86849d4e31825895e3f Author: Mike Black W9MDB <mdb...@ya...> Date: Fri May 7 08:25:54 2021 -0500 Add special check for IC821H in icom_set_vfo Seems the IC821H reverses Main/Sub logic when in satmode Remove IC821 from riglist.h and icom.c -- not used https://github.com/Hamlib/Hamlib/issues/693 diff --git a/include/hamlib/riglist.h b/include/hamlib/riglist.h index a044d8c4..1aeac09b 100644 --- a/include/hamlib/riglist.h +++ b/include/hamlib/riglist.h @@ -215,7 +215,7 @@ #define RIG_MODEL_IC775 RIG_MAKE_MODEL(RIG_ICOM, 30) #define RIG_MODEL_IC781 RIG_MAKE_MODEL(RIG_ICOM, 31) #define RIG_MODEL_IC820 RIG_MAKE_MODEL(RIG_ICOM, 32) -#define RIG_MODEL_IC821 RIG_MAKE_MODEL(RIG_ICOM, 33) +//#define RIG_MODEL_IC821 RIG_MAKE_MODEL(RIG_ICOM, 33) // not implemented and can be reused #define RIG_MODEL_IC821H RIG_MAKE_MODEL(RIG_ICOM, 34) #define RIG_MODEL_IC970 RIG_MAKE_MODEL(RIG_ICOM, 35) #define RIG_MODEL_ICR10 RIG_MAKE_MODEL(RIG_ICOM, 36) diff --git a/rigs/icom/ic821h.c b/rigs/icom/ic821h.c index 83ced8cd..b58ef84c 100644 --- a/rigs/icom/ic821h.c +++ b/rigs/icom/ic821h.c @@ -74,7 +74,8 @@ int ic821h_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) rig_debug(RIG_DEBUG_TRACE, "%s: tx_vfo==MAIN so assuming sat mode=%d\n", __func__, rig->state.cache.satmode); priv->tx_vfo = split == RIG_SPLIT_ON ? RIG_VFO_SUB : RIG_VFO_MAIN; - retval = rig_set_vfo(rig, 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); } else if (tx_vfo == RIG_VFO_A) { diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index a6f7bd2e..0ead6f5b 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -574,7 +574,6 @@ static const struct icom_addr icom_addr_list[] = {RIG_MODEL_IC785x, 0x8e}, {RIG_MODEL_IC781, 0x26}, {RIG_MODEL_IC820, 0x42}, - {RIG_MODEL_IC821, 0x4c}, {RIG_MODEL_IC821H, 0x4c}, {RIG_MODEL_IC910, 0x60}, {RIG_MODEL_IC9100, 0x7c}, @@ -2257,6 +2256,9 @@ int icom_set_vfo(RIG *rig, vfo_t vfo) vfo = RIG_VFO_MAIN; if (rig->state.cache.split == RIG_SPLIT_ON && !rig->state.cache.satmode) { vfo = RIG_VFO_A; } + + // Seems the IC821H reverses Main/Sub when in satmode + if (rig->caps->rig_model == RIG_MODEL_IC821H && rig->state.cache.satmode) { vfo = RIG_VFO_SUB; } } else if ((vfo == RIG_VFO_B || vfo == RIG_VFO_SUB) && VFO_HAS_DUAL) { @@ -2271,6 +2273,9 @@ int icom_set_vfo(RIG *rig, vfo_t vfo) vfo = RIG_VFO_SUB_A; } else if (rig->state.cache.split == RIG_SPLIT_ON) { vfo = RIG_VFO_B; } + + // Seems the IC821H reverses Main/Sub when in satmode + if (rig->caps->rig_model == RIG_MODEL_IC821H && rig->state.cache.satmode) { vfo = RIG_VFO_MAIN; } } else if ((vfo == RIG_VFO_A || vfo == RIG_VFO_B) && !VFO_HAS_A_B && VFO_HAS_MAIN_SUB) diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index 505dc454..e73c569c 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -30,7 +30,7 @@ #include <sys/time.h> #endif -#define BACKEND_VER "20210430" +#define BACKEND_VER "20210507" /* * defines used by comp_cal_str in rig.c commit 29013fd02196aa829a0f29d57766e35f24f29cd3 Author: Mike Black W9MDB <mdb...@ya...> Date: Thu May 6 23:59:00 2021 -0500 Add ic821h_set_split_vfo https://github.com/Hamlib/Hamlib/issues/693 diff --git a/rigs/icom/ic821h.c b/rigs/icom/ic821h.c index 39b0597b..83ced8cd 100644 --- a/rigs/icom/ic821h.c +++ b/rigs/icom/ic821h.c @@ -28,6 +28,7 @@ #include <hamlib/rig.h> #include "icom.h" +#include "misc.h" #define IC821H_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_FM) @@ -54,12 +55,48 @@ static const struct icom_priv_caps ic821h_priv_caps = ic737_ts_sc_list }; + +// split could be on VFOA/B or Main/Sub +// If Main/Sub we assume we're doing satmode +int ic821h_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) +{ + struct icom_priv_data *priv = (struct icom_priv_data *) rig->state.priv; + int retval; + + ENTERFUNC; + rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s, split=%d, tx_vfo=%s\n", __func__, + rig_strvfo(vfo), split, rig_strvfo(tx_vfo)); + + if (tx_vfo == RIG_VFO_MAIN) + { + rig->state.cache.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); + priv->tx_vfo = split == RIG_SPLIT_ON ? RIG_VFO_SUB : RIG_VFO_MAIN; + retval = rig_set_vfo(rig, RIG_VFO_MAIN); + } + else if (tx_vfo == RIG_VFO_A) + { + retval = rig_set_vfo(rig, RIG_VFO_A); + priv->tx_vfo = split == RIG_SPLIT_ON ? RIG_VFO_B : RIG_VFO_A; + } + else + { + rig_debug(RIG_DEBUG_ERR, "%s: vfo=%s not handled for split mode\n", __func__, + rig_strvfo(tx_vfo)); + RETURNFUNC(-RIG_EINVAL); + } + + RETURNFUNC(retval); +} + const struct rig_caps ic821h_caps = { RIG_MODEL(RIG_MODEL_IC821H), .model_name = "IC-821H", .mfg_name = "Icom", - .version = BACKEND_VER ".0", + .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -168,6 +205,7 @@ const struct rig_caps ic821h_caps = .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, + .set_split_vfo = ic821h_set_split_vfo, .decode_event = icom_decode_event, .set_mem = icom_set_mem, commit 102439be15cb42d7d82ecb5f5a9ab2726d2b4876 Author: Mike Black W9MDB <mdb...@ya...> Date: Thu May 6 23:58:15 2021 -0500 Change CRC to use all data by substituting CRC value with zeros diff --git a/src/rig.c b/src/rig.c index 3ca65769..40f2bea0 100644 --- a/src/rig.c +++ b/src/rig.c @@ -6326,11 +6326,13 @@ int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len) rxb = !rxa; txb = split == 1; snprintf(response, max_response_len, - "VFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nVFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nSplit=%d SatMode=%d\nRig=%s\nApp=Hamlib\nVersion=20210429\n", + "VFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nVFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nSplit=%d SatMode=%d\nRig=%s\nApp=Hamlib\nVersion=20210506\nCRC=0x00000000\n", rig_strvfo(vfoA), freqA, modeAstr, (int)widthA, rxa, txa, rig_strvfo(vfoB), freqB, modeBstr, (int)widthB, rxb, txb, split, satmode, rig->caps->model_name); unsigned long crc = gen_crc((unsigned char *)response, strlen(response)); - sprintf(crcstr, "CRC=0x%08lx\n", crc); + char *p = strstr(response,"CRC="); + if (p) + sprintf(p, "CRC=0x%08lx\n", crc); strcat(response, crcstr); RETURNFUNC(RIG_OK); } ----------------------------------------------------------------------- Summary of changes: include/hamlib/riglist.h | 2 +- rigs/icom/ic821h.c | 41 ++++++++++++++++++++++++++++++++++++++++- rigs/icom/icom.c | 7 ++++++- rigs/icom/icom.h | 2 +- src/rig.c | 6 ++++-- 5 files changed, 52 insertions(+), 6 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-05-06 17:23: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 dd2f0f380eb1207352b07803db16a0d59f4bbdc5 (commit) via 0ec349de49ded733d4c40127a4a7797f7e58084d (commit) via 79a7a915fba792642e7d83759617c62e5a649030 (commit) via d0a12e5391e539b4fcc3de39ef5d9960fbdd9f89 (commit) from fe4bf9add854ab9b1d1afb3c5f277e6c6addd3d6 (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 dd2f0f380eb1207352b07803db16a0d59f4bbdc5 Author: Mike Black W9MDB <mdb...@ya...> Date: Thu May 6 12:21:48 2021 -0500 Fix bad variable in ts890.c diff --git a/rigs/kenwood/ts890s.c b/rigs/kenwood/ts890s.c index cf91236d..4248604e 100644 --- a/rigs/kenwood/ts890s.c +++ b/rigs/kenwood/ts890s.c @@ -124,7 +124,7 @@ int kenwood_ts890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) return retval; } - sscanf(lvlbuf + 3, "%d", &levelint); + sscanf(ackbuf + 3, "%d", &levelint); val->i = levelint * 3 / 2; /* 150ms units converted to 100ms units */ return RIG_OK; commit 0ec349de49ded733d4c40127a4a7797f7e58084d Merge: 79a7a915 d0a12e53 Author: Michael Black <mdb...@ya...> Date: Thu May 6 12:15:05 2021 -0500 Merge pull request #692 from mikaelnousiainen/fix-kenwood-vox-delay Fix Kenwood VOX delay unit commit 79a7a915fba792642e7d83759617c62e5a649030 Author: Mike Black W9MDB <mdb...@ya...> Date: Thu May 6 12:14:17 2021 -0500 Fix TS890 vox delay level diff --git a/rigs/kenwood/ts890s.c b/rigs/kenwood/ts890s.c index 093c7c37..cf91236d 100644 --- a/rigs/kenwood/ts890s.c +++ b/rigs/kenwood/ts890s.c @@ -116,6 +116,18 @@ int kenwood_ts890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) switch (level) { + case RIG_LEVEL_VOXDELAY: + retval = kenwood_safe_transaction(rig, "VD0", ackbuf, sizeof(ackbuf), 6); + + if (retval != RIG_OK) + { + return retval; + } + + sscanf(lvlbuf + 3, "%d", &levelint); + val->i = levelint * 3 / 2; /* 150ms units converted to 100ms units */ + return RIG_OK; + case RIG_LEVEL_RF: retval = kenwood_transaction(rig, "RG", ackbuf, sizeof(ackbuf)); @@ -228,7 +240,7 @@ const struct rig_caps ts890s_caps = RIG_MODEL(RIG_MODEL_TS890S), .model_name = "TS-890S", .mfg_name = "Kenwood", - .version = BACKEND_VER ".0", + .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, commit d0a12e5391e539b4fcc3de39ef5d9960fbdd9f89 Author: Mikael Nousiainen <mik...@ik...> Date: Thu May 6 18:24:02 2021 +0300 Hamlib VOX delay unit is 1/10th of a second diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index a6dcc95e..2fc0c3d2 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -2914,12 +2914,13 @@ int kenwood_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) break; case RIG_LEVEL_VOXDELAY: - if (val.i > 3000 || val.i < 0) + if (val.i > 30 || val.i < 0) { RETURNFUNC(-RIG_EINVAL); } - snprintf(levelbuf, sizeof(levelbuf), "VD%04d", val.i); + // Raw value is in milliseconds + snprintf(levelbuf, sizeof(levelbuf), "VD%04d", val.i * 100); break; case RIG_LEVEL_VOXGAIN: ----------------------------------------------------------------------- Summary of changes: rigs/kenwood/kenwood.c | 5 +++-- rigs/kenwood/ts890s.c | 14 +++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-05-05 20:15:24
|
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 fe4bf9add854ab9b1d1afb3c5f277e6c6addd3d6 (commit) via 805cd8e60b380b78fe6dc3d67167a03d9b298219 (commit) via d0038fb643135a2413105196132bf91382998363 (commit) from a56e976787f8dacf725efd7cf7a724081aaa0303 (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 fe4bf9add854ab9b1d1afb3c5f277e6c6addd3d6 Merge: 805cd8e6 d0038fb6 Author: Mike Black W9MDB <mdb...@ya...> Date: Wed May 5 15:15:06 2021 -0500 Merge branch 'master' of https://github.com/Hamlib/Hamlib commit 805cd8e60b380b78fe6dc3d67167a03d9b298219 Author: Mike Black W9MDB <mdb...@ya...> Date: Wed May 5 15:13:56 2021 -0500 Move ant_rx ant_tx set to after NULL check in rig.c https://github.com/Hamlib/Hamlib/pull/691#issuecomment-832918894 diff --git a/src/rig.c b/src/rig.c index fe6dd94d..3ca65769 100644 --- a/src/rig.c +++ b/src/rig.c @@ -5081,8 +5081,6 @@ int HAMLIB_API rig_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option, ENTERFUNC; - *ant_tx = *ant_rx = RIG_ANT_UNKNOWN; - if (CHECK_RIG_ARG(rig)) { RETURNFUNC(-RIG_EIO); @@ -5096,6 +5094,8 @@ int HAMLIB_API rig_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option, RETURNFUNC(-RIG_EINVAL); } + *ant_tx = *ant_rx = RIG_ANT_UNKNOWN; + caps = rig->caps; if (caps->get_ant == NULL) commit d0038fb643135a2413105196132bf91382998363 Author: Mike Black W9MDB <mdb...@ya...> Date: Wed May 5 15:13:56 2021 -0500 Move ant_rx ant_tx set to after NULL check in rig.c diff --git a/src/rig.c b/src/rig.c index fe6dd94d..3ca65769 100644 --- a/src/rig.c +++ b/src/rig.c @@ -5081,8 +5081,6 @@ int HAMLIB_API rig_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option, ENTERFUNC; - *ant_tx = *ant_rx = RIG_ANT_UNKNOWN; - if (CHECK_RIG_ARG(rig)) { RETURNFUNC(-RIG_EIO); @@ -5096,6 +5094,8 @@ int HAMLIB_API rig_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option, RETURNFUNC(-RIG_EINVAL); } + *ant_tx = *ant_rx = RIG_ANT_UNKNOWN; + caps = rig->caps; if (caps->get_ant == NULL) ----------------------------------------------------------------------- Summary of changes: src/rig.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-05-05 15:45:52
|
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 a56e976787f8dacf725efd7cf7a724081aaa0303 (commit) via 0721eb5ce686ec0bd82cab6a9f7a10fa2bbe60f8 (commit) via 9e8ef6dc9e7064852bfd664444cdd6bf7cc06324 (commit) from 7f60e1fcb036551e7bae101f13414f5fe3e58086 (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 a56e976787f8dacf725efd7cf7a724081aaa0303 Author: Mike Black W9MDB <mdb...@ya...> Date: Wed May 5 10:45:22 2021 -0500 Add null checks in rig.c for ant_tx and ant_rx astyle rig.c diff --git a/src/rig.c b/src/rig.c index 08552d18..fe6dd94d 100644 --- a/src/rig.c +++ b/src/rig.c @@ -2154,7 +2154,7 @@ int HAMLIB_API rig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) RETURNFUNC(-RIG_ENAVAIL); } - if (vfo == RIG_VFO_CURR) vfo = rig->state.current_vfo; + if (vfo == RIG_VFO_CURR) { vfo = rig->state.current_vfo; } if ((caps->targetable_vfo & RIG_TARGETABLE_MODE) || vfo == rig->state.current_vfo) @@ -2369,8 +2369,9 @@ pbwidth_t HAMLIB_API rig_passband_normal(RIG *rig, rmode_t mode) rs = &rig->state; // return CW for CWR and RTTY for RTTYR - if (mode == RIG_MODE_CWR) mode = RIG_MODE_CW; - if (mode == RIG_MODE_RTTYR) mode = RIG_MODE_RTTY; + if (mode == RIG_MODE_CWR) { mode = RIG_MODE_CW; } + + if (mode == RIG_MODE_RTTYR) { mode = RIG_MODE_RTTY; } for (i = 0; i < HAMLIB_FLTLSTSIZ && rs->filters[i].modes; i++) { @@ -2946,7 +2947,7 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) // some rigs like the FT-2000 with the SCU-17 need just a bit of time to let the relays work // can affect fake it mode in WSJT-X when the rig is still in transmit and freq change // is requested on a rig that can't change freq on a transmitting VFO - if (ptt != RIG_PTT_ON) hl_usleep(10*1000); + if (ptt != RIG_PTT_ON) { hl_usleep(10 * 1000); } rig->state.cache.ptt = ptt; elapsed_ms(&rig->state.cache.time_ptt, HAMLIB_ELAPSED_SET); @@ -5087,8 +5088,11 @@ int HAMLIB_API rig_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option, RETURNFUNC(-RIG_EIO); } - if (ant_curr == NULL) + if (ant_curr == NULL || ant_tx == NULL || ant_rx == NULL) { + rig_debug(RIG_DEBUG_ERR, + "%s: null pointer in ant_curr=%p, ant_tx=%p, ant_rx=%p\n", __func__, ant_curr, + ant_tx, ant_rx); RETURNFUNC(-RIG_EINVAL); } commit 0721eb5ce686ec0bd82cab6a9f7a10fa2bbe60f8 Merge: 7f60e1fc 9e8ef6dc Author: Michael Black <mdb...@ya...> Date: Wed May 5 10:42:06 2021 -0500 Merge pull request #691 from mikaelnousiainen/fix-get-ant-null-check Fix rig_get_ant NULL check commit 9e8ef6dc9e7064852bfd664444cdd6bf7cc06324 Author: Mikael Nousiainen <mik...@ik...> Date: Wed May 5 18:23:02 2021 +0300 Fix rig_get_ant NULL check diff --git a/src/rig.c b/src/rig.c index eb1e099e..08552d18 100644 --- a/src/rig.c +++ b/src/rig.c @@ -5087,7 +5087,7 @@ int HAMLIB_API rig_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option, RETURNFUNC(-RIG_EIO); } - if (ant_curr) + if (ant_curr == NULL) { RETURNFUNC(-RIG_EINVAL); } ----------------------------------------------------------------------- Summary of changes: src/rig.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-05-04 19:35:59
|
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 7f60e1fcb036551e7bae101f13414f5fe3e58086 (commit) via 78a697e58204b6e951a8b1f80a7c8b1e0bae61fe (commit) via 5bafde9ae64c277202fba92955a855a4a555670f (commit) via 231f9faad8feaa761298c8595afa63379a077023 (commit) via c1b2131d9460637c8647626430a913304946a671 (commit) from 4108c0b57169060a2c2743d39ba4471e87e70f83 (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 7f60e1fcb036551e7bae101f13414f5fe3e58086 Author: Mike Black W9MDB <mdb...@ya...> Date: Tue May 4 14:34:51 2021 -0500 Fix dummy rig to recognize Main/Sub VFOS -- this fixes "M CW 500" Fix rig.c set_mode to recognize curr_vfo correctly https://github.com/Hamlib/Hamlib/issues/689 diff --git a/rigs/dummy/dummy.c b/rigs/dummy/dummy.c index b5da2d1e..1d6b5b55 100644 --- a/rigs/dummy/dummy.c +++ b/rigs/dummy/dummy.c @@ -469,15 +469,23 @@ 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); switch (vfo) { + case RIG_VFO_MAIN: case RIG_VFO_A: priv->vfo_a.mode = mode; priv->vfo_a.width = width; break; + case RIG_VFO_SUB: case RIG_VFO_B: priv->vfo_b.mode = mode; priv->vfo_b.width = width; break; case RIG_VFO_C: priv->vfo_c.mode = mode; priv->vfo_c.width = width; break; + default: + rig_debug(RIG_DEBUG_ERR, "%s: unknown VFO=%s\n", __func__, rig_strvfo(vfo)); + RETURNFUNC(-RIG_EINVAL); } + vfo = vfo_fixup(rig, vfo); + if (RIG_PASSBAND_NOCHANGE == width) { RETURNFUNC(RIG_OK); } if (width == RIG_PASSBAND_NORMAL) @@ -2127,7 +2135,7 @@ struct rig_caps dummy_caps = RIG_MODEL(RIG_MODEL_DUMMY), .model_name = "Dummy", .mfg_name = "Hamlib", - .version = "20210428.0", + .version = "20210504.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_OTHER, @@ -2292,7 +2300,7 @@ struct rig_caps dummy_no_vfo_caps = RIG_MODEL(RIG_MODEL_DUMMY_NOVFO), .model_name = "Dummy No VFO", .mfg_name = "Hamlib", - .version = "20210428.0", + .version = "20210504.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_OTHER, diff --git a/src/rig.c b/src/rig.c index 25161ce9..eb1e099e 100644 --- a/src/rig.c +++ b/src/rig.c @@ -2154,8 +2154,9 @@ int HAMLIB_API rig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) RETURNFUNC(-RIG_ENAVAIL); } + if (vfo == RIG_VFO_CURR) vfo = rig->state.current_vfo; + if ((caps->targetable_vfo & RIG_TARGETABLE_MODE) - || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { TRACE; diff --git a/tests/simyaesu.c b/tests/simyaesu.c index dababa68..fb9c0fff 100644 --- a/tests/simyaesu.c +++ b/tests/simyaesu.c @@ -1,6 +1,9 @@ // can run this using rigctl/rigctld and socat pty devices -// socat -d -d pty,raw,echo=0 pty,raw,echo=0 +// gcc -o simyaesu simyaesu.c +#define _XOPEN_SOURCE 600 #include <stdio.h> +#include <stdlib.h> +#include <fcntl.h> #include <string.h> #include <unistd.h> @@ -31,13 +34,13 @@ typedef enum nc_rigid_e } nc_rigid_t; int -getmyline(FILE *fp, char *buf) +getmyline(int fd, char *buf) { int c; int i = 0; memset(buf, 0, BUFSIZE); - while ((c = fgetc(fp)) != EOF) + while (read(fd, &c, 1) > 0) { buf[i++] = c; @@ -46,63 +49,101 @@ getmyline(FILE *fp, char *buf) return strlen(buf); } -int main() + +#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 n; - FILE *fp = fopen("/dev/pts/3", "r+"); + int fd = openPort(argv[1]); - //,while(getmyline(fp,buf)) while (1) { - getmyline(fp, buf); + getmyline(fd, buf); + printf("Cmd:%s\n", buf); if (strcmp(buf, "RM5;") == 0) { printf("%s\n", buf); usleep(50 * 1000); - n = fprintf(fp, "%s", "RM5100000;"); + pbuf = "RM5100000;"; + n = write(fd, pbuf, strlen(pbuf)); printf("n=%d\n", n); if (n <= 0) { perror("RM5"); } - - fflush(fp); } if (strcmp(buf, "AN0;") == 0) { printf("%s\n", buf); usleep(50 * 1000); - n = fprintf(fp, "%s", "AN030;"); + pbuf = "AN030;"; + n = write(fd, pbuf, strlen(pbuf)); printf("n=%d\n", n); if (n <= 0) { perror("AN"); } - - fflush(fp); } else if (strcmp(buf, "IF;") == 0) { printf("%s\n", buf); usleep(50 * 1000); - n = fprintf(fp, "%s", "IF059014200000+000000700000;"); + pbuf = "IF059014200000+000000700000;"; + n = write(fd, pbuf, strlen(pbuf)); printf("n=%d\n", n); if (n <= 0) { perror("IF"); } - - fflush(fp); } else if (strcmp(buf, "ID;") == 0) { printf("%s\n", buf); usleep(50 * 1000); - int id = NC_RIGID_FTDX101D; -// int id = NC_RIGID_FTDX3000; - n = fprintf(fp, "ID%03d;", id); + int id = NC_RIGID_FTDX3000; + snprintf(buf,sizeof(buf),"ID%03d;", id); + n = snprintf(buf, sizeof(buf), "ID%03d;", id); + n = write(fd, buf, strlen(buf)); printf("n=%d\n", n); if (n <= 0) { perror("ID"); } - - fflush(fp); } #if 0 @@ -116,8 +157,6 @@ int main() printf("n=%d\n", n); if (n <= 0) { perror("AI"); } - - fflush(fp); } } @@ -126,12 +165,11 @@ int main() { printf("%s\n", buf); usleep(50 * 1000); - n = fprintf(fp, "%s", "VS0;"); + pbuf = "VS0;"; + n = write(fd, pbuf, strlen(pbuf)); printf("n=%d\n", n); if (n < 0) { perror("VS"); } - - fflush(fp); } else if (strcmp(buf, "EX032;") == 0) { @@ -139,12 +177,11 @@ int main() ant = (ant + 1) % 3; printf("%s\n", buf); usleep(50 * 1000); - n = fprintf(fp, "EX032%1d;", ant); + snprintf(buf, sizeof(buf), "EX032%1d;", ant); + n = write(fd, buf, strlen(buf)); printf("n=%d\n", n); if (n < 0) { perror("EX032"); } - - fflush(fp); } else if (strlen(buf) > 0) commit 78a697e58204b6e951a8b1f80a7c8b1e0bae61fe Author: Mike Black W9MDB <mdb...@ya...> Date: Mon May 3 15:35:56 2021 -0500 Add rig_get_mode_bandwidths -- see NEWS Return token set of bandwidths for given mode diff --git a/NEWS b/NEWS index 9fa94ca9..683d706c 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,12 @@ Please send Hamlib bug reports to ham...@li... Version 4.2 * 2021-04-27 + * New rig_get_mode_bandwidths -- returns token set for bandwidths for given mode + Rig command: \get_mode_bandwidths CW + Mode=CW + Normal=500Hz + Narrow=50Hz + Wide=2400Hz * New rig_get_info -- returns token set for all vfos where order does not matter This is a string return to allow for easy future expansion without changing the API New tokens may be introduced and can be skipped if not used by clients diff --git a/src/rig.c b/src/rig.c index 66bf6d4e..25161ce9 100644 --- a/src/rig.c +++ b/src/rig.c @@ -2367,6 +2367,10 @@ pbwidth_t HAMLIB_API rig_passband_normal(RIG *rig, rmode_t mode) rs = &rig->state; + // return CW for CWR and RTTY for RTTYR + if (mode == RIG_MODE_CWR) mode = RIG_MODE_CW; + if (mode == RIG_MODE_RTTYR) mode = RIG_MODE_RTTY; + for (i = 0; i < HAMLIB_FLTLSTSIZ && rs->filters[i].modes; i++) { if (rs->filters[i].modes & mode) diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 303b5f66..69df31ab 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -165,6 +165,7 @@ declare_proto_rig(get_xit); declare_proto_rig(set_mode); declare_proto_rig(get_mode); declare_proto_rig(get_modes); +declare_proto_rig(get_mode_bandwidths); declare_proto_rig(set_vfo); declare_proto_rig(get_vfo); declare_proto_rig(get_rig_info); @@ -336,8 +337,9 @@ static struct test_table test_list[] = { 0xf2, "set_vfo_opt", ACTION(set_vfo_opt), ARG_NOVFO | ARG_IN, "Status" }, /* turn vfo option on/off */ { 0xf3, "get_vfo_info", ACTION(get_vfo_info), ARG_NOVFO | ARG_IN1 | ARG_OUT4, "Freq", "Mode", "Width", "Split", "SatMode" }, /* get several vfo parameters at once */ { 0xf5, "get_rig_info", ACTION(get_rig_info), ARG_NOVFO | ARG_OUT, "RigInfo" }, /* get several vfo parameters at once */ - { 0xf4, "get_vfo_list", ACTION(get_vfo_list), ARG_OUT | ARG_NOVFO, "VFOs" }, - { 0xf6, "get_modes", ACTION(get_modes), ARG_OUT | ARG_NOVFO, "Modes" }, + { 0xf4, "get_vfo_list", ACTION(get_vfo_list), ARG_OUT | ARG_NOVFO, "VFOs" }, + { 0xf6, "get_modes", ACTION(get_modes), ARG_OUT | ARG_NOVFO, "Modes" }, + { 0xf7, "get_mode_bandwidths", ACTION(get_mode_bandwidths), ARG_IN | ARG_NOVFO, "Mode" }, { 0xf1, "halt", ACTION(halt), ARG_NOVFO }, /* rigctld only--halt the daemon */ { 0x8c, "pause", ACTION(pause), ARG_IN, "Seconds" }, { 0x00, "", NULL }, @@ -2340,6 +2342,48 @@ declare_proto_rig(get_modes) RETURNFUNC(RIG_OK); } +declare_proto_rig(get_mode_bandwidths) +{ + int i; + char freqbuf[32]; + + ENTERFUNC; + + rmode_t mode = rig_parse_mode(arg1); + + for (i = 1; i < RIG_MODE_TESTS_MAX; i <<= 1) + { + if (i != mode) { continue; } + + if (mode == RIG_MODE_CWR) { mode = RIG_MODE_CW; } + + if (mode == RIG_MODE_RTTYR) { mode = RIG_MODE_RTTY; } + + pbwidth_t pbnorm = rig_passband_normal(rig, i); + + if (pbnorm == 0) + { + continue; + } + +// sprintf_freq(freqbuf, sizeof(freqbuf), pbnorm); + snprintf(freqbuf, sizeof(freqbuf), "%ldHz", pbnorm); + fprintf(fout, "Mode=%s\n", rig_strrmode(i)); + fprintf(fout, "Normal=%s\n", freqbuf); + + snprintf(freqbuf, sizeof(freqbuf), "%ldHz", rig_passband_narrow(rig, i)); + fprintf(fout, "Narrow=%s\n", freqbuf); + + snprintf(freqbuf, sizeof(freqbuf), "%ldHz", rig_passband_wide(rig, i)); + fprintf(fout, "Wide=%s", freqbuf); + } + + + RETURNFUNC(RIG_OK); +} + + + /* 'T' */ declare_proto_rig(set_ptt) commit 5bafde9ae64c277202fba92955a855a4a555670f Author: Mike Black W9MDB <mdb...@ya...> Date: Mon May 3 11:26:41 2021 -0500 Add bandwidths to get_modes diff --git a/tests/dumpcaps.c b/tests/dumpcaps.c index afc74e48..b44b625b 100644 --- a/tests/dumpcaps.c +++ b/tests/dumpcaps.c @@ -665,7 +665,7 @@ int dumpcaps(RIG *rig, FILE *fout) if (pbnorm == 0) { - continue; +// continue; } sprintf_freq(freqbuf, sizeof(freqbuf), pbnorm); diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 4143eb40..303b5f66 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -2301,6 +2301,8 @@ declare_proto_rig(get_vfo_list) declare_proto_rig(get_modes) { static char prntbuf[1024]; + int i; + char freqbuf[32]; ENTERFUNC; @@ -2313,6 +2315,28 @@ declare_proto_rig(get_modes) fprintf(fout, "%s%c", prntbuf[0] ? prntbuf : "None", ext_resp); + fprintf(fout, "\nBandwidths:"); + + for (i = 1; i < RIG_MODE_TESTS_MAX; i <<= 1) + { + pbwidth_t pbnorm = rig_passband_normal(rig, i); + + if (pbnorm == 0) + { + continue; + } + + sprintf_freq(freqbuf, sizeof(freqbuf), pbnorm); + fprintf(fout, "\n\t%s\tNormal: %s,\t", rig_strrmode(i), freqbuf); + + sprintf_freq(freqbuf, sizeof(freqbuf), rig_passband_narrow(rig, i)); + fprintf(fout, "Narrow: %s,\t", freqbuf); + + sprintf_freq(freqbuf, sizeof(freqbuf), rig_passband_wide(rig, i)); + fprintf(fout, "Wide: %s", freqbuf); + } + + RETURNFUNC(RIG_OK); } commit 231f9faad8feaa761298c8595afa63379a077023 Author: Mike Black W9MDB <mdb...@ya...> Date: Mon May 3 09:24:02 2021 -0500 Add get_modes call to return list of rig modes diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 0ede3fc6..4143eb40 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -164,6 +164,7 @@ declare_proto_rig(set_xit); declare_proto_rig(get_xit); declare_proto_rig(set_mode); declare_proto_rig(get_mode); +declare_proto_rig(get_modes); declare_proto_rig(set_vfo); declare_proto_rig(get_vfo); declare_proto_rig(get_rig_info); @@ -336,6 +337,7 @@ static struct test_table test_list[] = { 0xf3, "get_vfo_info", ACTION(get_vfo_info), ARG_NOVFO | ARG_IN1 | ARG_OUT4, "Freq", "Mode", "Width", "Split", "SatMode" }, /* get several vfo parameters at once */ { 0xf5, "get_rig_info", ACTION(get_rig_info), ARG_NOVFO | ARG_OUT, "RigInfo" }, /* get several vfo parameters at once */ { 0xf4, "get_vfo_list", ACTION(get_vfo_list), ARG_OUT | ARG_NOVFO, "VFOs" }, + { 0xf6, "get_modes", ACTION(get_modes), ARG_OUT | ARG_NOVFO, "Modes" }, { 0xf1, "halt", ACTION(halt), ARG_NOVFO }, /* rigctld only--halt the daemon */ { 0x8c, "pause", ACTION(pause), ARG_IN, "Seconds" }, { 0x00, "", NULL }, @@ -2295,6 +2297,25 @@ declare_proto_rig(get_vfo_list) RETURNFUNC(RIG_OK); } +/* '\get_modes' */ +declare_proto_rig(get_modes) +{ + static char prntbuf[1024]; + + ENTERFUNC; + + rig_strrmodes(rig->state.mode_list, prntbuf, sizeof(prntbuf)); + + if ((interactive && prompt) || (interactive && !prompt && ext_resp)) + { + fprintf(fout, "%s: ", cmd->arg1); + } + + fprintf(fout, "%s%c", prntbuf[0] ? prntbuf : "None", ext_resp); + + RETURNFUNC(RIG_OK); +} + /* 'T' */ declare_proto_rig(set_ptt) commit c1b2131d9460637c8647626430a913304946a671 Author: Mike Black W9MDB <mdb...@ya...> Date: Sun May 2 17:33:37 2021 -0500 Update NEWS diff --git a/NEWS b/NEWS index f00cbfed..9fa94ca9 100644 --- a/NEWS +++ b/NEWS @@ -27,6 +27,7 @@ Version 4.2 Split: 0 SatMode: 0 + * FILPATHLEN has changed to HAMLIB_FILPATHLEN * USRP lib and gnuradio are deprecated and will be removed in 5.0 * Added Radan rotator ----------------------------------------------------------------------- Summary of changes: NEWS | 7 ++++ rigs/dummy/dummy.c | 12 +++++-- src/rig.c | 7 +++- tests/dumpcaps.c | 2 +- tests/rigctl_parse.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++- tests/simyaesu.c | 95 ++++++++++++++++++++++++++++++++++++---------------- 6 files changed, 180 insertions(+), 34 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-05-02 03:19:50
|
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 4108c0b57169060a2c2743d39ba4471e87e70f83 (commit) via fc37f0aeaff8f6833d36052cd2fd8450ada0f846 (commit) via 78470cf4ae83a76501b905494ebed57fa485e2ed (commit) from 16f5502af0a4f0c0662ae14c7c7dd063bd2bc697 (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 4108c0b57169060a2c2743d39ba4471e87e70f83 Merge: fc37f0ae 78470cf4 Author: Mike Black W9MDB <mdb...@ya...> Date: Sat May 1 22:19:28 2021 -0500 Merge branch 'master' of https://github.com/Hamlib/Hamlib commit fc37f0aeaff8f6833d36052cd2fd8450ada0f846 Author: Mike Black W9MDB <mdb...@ya...> Date: Sat May 1 22:18:28 2021 -0500 Add 10ms delay after rig_set_ptt to allow hardware ptt relays to do their thing https://github.com/Hamlib/Hamlib/issues/686 diff --git a/NEWS b/NEWS index 5353a4c1..f00cbfed 100644 --- a/NEWS +++ b/NEWS @@ -8,15 +8,25 @@ Please send Hamlib bug reports to ham...@li... Version 4.2 * 2021-04-27 - * New rig_get_vfo_info - * New rig_get_rig_info - Also get_rig_info in rigctld too - Example output with rig in split mode - This is a string return to allow for easy future expansion without changing the API - New tokens may be introduced and can be skipped if not used by clients - VFO=VFOA Freq=10133000 Mode=LSB Width=0 RX=1 TX=0 - VFO=VFOB Freq=10134000 Mode=LSB Width=0 RX=0 TX=1 - Split=1 SatMode=0 + * New rig_get_info -- returns token set for all vfos where order does not matter + This is a string return to allow for easy future expansion without changing the API + New tokens may be introduced and can be skipped if not used by clients + Rig command: \get_rig_info + VFO=Main Freq=145000000 Mode=None Width=0 RX=1 TX=1 + VFO=VFOB Freq=145000000 Mode=FM Width=15000 RX=0 TX=0 + Split=0 SatMode=0 + Rig=Dummy + App=Hamlib + Version=20210429 + CRC=0xf49f4708 + * New rig_get_vfo_info + Rig command: \get_vfo_info VFOA + Freq: 145000000 + Mode: None + Width: 0 + Split: 0 + SatMode: 0 + * USRP lib and gnuradio are deprecated and will be removed in 5.0 * Added Radan rotator diff --git a/src/rig.c b/src/rig.c index 582220c7..66bf6d4e 100644 --- a/src/rig.c +++ b/src/rig.c @@ -2938,6 +2938,11 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) rs->transmit = ptt != RIG_PTT_OFF; } + // some rigs like the FT-2000 with the SCU-17 need just a bit of time to let the relays work + // can affect fake it mode in WSJT-X when the rig is still in transmit and freq change + // is requested on a rig that can't change freq on a transmitting VFO + if (ptt != RIG_PTT_ON) hl_usleep(10*1000); + rig->state.cache.ptt = ptt; elapsed_ms(&rig->state.cache.time_ptt, HAMLIB_ELAPSED_SET); commit 78470cf4ae83a76501b905494ebed57fa485e2ed Author: Mike Black W9MDB <mdb...@ya...> Date: Sat May 1 15:51:52 2021 -0500 Fix get_vfo_info args diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 645be701..0ede3fc6 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -251,7 +251,7 @@ declare_proto_rig(pause); static struct test_table test_list[] = { #if 0 // implement set_freq VFO later if it can be detected -// { 'F', "set_freq", ACTION(set_freq), ARG_IN1 | ARG_OUT1, "Frequency" }, + { 'F', "set_freq", ACTION(set_freq), ARG_IN1 | ARG_OUT1, "Frequency" }, { 'f', "get_freq", ACTION(get_freq), ARG_OUT, "Frequency", "VFO" }, #else { 'F', "set_freq", ACTION(set_freq), ARG_IN1, "Frequency" }, @@ -333,9 +333,9 @@ static struct test_table test_list[] = { 0x8f, "dump_state", ACTION(dump_state), ARG_OUT | ARG_NOVFO }, { 0xf0, "chk_vfo", ACTION(chk_vfo), ARG_NOVFO, "ChkVFO" }, /* rigctld only--check for VFO mode */ { 0xf2, "set_vfo_opt", ACTION(set_vfo_opt), ARG_NOVFO | ARG_IN, "Status" }, /* turn vfo option on/off */ - { 0xf3, "get_vfo_info", ACTION(get_vfo_info), ARG_IN1 | ARG_OUT4, "Freq", "Mode", "Width", "Split", "SatMode" }, /* get several vfo parameters at once */ + { 0xf3, "get_vfo_info", ACTION(get_vfo_info), ARG_NOVFO | ARG_IN1 | ARG_OUT4, "Freq", "Mode", "Width", "Split", "SatMode" }, /* get several vfo parameters at once */ { 0xf5, "get_rig_info", ACTION(get_rig_info), ARG_NOVFO | ARG_OUT, "RigInfo" }, /* get several vfo parameters at once */ - { 0xf4, "get_vfo_list", ACTION(get_vfo_list), ARG_OUT | ARG_NOVFO, "VFOs" }, + { 0xf4, "get_vfo_list", ACTION(get_vfo_list), ARG_OUT | ARG_NOVFO, "VFOs" }, { 0xf1, "halt", ACTION(halt), ARG_NOVFO }, /* rigctld only--halt the daemon */ { 0x8c, "pause", ACTION(pause), ARG_IN, "Seconds" }, { 0x00, "", NULL }, ----------------------------------------------------------------------- Summary of changes: NEWS | 28 +++++++++++++++++++--------- src/rig.c | 5 +++++ 2 files changed, 24 insertions(+), 9 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-05-01 20:53:47
|
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 16f5502af0a4f0c0662ae14c7c7dd063bd2bc697 (commit) from 92d01adaa164a3487e2f7e29ef9f1918a9ce8274 (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 16f5502af0a4f0c0662ae14c7c7dd063bd2bc697 Author: Mike Black W9MDB <mdb...@ya...> Date: Sat May 1 15:51:52 2021 -0500 Fix get_vfo_info args It still incorrectly gives a Freq prompt for the VFO. diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 645be701..0ede3fc6 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -251,7 +251,7 @@ declare_proto_rig(pause); static struct test_table test_list[] = { #if 0 // implement set_freq VFO later if it can be detected -// { 'F', "set_freq", ACTION(set_freq), ARG_IN1 | ARG_OUT1, "Frequency" }, + { 'F', "set_freq", ACTION(set_freq), ARG_IN1 | ARG_OUT1, "Frequency" }, { 'f', "get_freq", ACTION(get_freq), ARG_OUT, "Frequency", "VFO" }, #else { 'F', "set_freq", ACTION(set_freq), ARG_IN1, "Frequency" }, @@ -333,9 +333,9 @@ static struct test_table test_list[] = { 0x8f, "dump_state", ACTION(dump_state), ARG_OUT | ARG_NOVFO }, { 0xf0, "chk_vfo", ACTION(chk_vfo), ARG_NOVFO, "ChkVFO" }, /* rigctld only--check for VFO mode */ { 0xf2, "set_vfo_opt", ACTION(set_vfo_opt), ARG_NOVFO | ARG_IN, "Status" }, /* turn vfo option on/off */ - { 0xf3, "get_vfo_info", ACTION(get_vfo_info), ARG_IN1 | ARG_OUT4, "Freq", "Mode", "Width", "Split", "SatMode" }, /* get several vfo parameters at once */ + { 0xf3, "get_vfo_info", ACTION(get_vfo_info), ARG_NOVFO | ARG_IN1 | ARG_OUT4, "Freq", "Mode", "Width", "Split", "SatMode" }, /* get several vfo parameters at once */ { 0xf5, "get_rig_info", ACTION(get_rig_info), ARG_NOVFO | ARG_OUT, "RigInfo" }, /* get several vfo parameters at once */ - { 0xf4, "get_vfo_list", ACTION(get_vfo_list), ARG_OUT | ARG_NOVFO, "VFOs" }, + { 0xf4, "get_vfo_list", ACTION(get_vfo_list), ARG_OUT | ARG_NOVFO, "VFOs" }, { 0xf1, "halt", ACTION(halt), ARG_NOVFO }, /* rigctld only--halt the daemon */ { 0x8c, "pause", ACTION(pause), ARG_IN, "Seconds" }, { 0x00, "", NULL }, ----------------------------------------------------------------------- Summary of changes: tests/rigctl_parse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-05-01 18:19:37
|
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 92d01adaa164a3487e2f7e29ef9f1918a9ce8274 (commit) via 2dd87806cffae4164962204b05ad4b6890ead027 (commit) from a27595d71eb9b0715015625cf93cbcfd19378dfa (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 92d01adaa164a3487e2f7e29ef9f1918a9ce8274 Author: Mike Black W9MDB <mdb...@ya...> Date: Sat May 1 13:06:32 2021 -0500 Fix MinGW compile warning in dumpcaps.c diff --git a/tests/dumpcaps.c b/tests/dumpcaps.c index e138c53a..afc74e48 100644 --- a/tests/dumpcaps.c +++ b/tests/dumpcaps.c @@ -361,7 +361,8 @@ int dumpcaps(RIG *rig, FILE *fout) if (caps->has_set_level & RIG_LEVEL_READONLY_LIST) { - fprintf(fout, "Warning--backend can set readonly levels=0x%0llx\n", caps->has_set_level & RIG_LEVEL_READONLY_LIST); + //fprintf(fout, "Warning--backend can set readonly levels=0x%0llx\n", caps->has_set_level & RIG_LEVEL_READONLY_LIST); + fprintf(fout, "Warning--backend can set readonly levels\n"); backend_warnings++; } commit 2dd87806cffae4164962204b05ad4b6890ead027 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Apr 30 15:59:43 2021 -0500 Remove 3 second sleep from icom.c powerup diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 94356c98..a6f7bd2e 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -6618,7 +6618,8 @@ int icom_set_powerstat(RIG *rig, powerstat_t status) retval = icom_transaction(rig, C_SET_PWR, pwr_sc, NULL, 0, ackbuf, &ack_len); rs->rigport.retry = retry; - hl_usleep(3000 * 1000); // give it 3 seconds to wake up + // why was this sleep here? We'll try without it + //hl_usleep(3000 * 1000); // give it 3 seconds to wake up break; diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index 564b519e..505dc454 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -30,7 +30,7 @@ #include <sys/time.h> #endif -#define BACKEND_VER "20210427" +#define BACKEND_VER "20210430" /* * defines used by comp_cal_str in rig.c ----------------------------------------------------------------------- Summary of changes: rigs/icom/icom.c | 3 ++- rigs/icom/icom.h | 2 +- tests/dumpcaps.c | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-04-30 20:42:41
|
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 a27595d71eb9b0715015625cf93cbcfd19378dfa (commit) via 12683d4fafd0063b5318a73e7b6d61e91ebf0530 (commit) from e3255e7a8da34fefbc0bdc5fe463cdf006af5267 (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 a27595d71eb9b0715015625cf93cbcfd19378dfa Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Apr 30 15:42:03 2021 -0500 Fix segfault in rigctl_parse.c when rig does not have ctcss_list or dcs_list diff --git a/tests/dumpcaps.c b/tests/dumpcaps.c index de312174..e138c53a 100644 --- a/tests/dumpcaps.c +++ b/tests/dumpcaps.c @@ -360,7 +360,8 @@ int dumpcaps(RIG *rig, FILE *fout) if (caps->has_set_level & RIG_LEVEL_READONLY_LIST) { - fprintf(fout, "Warning--backend can set readonly levels!\n"); + + fprintf(fout, "Warning--backend can set readonly levels=0x%0llx\n", caps->has_set_level & RIG_LEVEL_READONLY_LIST); backend_warnings++; } diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index aee4a766..645be701 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -4357,26 +4357,34 @@ declare_proto_rig(dump_state) fprintf(fout, "has_power2mW=%d\n", rig->caps->power2mW != NULL); fprintf(fout, "has_mW2power=%d\n", rig->caps->mW2power != NULL); fprintf(fout, "timeout=%d\n", rig->caps->timeout); - fprintf(fout, "ctcss_list="); - for (i = 0; i < CTCSS_LIST_SIZE && rig->caps->ctcss_list[i] != 0; i++) + if (rig->caps->ctcss_list) { - fprintf(fout, - " %u.%1u", - rig->caps->ctcss_list[i] / 10, rig->caps->ctcss_list[i] % 10); - } + fprintf(fout, "ctcss_list="); - fprintf(fout, "\n"); - fprintf(fout, "dcs_list="); + for (i = 0; i < CTCSS_LIST_SIZE && rig->caps->ctcss_list[i] != 0; i++) + { + fprintf(fout, + " %u.%1u", + rig->caps->ctcss_list[i] / 10, rig->caps->ctcss_list[i] % 10); + } - for (i = 0; i < DCS_LIST_SIZE && rig->caps->dcs_list[i] != 0; i++) - { - fprintf(fout, - " %u", - rig->caps->dcs_list[i]); + fprintf(fout, "\n"); } - fprintf(fout, "\n"); + if (rig->caps->dcs_list) + { + fprintf(fout, "dcs_list="); + + for (i = 0; i < DCS_LIST_SIZE && rig->caps->dcs_list[i] != 0; i++) + { + fprintf(fout, + " %u", + rig->caps->dcs_list[i]); + } + + fprintf(fout, "\n"); + } fprintf(fout, "done\n"); } commit 12683d4fafd0063b5318a73e7b6d61e91ebf0530 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Apr 30 07:37:07 2021 -0500 Add Version, App, and CRC tags to rig_get_info This output will eventually be used for a multicast broadcast/receive capability diff --git a/src/rig.c b/src/rig.c index 358c1441..582220c7 100644 --- a/src/rig.c +++ b/src/rig.c @@ -6211,6 +6211,52 @@ const char *HAMLIB_API rig_get_info(RIG *rig) return (rig->caps->get_info(rig)); } + +void make_crc_table(unsigned long crcTable[]) +{ + unsigned long POLYNOMIAL = 0xEDB88320; + unsigned long remainder; + unsigned char b = 0; + + do + { + // Start with the data byte + remainder = b; + + for (unsigned long bit = 8; bit > 0; --bit) + { + if (remainder & 1) + { + remainder = (remainder >> 1) ^ POLYNOMIAL; + } + else + { + remainder = (remainder >> 1); + } + } + + crcTable[(size_t)b] = remainder; + } + while (0 != ++b); +} + +static unsigned long crcTable[256]; + +unsigned long gen_crc(unsigned char *p, size_t n) +{ + unsigned long crc = 0xfffffffful; + size_t i; + + if (crcTable[0] == 0) { make_crc_table(crcTable); } + + for (i = 0; i < n; i++) + { + crc = crcTable[*p++ ^ (crc & 0xff)] ^ (crc >> 8); + } + + return ((~crc) & 0xffffffff); +} + /** * \brief get freq/mode/width for requested VFO * \param rig The rig handle @@ -6229,6 +6275,7 @@ int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len) int ret; int rxa, txa, rxb, txb; response[0] = 0; + char crcstr[16]; vfoA = vfo_fixup(rig, RIG_VFO_A); vfoB = vfo_fixup(rig, RIG_VFO_B); @@ -6265,9 +6312,12 @@ int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len) rxb = !rxa; txb = split == 1; snprintf(response, max_response_len, - "VFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nVFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nSplit=%d SatMode=%d", + "VFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nVFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nSplit=%d SatMode=%d\nRig=%s\nApp=Hamlib\nVersion=20210429\n", rig_strvfo(vfoA), freqA, modeAstr, (int)widthA, rxa, txa, rig_strvfo(vfoB), - freqB, modeBstr, (int)widthB, rxb, txb, split, satmode); + freqB, modeBstr, (int)widthB, rxb, txb, split, satmode, rig->caps->model_name); + unsigned long crc = gen_crc((unsigned char *)response, strlen(response)); + sprintf(crcstr, "CRC=0x%08lx\n", crc); + strcat(response, crcstr); RETURNFUNC(RIG_OK); } ----------------------------------------------------------------------- Summary of changes: src/rig.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++-- tests/dumpcaps.c | 3 ++- tests/rigctl_parse.c | 36 +++++++++++++++++++++-------------- 3 files changed, 76 insertions(+), 17 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-04-29 22:28:13
|
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 e3255e7a8da34fefbc0bdc5fe463cdf006af5267 (commit) from 81e3e2e5d284bc1b74a4389a5bf309685b866a74 (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 e3255e7a8da34fefbc0bdc5fe463cdf006af5267 Author: Mike Black W9MDB <mdb...@ya...> Date: Thu Apr 29 17:25:54 2021 -0500 Comment out work in progress in rigctl_parse.c diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 63ca1793..aee4a766 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -4346,9 +4346,11 @@ declare_proto_rig(dump_state) fprintf(fout, "has_get_freq=%d\n", rig->caps->get_freq != NULL); fprintf(fout, "has_set_conf=%d\n", rig->caps->set_conf != NULL); fprintf(fout, "has_get_conf=%d\n", rig->caps->get_conf != NULL); +#if 0 fprintf(fout, "has_set_parm=%d\n", rig->caps->set_parm != NULL); fprintf(fout, "has_get_parm=%d\n", rig->caps->get_parm != NULL); fprintf(fout, "parm_gran=0x%x\n", rig->caps->parm_gran); +#endif // for the future // fprintf(fout, "has_set_trn=%d\n", rig->caps->set_trn != NULL); // fprintf(fout, "has_get_trn=%d\n", rig->caps->get_trn != NULL); ----------------------------------------------------------------------- Summary of changes: tests/rigctl_parse.c | 2 ++ 1 file changed, 2 insertions(+) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-04-29 22:24:05
|
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 81e3e2e5d284bc1b74a4389a5bf309685b866a74 (commit) from 604516ed8f839e4927ecca34340f9e1f88576a58 (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 81e3e2e5d284bc1b74a4389a5bf309685b866a74 Author: Mike Black W9MDB <mdb...@ya...> Date: Thu Apr 29 17:23:37 2021 -0500 astyle files diff --git a/rigs/dummy/netrigctl.c b/rigs/dummy/netrigctl.c index e23f1055..e8ceb1b5 100644 --- a/rigs/dummy/netrigctl.c +++ b/rigs/dummy/netrigctl.c @@ -203,37 +203,46 @@ int parse_array_int(const char *s, const char *delim, int *array, int array_len) char *p; char *dup = strdup(s); char *rest = dup; - int n=0; + int n = 0; ENTERFUNC; - while((p = strtok_r(rest, delim, &rest))) + + while ((p = strtok_r(rest, delim, &rest))) { - if (n == array_len) { // too many items + if (n == array_len) // too many items + { return n; } + array[n] = atoi(p); //printf("%d\n", array[n]); ++n; } + free(dup); return n; } -int parse_array_double(const char *s, const char *delim, double *array, int array_len) +int parse_array_double(const char *s, const char *delim, double *array, + int array_len) { char *p; char *dup = strdup(s); char *rest = dup; - int n=0; + int n = 0; ENTERFUNC; - while((p = strtok_r(rest, delim, &rest))) + + while ((p = strtok_r(rest, delim, &rest))) { - if (n == array_len) { // too many items + if (n == array_len) // too many items + { return n; } + array[n] = atof(p); //printf("%f\n", array[n]); ++n; } + free(dup); return n; } @@ -555,6 +564,7 @@ static int netrigctl_open(RIG *rig) rig->caps->has_get_level = rs->has_get_level = strtoll(buf, NULL, 0); #if 0 // don't think we need this anymore + if (rs->has_get_level & RIG_LEVEL_RAWSTR) { /* include STRENGTH because the remote rig may be able to @@ -563,6 +573,7 @@ static int netrigctl_open(RIG *rig) rs->has_get_level |= RIG_LEVEL_STRENGTH; rig->caps->has_get_level |= RIG_LEVEL_STRENGTH; } + #endif ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); @@ -701,6 +712,7 @@ static int netrigctl_open(RIG *rig) if (!has) { rig->caps->get_conf = NULL; } } + #if 0 // for the future else if (strcmp(setting, "has_set_trn") == 0) { @@ -714,6 +726,7 @@ static int netrigctl_open(RIG *rig) if (!has) { rig->caps->get_trn = NULL; } } + #endif else if (strcmp(setting, "has_power2mW") == 0) { @@ -741,18 +754,22 @@ static int netrigctl_open(RIG *rig) double ctcss[CTCSS_LIST_SIZE]; rig->caps->ctcss_list = calloc(CTCSS_LIST_SIZE, sizeof(tone_t)); n = parse_array_double(value, " \n\r", ctcss, CTCSS_LIST_SIZE); - for(i=0;i<CTCSS_LIST_SIZE && ctcss[i] != 0;++i) rig->caps->ctcss_list[i] = ctcss[i]*10; - if (n < CTCSS_LIST_SIZE) rig->caps->ctcss_list[n] = 0; + + for (i = 0; i < CTCSS_LIST_SIZE && ctcss[i] != 0; ++i) { rig->caps->ctcss_list[i] = ctcss[i] * 10; } + + if (n < CTCSS_LIST_SIZE) { rig->caps->ctcss_list[n] = 0; } } - else if (strcmp(setting,"dcs_list") == 0) + else if (strcmp(setting, "dcs_list") == 0) { int i; int n; - int dcs[DCS_LIST_SIZE+1]; + int dcs[DCS_LIST_SIZE + 1]; rig->caps->dcs_list = calloc(DCS_LIST_SIZE, sizeof(tone_t)); n = parse_array_int(value, " \n\r", dcs, DCS_LIST_SIZE); - for(i=0;i<DCS_LIST_SIZE && dcs[i] != 0; i++) rig->caps->dcs_list[i] = dcs[i]; - if (n < DCS_LIST_SIZE) rig->caps->dcs_list[n] = 0; + + for (i = 0; i < DCS_LIST_SIZE && dcs[i] != 0; i++) { rig->caps->dcs_list[i] = dcs[i]; } + + if (n < DCS_LIST_SIZE) { rig->caps->dcs_list[n] = 0; } } else { @@ -2454,12 +2471,14 @@ static int netrigctl_get_trn(RIG *rig, int *trn) { return -RIG_EPROTO; } - - if (strstr(buf,"OFF")) *trn = RIG_TRN_OFF; - else if (strstr(buf,"RIG")) *trn = RIG_TRN_RIG; - else if (strstr(buf,"POLL")) *trn = RIG_TRN_POLL; - else { - rig_debug(RIG_DEBUG_ERR, "%s: Expected OFF, RIG, or POLL, got '%s'\n", __func__, buf); + + if (strstr(buf, "OFF")) { *trn = RIG_TRN_OFF; } + else if (strstr(buf, "RIG")) { *trn = RIG_TRN_RIG; } + else if (strstr(buf, "POLL")) { *trn = RIG_TRN_POLL; } + else + { + rig_debug(RIG_DEBUG_ERR, "%s: Expected OFF, RIG, or POLL, got '%s'\n", __func__, + buf); ret = -RIG_EINVAL; } @@ -2468,7 +2487,7 @@ static int netrigctl_get_trn(RIG *rig, int *trn) #endif static int netrigctl_mW2power(RIG *rig, float *power, unsigned int mwpower, - freq_t freq, rmode_t mode) + freq_t freq, rmode_t mode) { char cmdbuf[32]; char buf[BUF_MAX]; @@ -2491,7 +2510,7 @@ static int netrigctl_mW2power(RIG *rig, float *power, unsigned int mwpower, static int netrigctl_power2mW(RIG *rig, unsigned int *mwpower, float power, - freq_t freq, rmode_t mode) + freq_t freq, rmode_t mode) { char cmdbuf[32]; char buf[BUF_MAX]; diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index 2f76c30e..94356c98 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -4499,6 +4499,7 @@ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) &ack_len); rs->rigport.retry = retry_save; + if (retval == RIG_OK) // then we're done!! { *tx_freq = from_bcd(ackbuf + 2, (priv->civ_731_mode ? 4 : 5) * 2); diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 3ad2842a..a6dcc95e 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -337,7 +337,9 @@ transaction_write: int skip = strncmp(cmdstr, "RX", 2) == 0; skip |= strncmp(cmdstr, "RU", 2) == 0; skip |= strncmp(cmdstr, "RD", 2) == 0; - if (skip) { + + if (skip) + { goto transaction_quit; } } @@ -1784,11 +1786,13 @@ int kenwood_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) // by getting current rit we can determine how to handle change // we just use curr_rit - rit to determine how far we need to move // No need to zero out rit - retval = kenwood_get_rit(rig,RIG_VFO_CURR,&curr_rit); + retval = kenwood_get_rit(rig, RIG_VFO_CURR, &curr_rit); + if (retval != RIG_OK) { RETURNFUNC(retval); } + #if 0 // no longer needed if diff can be done retval = kenwood_transaction(rig, "RC", NULL, 0); @@ -1796,6 +1800,7 @@ int kenwood_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) { RETURNFUNC(retval); } + #endif if (rit == 0 && curr_rit == 0) @@ -1806,15 +1811,18 @@ int kenwood_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) if (priv->has_rit2) { diff = rit - curr_rit; - rig_debug(RIG_DEBUG_TRACE, "%s: rit=%ld, curr_rit=%ld, diff=%d\n", __func__, rit, curr_rit, diff); + rig_debug(RIG_DEBUG_TRACE, "%s: rit=%ld, curr_rit=%ld, diff=%d\n", __func__, + rit, curr_rit, diff); snprintf(buf, sizeof(buf), "R%c%05d", (diff > 0) ? 'U' : 'D', abs((int) diff)); retval = kenwood_transaction(rig, buf, NULL, 0); } else { snprintf(buf, sizeof(buf), "R%c", (rit > 0) ? 'U' : 'D'); - diff = labs(((curr_rit - rit) + (curr_rit - rit) >= 0 ? 5 : -5) / 10); // round to nearest 10Hz - rig_debug(RIG_DEBUG_TRACE, "%s: rit=%ld, curr_rit=%ld, diff=%d\n", __func__, rit, curr_rit, diff); + diff = labs(((curr_rit - rit) + (curr_rit - rit) >= 0 ? 5 : -5) / + 10); // round to nearest 10Hz + rig_debug(RIG_DEBUG_TRACE, "%s: rit=%ld, curr_rit=%ld, diff=%d\n", __func__, + rit, curr_rit, diff); rig_debug(RIG_DEBUG_TRACE, "%s: rit change loop=%d\n", __func__, diff); for (i = 0; i < diff; i++) diff --git a/rigs/kenwood/tmd710.c b/rigs/kenwood/tmd710.c index 5e794e56..40187b08 100644 --- a/rigs/kenwood/tmd710.c +++ b/rigs/kenwood/tmd710.c @@ -1236,6 +1236,7 @@ static int tmd710_find_dcs_index(tone_t code, uint32_t *dcs_index) // we only allow exact matches here tone_t *dcs_list = common_dcs_list; + while (code != dcs_list[i]) { if (dcs_list[i] == 0) diff --git a/rigs/kenwood/ts480.c b/rigs/kenwood/ts480.c index 8ab25d76..a18237dc 100644 --- a/rigs/kenwood/ts480.c +++ b/rigs/kenwood/ts480.c @@ -86,7 +86,8 @@ #define TOK_LEVEL_DIGITAL_NOISE_LIMITER TOKEN_BACKEND(111) #define TOK_FUNC_CW_IF_FOR_SSB_RX TOKEN_BACKEND(112) -int ts480_ext_tokens[] = { +int ts480_ext_tokens[] = +{ TOK_FUNC_NOISE_REDUCTION_2, TOK_FUNC_FILTER_WIDTH_DATA, TOK_FUNC_TX_AUDIO_FROM_DATA_INPUT, TOK_LEVEL_DSP_RX_EQUALIZER, TOK_LEVEL_DSP_TX_EQUALIZER, TOK_LEVEL_DSP_TX_BANDWIDTH, TOK_LEVEL_BEEP_VOLUME, TOK_LEVEL_TX_SIDETONE_VOLUME, @@ -219,7 +220,9 @@ static int ts480_get_ex_menu(RIG *rig, int number, int value_len, int *value) snprintf(buf, 20, "EX%03d0000", number); - retval = kenwood_safe_transaction(rig, buf, ackbuf, sizeof(ackbuf), 9 + value_len); + retval = kenwood_safe_transaction(rig, buf, ackbuf, sizeof(ackbuf), + 9 + value_len); + if (retval != RIG_OK) { RETURNFUNC(retval); @@ -238,14 +241,17 @@ static int ts480_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) switch (func) { - case RIG_FUNC_MON: - snprintf(buf, sizeof(buf), "ML00%c", (status == 0) ? '0' : '1'); - RETURNFUNC(kenwood_transaction(rig, buf, NULL, 0)); - case RIG_FUNC_LOCK: - snprintf(buf, sizeof(buf), "LK%c%c", (status == 0) ? '0' : '1', (status == 0) ? '0' : '1'); - RETURNFUNC(kenwood_transaction(rig, buf, NULL, 0)); - default: - return kenwood_set_func(rig, vfo, func, status); + case RIG_FUNC_MON: + snprintf(buf, sizeof(buf), "ML00%c", (status == 0) ? '0' : '1'); + RETURNFUNC(kenwood_transaction(rig, buf, NULL, 0)); + + case RIG_FUNC_LOCK: + snprintf(buf, sizeof(buf), "LK%c%c", (status == 0) ? '0' : '1', + (status == 0) ? '0' : '1'); + RETURNFUNC(kenwood_transaction(rig, buf, NULL, 0)); + + default: + return kenwood_set_func(rig, vfo, func, status); } } @@ -258,29 +264,35 @@ static int ts480_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) switch (func) { - case RIG_FUNC_MON: { - int raw_value; - retval = kenwood_safe_transaction(rig, "ML", buf, sizeof(buf), 5); - if (retval != RIG_OK) - { - RETURNFUNC(retval); - } - sscanf(buf, "ML%d", &raw_value); + case RIG_FUNC_MON: + { + int raw_value; + retval = kenwood_safe_transaction(rig, "ML", buf, sizeof(buf), 5); - *status = (raw_value > 0); - break; + if (retval != RIG_OK) + { + RETURNFUNC(retval); } - case RIG_FUNC_LOCK: - retval = kenwood_safe_transaction(rig, "LK", buf, sizeof(buf), 4); - if (retval != RIG_OK) - { - RETURNFUNC(retval); - } - *status = buf[2] != '0' || buf[3] != '0'; - break; - default: - return kenwood_get_func(rig, vfo, func, status); + sscanf(buf, "ML%d", &raw_value); + + *status = (raw_value > 0); + break; + } + + case RIG_FUNC_LOCK: + retval = kenwood_safe_transaction(rig, "LK", buf, sizeof(buf), 4); + + if (retval != RIG_OK) + { + RETURNFUNC(retval); + } + + *status = buf[2] != '0' || buf[3] != '0'; + break; + + default: + return kenwood_get_func(rig, vfo, func, status); } RETURNFUNC(RIG_OK); @@ -355,34 +367,42 @@ int kenwood_ts480_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) break; case RIG_LEVEL_PREAMP: - if (val.i != 12 && val.i != 0) { + if (val.i != 12 && val.i != 0) + { RETURNFUNC(-RIG_EINVAL); } + sprintf(levelbuf, "PA%c", (val.i == 12) ? '1' : '0'); break; case RIG_LEVEL_ATT: - if (val.i != 12 && val.i != 0) { + if (val.i != 12 && val.i != 0) + { RETURNFUNC(-RIG_EINVAL); } + sprintf(levelbuf, "RA%02d", (val.i == 12) ? 1 : 0); break; case RIG_LEVEL_METER: switch (val.i) { - case RIG_METER_SWR: - kenwood_val = 1; - break; - case RIG_METER_COMP: - kenwood_val = 2; - break; - case RIG_METER_ALC: - kenwood_val = 3; - break; - default: - RETURNFUNC(-RIG_EINVAL); + case RIG_METER_SWR: + kenwood_val = 1; + break; + + case RIG_METER_COMP: + kenwood_val = 2; + break; + + case RIG_METER_ALC: + kenwood_val = 3; + break; + + default: + RETURNFUNC(-RIG_EINVAL); } + sprintf(levelbuf, "RM%d", kenwood_val); break; @@ -434,14 +454,18 @@ static int ts480_read_meters(RIG *rig, int *swr, int *comp, int *alc) if (retval != expected_len) { - rig_debug(RIG_DEBUG_ERR, "%s: expected %d bytes, got %d in '%s'\n", __func__, expected_len, retval, ackbuf); + rig_debug(RIG_DEBUG_ERR, "%s: expected %d bytes, got %d in '%s'\n", __func__, + expected_len, retval, ackbuf); RETURNFUNC(-RIG_EPROTO); } retval = sscanf(ackbuf, "RM1%d;RM2%d;RM3%d;", swr, comp, alc); + if (retval != 3) { - rig_debug(RIG_DEBUG_ERR, "%s: expected 3 meter values to parse, got %d in '%s'\n", __func__, retval, ackbuf); + rig_debug(RIG_DEBUG_ERR, + "%s: expected 3 meter values to parse, got %d in '%s'\n", __func__, retval, + ackbuf); RETURNFUNC(-RIG_EPROTO); } @@ -548,6 +572,7 @@ kenwood_ts480_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) default: return -RIG_EPROTO; } + return RIG_OK; case RIG_LEVEL_STRENGTH: @@ -559,39 +584,48 @@ kenwood_ts480_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) return kenwood_get_level(rig, vfo, level, val); - case RIG_LEVEL_MONITOR_GAIN: { + case RIG_LEVEL_MONITOR_GAIN: + { int raw_value; retval = kenwood_safe_transaction(rig, "ML", ackbuf, sizeof(ackbuf), 5); + if (retval != RIG_OK) { RETURNFUNC(retval); } + sscanf(ackbuf, "ML%d", &raw_value); val->f = (float) raw_value / 9.0f; break; } - case RIG_LEVEL_NB: { + case RIG_LEVEL_NB: + { int raw_value; retval = kenwood_safe_transaction(rig, "NL", ackbuf, sizeof(ackbuf), 5); + if (retval != RIG_OK) { RETURNFUNC(retval); } + sscanf(ackbuf, "NL%d", &raw_value); val->f = (float) raw_value / 10.0f; break; } - case RIG_LEVEL_NR: { + case RIG_LEVEL_NR: + { int raw_value; retval = kenwood_safe_transaction(rig, "RL", ackbuf, sizeof(ackbuf), 4); + if (retval != RIG_OK) { RETURNFUNC(retval); } + sscanf(ackbuf, "RL%d", &raw_value); val->f = (float) raw_value / 9.0f; @@ -600,59 +634,72 @@ kenwood_ts480_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) case RIG_LEVEL_PREAMP: retval = kenwood_safe_transaction(rig, "PA", ackbuf, sizeof(ackbuf), 4); + if (retval != RIG_OK) { RETURNFUNC(retval); } + val->i = ackbuf[2] == '1' ? 12 : 0; break; case RIG_LEVEL_ATT: retval = kenwood_safe_transaction(rig, "RA", ackbuf, sizeof(ackbuf), 6); + if (retval != RIG_OK) { RETURNFUNC(retval); } + val->i = ackbuf[3] == '1' ? 12 : 0; break; - case RIG_LEVEL_METER: { + case RIG_LEVEL_METER: + { int raw_value; // TODO: Read all meters at the same time: RM10000;RM20000;RM30000; retval = kenwood_safe_transaction(rig, "RM", ackbuf, sizeof(ackbuf), 7); + if (retval != RIG_OK) { RETURNFUNC(retval); } sscanf(ackbuf, "RM%1d", &raw_value); + switch (raw_value) { - case 1: - val->i = RIG_METER_SWR; - break; - case 2: - val->i = RIG_METER_COMP; - break; - case 3: - val->i = RIG_METER_ALC; - break; - default: - val->i = RIG_METER_NONE; + case 1: + val->i = RIG_METER_SWR; + break; + + case 2: + val->i = RIG_METER_COMP; + break; + + case 3: + val->i = RIG_METER_ALC; + break; + + default: + val->i = RIG_METER_NONE; } + break; } case RIG_LEVEL_SWR: case RIG_LEVEL_COMP_METER: - case RIG_LEVEL_ALC: { + case RIG_LEVEL_ALC: + { int swr; int comp; int alc; retval = ts480_read_meters(rig, &swr, &comp, &alc); + if (retval != RIG_OK) { RETURNFUNC(retval); @@ -660,30 +707,36 @@ kenwood_ts480_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) switch (level) { - case RIG_LEVEL_SWR: - if (rig->caps->swr_cal.size) - { - val->f = rig_raw2val_float(swr, &rig->caps->swr_cal); - } - else - { - val->f = (float) swr / 2.0f; - } - break; - case RIG_LEVEL_COMP_METER: - val->f = (float) comp; // Maximum value is 20dB - break; - case RIG_LEVEL_ALC: - // Maximum value is 20, so have the max at 5 just to be on the range where other rigs report ALC - val->f = (float) alc / 4.0f; - break; - default: - return -RIG_ENAVAIL; + case RIG_LEVEL_SWR: + if (rig->caps->swr_cal.size) + { + val->f = rig_raw2val_float(swr, &rig->caps->swr_cal); + } + else + { + val->f = (float) swr / 2.0f; + } + + break; + + case RIG_LEVEL_COMP_METER: + val->f = (float) comp; // Maximum value is 20dB + break; + + case RIG_LEVEL_ALC: + // Maximum value is 20, so have the max at 5 just to be on the range where other rigs report ALC + val->f = (float) alc / 4.0f; + break; + + default: + return -RIG_ENAVAIL; } + break; } - case RIG_LEVEL_RFPOWER_METER: { + case RIG_LEVEL_RFPOWER_METER: + { int raw_value; if (rig->state.cache.ptt == RIG_PTT_OFF) @@ -693,6 +746,7 @@ kenwood_ts480_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) } retval = kenwood_safe_transaction(rig, "SM0", ackbuf, sizeof(ackbuf), 7); + if (retval != RIG_OK) { RETURNFUNC(retval); @@ -704,9 +758,11 @@ kenwood_ts480_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) break; } - case RIG_LEVEL_CWPITCH: { + case RIG_LEVEL_CWPITCH: + { int raw_value; retval = ts480_get_ex_menu(rig, 34, 2, &raw_value); + if (retval != RIG_OK) { RETURNFUNC(retval); @@ -740,13 +796,16 @@ static int ts480_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) // RC clear command cannot be executed if RIT/XIT is not enabled retval = kenwood_get_func(rig, vfo, RIG_FUNC_RIT, &rit_enabled); + if (retval != RIG_OK) { RETURNFUNC(retval); } + if (!rit_enabled) { retval = kenwood_get_func(rig, vfo, RIG_FUNC_XIT, &xit_enabled); + if (retval != RIG_OK) { RETURNFUNC(retval); @@ -756,6 +815,7 @@ static int ts480_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) if (!rit_enabled && !xit_enabled) { retval = kenwood_set_func(rig, vfo, RIG_FUNC_RIT, 1); + if (retval != RIG_OK) { RETURNFUNC(retval); @@ -763,6 +823,7 @@ static int ts480_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) } retval = kenwood_transaction(rig, "RC", NULL, 0); + if (retval != RIG_OK) { RETURNFUNC(retval); @@ -771,6 +832,7 @@ static int ts480_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) if (!rit_enabled && !xit_enabled) { retval = kenwood_set_func(rig, vfo, RIG_FUNC_RIT, 0); + if (retval != RIG_OK) { RETURNFUNC(retval); @@ -825,37 +887,45 @@ static int ts480_set_ext_func(RIG *rig, vfo_t vfo, token_t token, int status) switch (token) { - case TOK_FUNC_NOISE_REDUCTION_2: - if (status < 0 || status > 1) - { - RETURNFUNC(-RIG_EINVAL); - } - snprintf(cmdbuf, sizeof(cmdbuf), "NR%d", status ? 2 : 0); - retval = kenwood_transaction(rig, cmdbuf, NULL, 0); - break; - case TOK_FUNC_CW_IF_FOR_SSB_RX: - if (status < 0 || status > 1) - { - RETURNFUNC(-RIG_EINVAL); - } - retval = ts480_set_ex_menu(rig, 17, 1, status); - break; - case TOK_FUNC_FILTER_WIDTH_DATA: - if (status < 0 || status > 1) - { - RETURNFUNC(-RIG_EINVAL); - } - retval = ts480_set_ex_menu(rig, 45, 1, status); - break; - case TOK_FUNC_TX_AUDIO_FROM_DATA_INPUT: - if (status < 0 || status > 1) - { - RETURNFUNC(-RIG_EINVAL); - } - retval = ts480_set_ex_menu(rig, 60, 1, status); - break; - default: + case TOK_FUNC_NOISE_REDUCTION_2: + if (status < 0 || status > 1) + { RETURNFUNC(-RIG_EINVAL); + } + + snprintf(cmdbuf, sizeof(cmdbuf), "NR%d", status ? 2 : 0); + retval = kenwood_transaction(rig, cmdbuf, NULL, 0); + break; + + case TOK_FUNC_CW_IF_FOR_SSB_RX: + if (status < 0 || status > 1) + { + RETURNFUNC(-RIG_EINVAL); + } + + retval = ts480_set_ex_menu(rig, 17, 1, status); + break; + + case TOK_FUNC_FILTER_WIDTH_DATA: + if (status < 0 || status > 1) + { + RETURNFUNC(-RIG_EINVAL); + } + + retval = ts480_set_ex_menu(rig, 45, 1, status); + break; + + case TOK_FUNC_TX_AUDIO_FROM_DATA_INPUT: + if (status < 0 || status > 1) + { + RETURNFUNC(-RIG_EINVAL); + } + + retval = ts480_set_ex_menu(rig, 60, 1, status); + break; + + default: + RETURNFUNC(-RIG_EINVAL); } RETURNFUNC(retval); @@ -870,31 +940,37 @@ static int ts480_get_ext_func(RIG *rig, vfo_t vfo, token_t token, int *status) switch (token) { - case TOK_FUNC_NOISE_REDUCTION_2: { - int value; - - retval = kenwood_safe_transaction(rig, "NR", ackbuf, sizeof(ackbuf), 3); - if (retval != RIG_OK) - { - RETURNFUNC(retval); - } + case TOK_FUNC_NOISE_REDUCTION_2: + { + int value; - sscanf(ackbuf, "NR%d", &value); + retval = kenwood_safe_transaction(rig, "NR", ackbuf, sizeof(ackbuf), 3); - *status = (value == 2) ? 1 : 0; - break; + if (retval != RIG_OK) + { + RETURNFUNC(retval); } - case TOK_FUNC_CW_IF_FOR_SSB_RX: - retval = ts480_get_ex_menu(rig, 17, 1, status); - break; - case TOK_FUNC_FILTER_WIDTH_DATA: - retval = ts480_get_ex_menu(rig, 45, 1, status); - break; - case TOK_FUNC_TX_AUDIO_FROM_DATA_INPUT: - retval = ts480_get_ex_menu(rig, 60, 1, status); - break; - default: - RETURNFUNC(-RIG_EINVAL); + + sscanf(ackbuf, "NR%d", &value); + + *status = (value == 2) ? 1 : 0; + break; + } + + case TOK_FUNC_CW_IF_FOR_SSB_RX: + retval = ts480_get_ex_menu(rig, 17, 1, status); + break; + + case TOK_FUNC_FILTER_WIDTH_DATA: + retval = ts480_get_ex_menu(rig, 45, 1, status); + break; + + case TOK_FUNC_TX_AUDIO_FROM_DATA_INPUT: + retval = ts480_get_ex_menu(rig, 60, 1, status); + break; + + default: + RETURNFUNC(-RIG_EINVAL); } RETURNFUNC(retval); @@ -909,65 +985,82 @@ static int ts480_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val) switch (token) { - case TOK_LEVEL_DIGITAL_NOISE_LIMITER: - if (val.i < 0 || val.i > 3) - { - RETURNFUNC(-RIG_EINVAL); - } - snprintf(cmdbuf, sizeof(cmdbuf), "DL%d%02d", val.i != 0 ? 1 : 0, val.i > 0 ? val.i - 1 : 0); - retval = kenwood_transaction(rig, cmdbuf, NULL, 0); - break; - case TOK_LEVEL_DSP_RX_EQUALIZER: - if (val.i < 0 || val.i > 7) - { - RETURNFUNC(-RIG_EINVAL); - } - retval = ts480_set_ex_menu(rig, 18, 1, val.i); - break; - case TOK_LEVEL_DSP_TX_EQUALIZER: - if (val.i < 0 || val.i > 7) - { - RETURNFUNC(-RIG_EINVAL); - } - retval = ts480_set_ex_menu(rig, 19, 1, val.i); - break; - case TOK_LEVEL_DSP_TX_BANDWIDTH: - if (val.i < 0 || val.i > 1) - { - RETURNFUNC(-RIG_EINVAL); - } - retval = ts480_set_ex_menu(rig, 20, 1, val.i); - break; - case TOK_LEVEL_BEEP_VOLUME: - if (val.f < 0 || val.f > 9) - { - RETURNFUNC(-RIG_EINVAL); - } - retval = ts480_set_ex_menu(rig, 12, 1, (int) val.f); - break; - case TOK_LEVEL_TX_SIDETONE_VOLUME: - if (val.f < 0 || val.f > 9) - { - RETURNFUNC(-RIG_EINVAL); - } - retval = ts480_set_ex_menu(rig, 13, 1, (int) val.f); - break; - case TOK_LEVEL_AF_INPUT_LEVEL: - if (val.f < 0 || val.f > 9) - { - RETURNFUNC(-RIG_EINVAL); - } - retval = ts480_set_ex_menu(rig, 46, 1, (int) val.f); - break; - case TOK_LEVEL_AF_OUTPUT_LEVEL: - if (val.f < 0 || val.f > 9) - { - RETURNFUNC(-RIG_EINVAL); - } - retval = ts480_set_ex_menu(rig, 47, 1, (int) val.f); - break; - default: + case TOK_LEVEL_DIGITAL_NOISE_LIMITER: + if (val.i < 0 || val.i > 3) + { RETURNFUNC(-RIG_EINVAL); + } + + snprintf(cmdbuf, sizeof(cmdbuf), "DL%d%02d", val.i != 0 ? 1 : 0, + val.i > 0 ? val.i - 1 : 0); + retval = kenwood_transaction(rig, cmdbuf, NULL, 0); + break; + + case TOK_LEVEL_DSP_RX_EQUALIZER: + if (val.i < 0 || val.i > 7) + { + RETURNFUNC(-RIG_EINVAL); + } + + retval = ts480_set_ex_menu(rig, 18, 1, val.i); + break; + + case TOK_LEVEL_DSP_TX_EQUALIZER: + if (val.i < 0 || val.i > 7) + { + RETURNFUNC(-RIG_EINVAL); + } + + retval = ts480_set_ex_menu(rig, 19, 1, val.i); + break; + + case TOK_LEVEL_DSP_TX_BANDWIDTH: + if (val.i < 0 || val.i > 1) + { + RETURNFUNC(-RIG_EINVAL); + } + + retval = ts480_set_ex_menu(rig, 20, 1, val.i); + break; + + case TOK_LEVEL_BEEP_VOLUME: + if (val.f < 0 || val.f > 9) + { + RETURNFUNC(-RIG_EINVAL); + } + + retval = ts480_set_ex_menu(rig, 12, 1, (int) val.f); + break; + + case TOK_LEVEL_TX_SIDETONE_VOLUME: + if (val.f < 0 || val.f > 9) + { + RETURNFUNC(-RIG_EINVAL); + } + + retval = ts480_set_ex_menu(rig, 13, 1, (int) val.f); + break; + + case TOK_LEVEL_AF_INPUT_LEVEL: + if (val.f < 0 || val.f > 9) + { + RETURNFUNC(-RIG_EINVAL); + } + + retval = ts480_set_ex_menu(rig, 46, 1, (int) val.f); + break; + + case TOK_LEVEL_AF_OUTPUT_LEVEL: + if (val.f < 0 || val.f > 9) + { + RETURNFUNC(-RIG_EINVAL); + } + + retval = ts480_set_ex_menu(rig, 47, 1, (int) val.f); + break; + + default: + RETURNFUNC(-RIG_EINVAL); } RETURNFUNC(retval); @@ -983,57 +1076,68 @@ static int ts480_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val) switch (token) { - case TOK_LEVEL_DIGITAL_NOISE_LIMITER: { - int enabled; - int level; - - retval = kenwood_safe_transaction(rig, "DL", ackbuf, sizeof(ackbuf), 5); - if (retval != RIG_OK) - { - RETURNFUNC(retval); - } + case TOK_LEVEL_DIGITAL_NOISE_LIMITER: + { + int enabled; + int level; - sscanf(ackbuf, "DL%1d%2d", &enabled, &level); + retval = kenwood_safe_transaction(rig, "DL", ackbuf, sizeof(ackbuf), 5); - val->i = enabled ? level + 1 : 0; - break; + if (retval != RIG_OK) + { + RETURNFUNC(retval); } - case TOK_LEVEL_DSP_RX_EQUALIZER: - retval = ts480_get_ex_menu(rig, 18, 1, &value); - val->i = value; - break; - case TOK_LEVEL_DSP_TX_EQUALIZER: - retval = ts480_get_ex_menu(rig, 19, 1, &value); - val->i = value; - break; - case TOK_LEVEL_DSP_TX_BANDWIDTH: - retval = ts480_get_ex_menu(rig, 20, 1, &value); - val->i = value; - break; - case TOK_LEVEL_BEEP_VOLUME: - retval = ts480_get_ex_menu(rig, 12, 1, &value); - val->f = value; - break; - case TOK_LEVEL_TX_SIDETONE_VOLUME: - retval = ts480_get_ex_menu(rig, 13, 1, &value); - val->f = value; - break; - case TOK_LEVEL_AF_INPUT_LEVEL: - retval = ts480_get_ex_menu(rig, 46, 1, &value); - val->f = value; - break; - case TOK_LEVEL_AF_OUTPUT_LEVEL: - retval = ts480_get_ex_menu(rig, 47, 1, &value); - val->f = value; - break; - default: - RETURNFUNC(-RIG_EINVAL); + + sscanf(ackbuf, "DL%1d%2d", &enabled, &level); + + val->i = enabled ? level + 1 : 0; + break; + } + + case TOK_LEVEL_DSP_RX_EQUALIZER: + retval = ts480_get_ex_menu(rig, 18, 1, &value); + val->i = value; + break; + + case TOK_LEVEL_DSP_TX_EQUALIZER: + retval = ts480_get_ex_menu(rig, 19, 1, &value); + val->i = value; + break; + + case TOK_LEVEL_DSP_TX_BANDWIDTH: + retval = ts480_get_ex_menu(rig, 20, 1, &value); + val->i = value; + break; + + case TOK_LEVEL_BEEP_VOLUME: + retval = ts480_get_ex_menu(rig, 12, 1, &value); + val->f = value; + break; + + case TOK_LEVEL_TX_SIDETONE_VOLUME: + retval = ts480_get_ex_menu(rig, 13, 1, &value); + val->f = value; + break; + + case TOK_LEVEL_AF_INPUT_LEVEL: + retval = ts480_get_ex_menu(rig, 46, 1, &value); + val->f = value; + break; + + case TOK_LEVEL_AF_OUTPUT_LEVEL: + retval = ts480_get_ex_menu(rig, 47, 1, &value); + val->f = value; + break; + + default: + RETURNFUNC(-RIG_EINVAL); } RETURNFUNC(retval); } -static struct kenwood_filter_width ts480_filter_width[] = { +static struct kenwood_filter_width ts480_filter_width[] = +{ { RIG_MODE_CW | RIG_MODE_CWR, 50, 50 }, { RIG_MODE_CW | RIG_MODE_CWR, 80, 80 }, { RIG_MODE_CW | RIG_MODE_CWR, 100, 100 }, @@ -1058,7 +1162,8 @@ static struct kenwood_filter_width ts480_filter_width[] = { { RIG_MODE_NONE, -1, -1 }, }; -static struct kenwood_slope_filter ts480_slope_filter_high[] = { +static struct kenwood_slope_filter ts480_slope_filter_high[] = +{ { RIG_MODE_SSB | RIG_MODE_FM | RIG_MODE_RTTY | RIG_MODE_RTTYR, 0, 0, 1000 }, { RIG_MODE_SSB | RIG_MODE_FM | RIG_MODE_RTTY | RIG_MODE_RTTYR, 0, 1, 1200 }, { RIG_MODE_SSB | RIG_MODE_FM | RIG_MODE_RTTY | RIG_MODE_RTTYR, 0, 2, 1400 }, @@ -1083,7 +1188,8 @@ static struct kenwood_slope_filter ts480_slope_filter_high[] = { { RIG_MODE_NONE, 0, -1, -1 }, }; -static struct kenwood_slope_filter ts480_slope_filter_low[] = { +static struct kenwood_slope_filter ts480_slope_filter_low[] = +{ { RIG_MODE_SSB | RIG_MODE_FM | RIG_MODE_RTTY | RIG_MODE_RTTYR, 0, 0, 0 }, { RIG_MODE_SSB | RIG_MODE_FM | RIG_MODE_RTTY | RIG_MODE_RTTYR, 0, 1, 50 }, { RIG_MODE_SSB | RIG_MODE_FM | RIG_MODE_RTTY | RIG_MODE_RTTYR, 0, 2, 100 }, @@ -1126,6 +1232,7 @@ int ts480_init(RIG *rig) rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); retval = kenwood_init(rig); + if (retval != RIG_OK) { return retval; diff --git a/src/iofunc.c b/src/iofunc.c index 0e58e217..b42318c1 100644 --- a/src/iofunc.c +++ b/src/iofunc.c @@ -481,7 +481,7 @@ int HAMLIB_API write_block(hamlib_port_t *p, const char *txbuffer, size_t count) return -RIG_EIO; } - if (p->write_delay > 0) hl_usleep(p->write_delay * 1000); + if (p->write_delay > 0) { hl_usleep(p->write_delay * 1000); } } } else diff --git a/src/rig.c b/src/rig.c index aece5b8b..358c1441 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1005,6 +1005,7 @@ int HAMLIB_API rig_open(RIG *rig) * trigger state->current_vfo first retrieval */ TRACE; + if (rig_get_vfo(rig, &rs->current_vfo) == RIG_OK) { rs->tx_vfo = rs->current_vfo; @@ -1744,10 +1745,13 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { rig_debug(RIG_DEBUG_TRACE, "%s: Ignoring set_freq due to VFO twiddling\n", __func__); - if (vfo != vfo_save && vfo != RIG_VFO_CURR) { + + if (vfo != vfo_save && vfo != RIG_VFO_CURR) + { TRACE; rig_set_vfo(rig, vfo_save); } + RETURNFUNC( RIG_OK); // would be better as error but other software won't handle errors } @@ -1814,10 +1818,13 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { rig_debug(RIG_DEBUG_TRACE, "%s: Ignoring set_freq due to VFO twiddling\n", __func__); - if (vfo != vfo_save && vfo != RIG_VFO_CURR) { + + if (vfo != vfo_save && vfo != RIG_VFO_CURR) + { TRACE; rig_set_vfo(rig, vfo_save); } + RETURNFUNC( RIG_OK); // would be better as error but other software won't handle errors } @@ -1862,7 +1869,8 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) set_cache_freq(rig, vfo, freq_new); - if (vfo != vfo_save && vfo != RIG_VFO_CURR) { + if (vfo != vfo_save && vfo != RIG_VFO_CURR) + { TRACE; rig_set_vfo(rig, vfo_save); } @@ -1914,7 +1922,7 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) vfo = vfo_fixup(rig, vfo); - if (vfo == RIG_VFO_CURR) vfo = curr_vfo; + if (vfo == RIG_VFO_CURR) { vfo = curr_vfo; } // we ignore get_freq for the uplink VFO for gpredict to behave better if ((rig->state.uplink == 1 && vfo == RIG_VFO_SUB) @@ -3950,7 +3958,9 @@ int HAMLIB_API rig_set_split_mode(RIG *rig, } else { - rig_debug(RIG_DEBUG_WARN, "%s: rig does not have set_vfo or vfo_op. Assuming mode already set\n", __func__); + rig_debug(RIG_DEBUG_WARN, + "%s: rig does not have set_vfo or vfo_op. Assuming mode already set\n", + __func__); RETURNFUNC(RIG_OK); } @@ -6209,11 +6219,11 @@ const char *HAMLIB_API rig_get_info(RIG *rig) */ int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len) { - vfo_t vfoA,vfoB; - freq_t freqA,freqB; - rmode_t modeA,modeB; + vfo_t vfoA, vfoB; + freq_t freqA, freqB; + rmode_t modeA, modeB; char *modeAstr, *modeBstr; - pbwidth_t widthA,widthB; + pbwidth_t widthA, widthB; split_t split; int satmode; int ret; @@ -6222,30 +6232,42 @@ int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len) vfoA = vfo_fixup(rig, RIG_VFO_A); vfoB = vfo_fixup(rig, RIG_VFO_B); - ret = rig_get_vfo_info(rig, vfoA, &freqA, &modeA, &widthA, &split, &satmode); - if (ret != RIG_OK) RETURNFUNC(ret); + ret = rig_get_vfo_info(rig, vfoA, &freqA, &modeA, &widthA, &split, &satmode); + + if (ret != RIG_OK) { RETURNFUNC(ret); } + // we need both vfo and mode targtable to avoid vfo swapping - if ((rig->caps->targetable_vfo & RIG_TARGETABLE_FREQ) && (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)) + if ((rig->caps->targetable_vfo & RIG_TARGETABLE_FREQ) + && (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)) { - ret = rig_get_vfo_info(rig, vfoB, &freqB, &modeB, &widthB, &split, &satmode); - if (ret != RIG_OK) RETURNFUNC(ret); + ret = rig_get_vfo_info(rig, vfoB, &freqB, &modeB, &widthB, &split, &satmode); + + if (ret != RIG_OK) { RETURNFUNC(ret); } } else { // we'll use cached info instead of doing the vfo swapping int cache_ms_freq, cache_ms_mode, cache_ms_width; - rig_get_cache(rig, vfoB, &freqB, &cache_ms_freq, &modeB, &cache_ms_mode, &widthB, + rig_get_cache(rig, vfoB, &freqB, &cache_ms_freq, &modeB, &cache_ms_mode, + &widthB, &cache_ms_width); } - modeAstr = (char*)rig_strrmode(modeA); - modeBstr = (char*)rig_strrmode(modeB); - if (modeAstr[0]==0) modeAstr="None"; - if (modeBstr[0]==0) modeBstr="None"; + + modeAstr = (char *)rig_strrmode(modeA); + modeBstr = (char *)rig_strrmode(modeB); + + if (modeAstr[0] == 0) { modeAstr = "None"; } + + if (modeBstr[0] == 0) { modeBstr = "None"; } + rxa = 1; txa = split == 0; rxb = !rxa; txb = split == 1; - snprintf(response,max_response_len,"VFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nVFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nSplit=%d SatMode=%d", rig_strvfo(vfoA), freqA, modeAstr, (int)widthA, rxa, txa, rig_strvfo(vfoB), freqB, modeBstr, (int)widthB, rxb, txb, split, satmode); + snprintf(response, max_response_len, + "VFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nVFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nSplit=%d SatMode=%d", + rig_strvfo(vfoA), freqA, modeAstr, (int)widthA, rxa, txa, rig_strvfo(vfoB), + freqB, modeBstr, (int)widthB, rxb, txb, split, satmode); RETURNFUNC(RIG_OK); } @@ -6281,7 +6303,7 @@ int HAMLIB_API rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, //if (vfo == RIG_VFO_CURR) { vfo = rig->state.current_vfo; } - vfo = vfo_fixup(rig,vfo); + vfo = vfo_fixup(rig, vfo); // we can't use the cached values as some clients may only call this function // like Log4OM which mostly does polling TRACE; diff --git a/tests/rigctl.c b/tests/rigctl.c index d3777f56..caa89bfa 100644 --- a/tests/rigctl.c +++ b/tests/rigctl.c @@ -524,17 +524,21 @@ int main(int argc, char *argv[]) { // if rigctld then we need to open to get the rig caps - if (my_model == RIG_MODEL_NETRIGCTL) { + if (my_model == RIG_MODEL_NETRIGCTL) + { int ret; rig_set_debug(verbose); my_rig = rig_init(my_model); - if((ret=rig_open(my_rig)) != RIG_OK) + + if ((ret = rig_open(my_rig)) != RIG_OK) { - fprintf(stderr,"Unable to open rigctld: %s\n", rigerror(ret)); + fprintf(stderr, "Unable to open rigctld: %s\n", rigerror(ret)); exit(1); } + rig_close(my_rig); } + dumpcaps(my_rig, stdout); rig_cleanup(my_rig); /* if you care about memory */ exit(0); diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index a3f2064c..63ca1793 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -2221,8 +2221,10 @@ declare_proto_rig(get_rig_info) int ret; ENTERFUNC; ret = rig_get_rig_info(rig, buf, sizeof(buf)); - if (ret != RIG_OK) RETURNFUNC(ret); - fprintf(fout,"%s\n", buf); + + if (ret != RIG_OK) { RETURNFUNC(ret); } + + fprintf(fout, "%s\n", buf); RETURNFUNC(RIG_OK); } @@ -4354,20 +4356,24 @@ declare_proto_rig(dump_state) fprintf(fout, "has_mW2power=%d\n", rig->caps->mW2power != NULL); fprintf(fout, "timeout=%d\n", rig->caps->timeout); fprintf(fout, "ctcss_list="); + for (i = 0; i < CTCSS_LIST_SIZE && rig->caps->ctcss_list[i] != 0; i++) { fprintf(fout, - " %u.%1u", - rig->caps->ctcss_list[i] / 10, rig->caps->ctcss_list[i] % 10); + " %u.%1u", + rig->caps->ctcss_list[i] / 10, rig->caps->ctcss_list[i] % 10); } + fprintf(fout, "\n"); fprintf(fout, "dcs_list="); + for (i = 0; i < DCS_LIST_SIZE && rig->caps->dcs_list[i] != 0; i++) { fprintf(fout, - " %u", - rig->caps->dcs_list[i]); + " %u", + rig->caps->dcs_list[i]); } + fprintf(fout, "\n"); fprintf(fout, "done\n"); ----------------------------------------------------------------------- Summary of changes: rigs/dummy/netrigctl.c | 61 ++++-- rigs/icom/icom.c | 1 + rigs/kenwood/kenwood.c | 18 +- rigs/kenwood/tmd710.c | 1 + rigs/kenwood/ts480.c | 581 +++++++++++++++++++++++++++++-------------------- src/iofunc.c | 2 +- src/rig.c | 64 ++++-- tests/rigctl.c | 10 +- tests/rigctl_parse.c | 18 +- 9 files changed, 462 insertions(+), 294 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-04-29 22:20:55
|
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 604516ed8f839e4927ecca34340f9e1f88576a58 (commit) via 697a194752904a3fe245de779c7b0155017996ef (commit) via 386b08dc4f529876f5c22fb36131b5fba73b064a (commit) via 4e60ebf1d6928bd8c7d3b485c6f4d045a75e7af7 (commit) from 5473249e9ad75a302839804a0811039245f13c04 (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 604516ed8f839e4927ecca34340f9e1f88576a58 Author: Mike Black W9MDB <mdb...@ya...> Date: Thu Apr 29 17:16:51 2021 -0500 Clean up mingw compiler warning for tones.h https://github.com/Hamlib/Hamlib/issues/659 diff --git a/rigs/kenwood/tmd710.c b/rigs/kenwood/tmd710.c index 846de326..5e794e56 100644 --- a/rigs/kenwood/tmd710.c +++ b/rigs/kenwood/tmd710.c @@ -1219,7 +1219,8 @@ int tmd710_get_dcs_sql(RIG *rig, vfo_t vfo, tone_t *code) if (fo_struct.dcs) { - *code = common_dcs_list[fo_struct.dcs_val]; + tone_t *dcs_list = common_dcs_list; + *code = dcs_list[fo_struct.dcs_val]; } else { @@ -1234,9 +1235,10 @@ static int tmd710_find_dcs_index(tone_t code, uint32_t *dcs_index) int i = 0; // we only allow exact matches here - while (code != common_dcs_list[i]) + tone_t *dcs_list = common_dcs_list; + while (code != dcs_list[i]) { - if (common_dcs_list[i] == 0) + if (dcs_list[i] == 0) { return -RIG_EINVAL; } @@ -1889,7 +1891,8 @@ int tmd710_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) if (me_struct.dcs) { - chan->dcs_sql = common_dcs_list[me_struct.dcs_val]; + tone_t *dcs_list = common_dcs_list; + chan->dcs_sql = dcs_list[me_struct.dcs_val]; } else { diff --git a/src/tones.h b/src/tones.h index 1e6288dd..76f10254 100644 --- a/src/tones.h +++ b/src/tones.h @@ -37,12 +37,10 @@ 2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418, 2503, 2541, \ 0, -#if 1 static const tone_t static_full_ctcss_list[] = { FULL_CTCSS_LIST }; -#endif #define FULL_CTCSS_LIST_COUNT 52 @@ -62,12 +60,10 @@ static const tone_t static_full_ctcss_list[] = 2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418, 2503, 2541, \ 0, -#if 1 static const tone_t static_common_ctcss_list[] = { COMMON_CTCSS_LIST }; -#endif #define COMMON_CTCSS_LIST_COUNT 50 @@ -87,12 +83,10 @@ static const tone_t static_common_ctcss_list[] = 662, 664, 703, 712, 723, 731, 732, 734, 743, 754, \ 0, -#if 1 static const tone_t static_common_dcs_list[] = { COMMON_DCS_LIST }; -#endif #define COMMON_DCS_LIST_COUNT 104 @@ -111,12 +105,10 @@ static const tone_t static_common_dcs_list[] = 662, 664, 703, 712, 723, 731, 732, 734, 743, 754, \ 0, -#if 1 static const tone_t static_full_dcs_list[] = { FULL_DCS_LIST }; -#endif #define FULL_DCS_LIST_COUNT 106 diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 01892211..a3f2064c 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -4344,6 +4344,9 @@ declare_proto_rig(dump_state) fprintf(fout, "has_get_freq=%d\n", rig->caps->get_freq != NULL); fprintf(fout, "has_set_conf=%d\n", rig->caps->set_conf != NULL); fprintf(fout, "has_get_conf=%d\n", rig->caps->get_conf != NULL); + fprintf(fout, "has_set_parm=%d\n", rig->caps->set_parm != NULL); + fprintf(fout, "has_get_parm=%d\n", rig->caps->get_parm != NULL); + fprintf(fout, "parm_gran=0x%x\n", rig->caps->parm_gran); // for the future // fprintf(fout, "has_set_trn=%d\n", rig->caps->set_trn != NULL); // fprintf(fout, "has_get_trn=%d\n", rig->caps->get_trn != NULL); commit 697a194752904a3fe245de779c7b0155017996ef Author: Mike Black W9MDB <mdb...@ya...> Date: Thu Apr 29 17:06:45 2021 -0500 Fix mingw warnings from new ctcss_list definition https://github.com/Hamlib/Hamlib/issues/659 diff --git a/src/tones.h b/src/tones.h index 204b66f7..1e6288dd 100644 --- a/src/tones.h +++ b/src/tones.h @@ -37,7 +37,7 @@ 2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418, 2503, 2541, \ 0, -#if 0 +#if 1 static const tone_t static_full_ctcss_list[] = { FULL_CTCSS_LIST @@ -62,7 +62,7 @@ static const tone_t static_full_ctcss_list[] = 2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418, 2503, 2541, \ 0, -#if 0 +#if 1 static const tone_t static_common_ctcss_list[] = { COMMON_CTCSS_LIST @@ -87,7 +87,7 @@ static const tone_t static_common_ctcss_list[] = 662, 664, 703, 712, 723, 731, 732, 734, 743, 754, \ 0, -#if 0 +#if 1 static const tone_t static_common_dcs_list[] = { COMMON_DCS_LIST @@ -111,7 +111,7 @@ static const tone_t static_common_dcs_list[] = 662, 664, 703, 712, 723, 731, 732, 734, 743, 754, \ 0, -#if 0 +#if 1 static const tone_t static_full_dcs_list[] = { FULL_DCS_LIST @@ -125,10 +125,10 @@ static const tone_t static_full_dcs_list[] = * because DLL's vars don't have constant address. */ #if (defined(_WIN32) || defined(__CYGWIN__)) // && !defined(IN_HAMLIB) -#define common_ctcss_list static_common_ctcss_list -#define full_ctcss_list static_full_ctcss_list -#define full_dcs_list static_full_dcs_list -#define common_dcs_list static_common_dcs_list +#define common_ctcss_list (tone_t*)static_common_ctcss_list +#define full_ctcss_list (tone_t*)static_full_ctcss_list +#define full_dcs_list (tone_t*)static_full_dcs_list +#define common_dcs_list (tone_t*)static_common_dcs_list #else commit 386b08dc4f529876f5c22fb36131b5fba73b064a Author: Mike Black W9MDB <mdb...@ya...> Date: Thu Apr 29 10:49:29 2021 -0500 Add ctcss_list and dcs_list to rigctld so rigcctld caps reflects the connected rig https://github.com/Hamlib/Hamlib/issues/659 diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index ffb08df7..1f1c781e 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -214,6 +214,8 @@ typedef struct s_rig RIG; * * Digitally-Coded Squelch codes are simple direct integers. */ +#define CTCSS_LIST_SIZE 60 +#define DCS_LIST_SIZE 128 typedef unsigned int tone_t; @@ -1639,8 +1641,8 @@ struct rig_caps { const struct confparams *extfuncs; /*!< Extension func list, \sa ext.c */ int *ext_tokens; /*!< Extension token list */ - const tone_t *ctcss_list; /*!< CTCSS tones list, zero ended */ - const tone_t *dcs_list; /*!< DCS code list, zero ended */ + tone_t *ctcss_list; /*!< CTCSS tones list, zero ended */ + tone_t *dcs_list; /*!< DCS code list, zero ended */ int preamp[HAMLIB_MAXDBLSTSIZ]; /*!< Preamp list in dB, 0 terminated */ int attenuator[HAMLIB_MAXDBLSTSIZ]; /*!< Preamp list in dB, 0 terminated */ diff --git a/rigs/dummy/netrigctl.c b/rigs/dummy/netrigctl.c index 20c7cd50..e23f1055 100644 --- a/rigs/dummy/netrigctl.c +++ b/rigs/dummy/netrigctl.c @@ -41,7 +41,7 @@ #include "dummy.h" #define CMD_MAX 64 -#define BUF_MAX 96 +#define BUF_MAX 1024 #define CHKSCN1ARG(a) if ((a) != 1) return -RIG_EPROTO; else do {} while(0) @@ -198,6 +198,48 @@ static int netrigctl_cleanup(RIG *rig) return RIG_OK; } +int parse_array_int(const char *s, const char *delim, int *array, int array_len) +{ + char *p; + char *dup = strdup(s); + char *rest = dup; + int n=0; + ENTERFUNC; + while((p = strtok_r(rest, delim, &rest))) + { + if (n == array_len) { // too many items + return n; + } + array[n] = atoi(p); + //printf("%d\n", array[n]); + ++n; + } + free(dup); + return n; +} + +int parse_array_double(const char *s, const char *delim, double *array, int array_len) +{ + char *p; + char *dup = strdup(s); + char *rest = dup; + int n=0; + ENTERFUNC; + while((p = strtok_r(rest, delim, &rest))) + { + if (n == array_len) { // too many items + return n; + } + array[n] = atof(p); + //printf("%f\n", array[n]); + ++n; + } + free(dup); + return n; +} + + + static int netrigctl_open(RIG *rig) { int ret, len, i; @@ -576,7 +618,7 @@ static int netrigctl_open(RIG *rig) do { - char setting[32], value[256]; + char setting[32], value[1024]; ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); strtok(buf, "\r\n"); // chop the EOL @@ -587,7 +629,7 @@ static int netrigctl_open(RIG *rig) if (strncmp(buf, "done", 4) == 0) { return RIG_OK; } - if (sscanf(buf, "%31[^=]=%255[^\t\n]", setting, value) == 2) + if (sscanf(buf, "%31[^=]=%1024[^\t\n]", setting, value) == 2) { if (strcmp(setting, "vfo_ops") == 0) { @@ -679,7 +721,7 @@ static int netrigctl_open(RIG *rig) if (!has) { rig->caps->power2mW = NULL; } } - else if (strcmp(setting, "has_mw2power") == 0) + else if (strcmp(setting, "has_mW2power") == 0) { int has = strtol(value, NULL, 0); @@ -692,6 +734,26 @@ static int netrigctl_open(RIG *rig) rig_debug(RIG_DEBUG_TRACE, "%s: timeout value = '%s', final timeout=%d\n", __func__, value, rig->caps->timeout); } + else if (strcmp(setting, "ctcss_list") == 0) + { + int i; + int n; + double ctcss[CTCSS_LIST_SIZE]; + rig->caps->ctcss_list = calloc(CTCSS_LIST_SIZE, sizeof(tone_t)); + n = parse_array_double(value, " \n\r", ctcss, CTCSS_LIST_SIZE); + for(i=0;i<CTCSS_LIST_SIZE && ctcss[i] != 0;++i) rig->caps->ctcss_list[i] = ctcss[i]*10; + if (n < CTCSS_LIST_SIZE) rig->caps->ctcss_list[n] = 0; + } + else if (strcmp(setting,"dcs_list") == 0) + { + int i; + int n; + int dcs[DCS_LIST_SIZE+1]; + rig->caps->dcs_list = calloc(DCS_LIST_SIZE, sizeof(tone_t)); + n = parse_array_int(value, " \n\r", dcs, DCS_LIST_SIZE); + for(i=0;i<DCS_LIST_SIZE && dcs[i] != 0; i++) rig->caps->dcs_list[i] = dcs[i]; + if (n < DCS_LIST_SIZE) rig->caps->dcs_list[n] = 0; + } else { // not an error -- just a warning for backward compatibility diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index c39cbf5c..3ad2842a 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -157,7 +157,7 @@ rmode_t kenwood_mode_table[KENWOOD_MODE_TABLE_MAX] = /* * 38 CTCSS sub-audible tones */ -const tone_t kenwood38_ctcss_list[] = +tone_t kenwood38_ctcss_list[] = { 670, 719, 744, 770, 797, 825, 854, 885, 915, 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, 1318, @@ -170,7 +170,7 @@ const tone_t kenwood38_ctcss_list[] = /* * 42 CTCSS sub-audible tones */ -const tone_t kenwood42_ctcss_list[] = +tone_t kenwood42_ctcss_list[] = { 670, 693, 719, 744, 770, 797, 825, 854, 885, 915, 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, 1318, @@ -184,7 +184,7 @@ const tone_t kenwood42_ctcss_list[] = * * See enum rig_conf_e and struct confparams in rig.h */ -const struct confparams kenwood_cfg_params[] = +struct confparams kenwood_cfg_params[] = { { TOK_FINE, "fine", "Fine", "Fine step mode", diff --git a/rigs/kenwood/kenwood.h b/rigs/kenwood/kenwood.h index abe0829a..76b6436d 100644 --- a/rigs/kenwood/kenwood.h +++ b/rigs/kenwood/kenwood.h @@ -50,7 +50,7 @@ #define TOK_FUNC_FILTER_WIDTH_DATA TOKEN_BACKEND(6) // Data communications mode that affects SL/SH/FW commands /* Token structure assigned to .cfgparams in rig_caps */ -extern const struct confparams kenwood_cfg_params[]; +extern struct confparams kenwood_cfg_params[]; /* @@ -173,8 +173,8 @@ struct kenwood_priv_data extern rmode_t kenwood_mode_table[KENWOOD_MODE_TABLE_MAX]; -extern const tone_t kenwood38_ctcss_list[]; -extern const tone_t kenwood42_ctcss_list[]; +extern tone_t kenwood38_ctcss_list[]; +extern tone_t kenwood42_ctcss_list[]; int kenwood_transaction(RIG *rig, const char *cmdstr, char *data, size_t datasize); int kenwood_safe_transaction(RIG *rig, const char *cmd, char *buf, diff --git a/rigs/kenwood/pihpsdr.c b/rigs/kenwood/pihpsdr.c index 05830c13..3136e1dc 100644 --- a/rigs/kenwood/pihpsdr.c +++ b/rigs/kenwood/pihpsdr.c @@ -130,8 +130,8 @@ const struct rig_caps pihpsdr_caps = .parm_gran = {}, .vfo_ops = PIHPSDR_VFO_OP, .scan_ops = PIHPSDR_SCAN_OP, - .ctcss_list = static_common_ctcss_list, - .dcs_list = static_common_dcs_list, + .ctcss_list = common_ctcss_list, + .dcs_list = common_dcs_list, .preamp = { 20, RIG_DBLST_END, }, /* FIXME: real preamp? */ .attenuator = { 20, RIG_DBLST_END, }, .max_rit = kHz(20), diff --git a/rigs/kenwood/thf6a.c b/rigs/kenwood/thf6a.c index 9fc73e53..d7eb1513 100644 --- a/rigs/kenwood/thf6a.c +++ b/rigs/kenwood/thf6a.c @@ -71,7 +71,7 @@ .dcs_sql=1, /* CTCSS 01..42 */ -static const tone_t thf6_ctcss_list[] = +static tone_t thf6_ctcss_list[] = { 670, 693, 719, 744, 770, 797, 825, 854, 885, 915, 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, diff --git a/rigs/kenwood/thf7.c b/rigs/kenwood/thf7.c index 68a8d5f5..eda15a8d 100644 --- a/rigs/kenwood/thf7.c +++ b/rigs/kenwood/thf7.c @@ -65,7 +65,7 @@ .dcs_sql=1, /* CTCSS 01..42 */ -static const tone_t thf7_ctcss_list[] = +static tone_t thf7_ctcss_list[] = { 670, 693, 719, 744, 770, 797, 825, 854, 885, 915, 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, diff --git a/rigs/kenwood/ts2000.c b/rigs/kenwood/ts2000.c index 60615366..87c9b0ee 100644 --- a/rigs/kenwood/ts2000.c +++ b/rigs/kenwood/ts2000.c @@ -65,7 +65,7 @@ static int ts2000_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan); /* * 38 CTCSS sub-audible tones + 1750 tone */ -const tone_t ts2000_ctcss_list[] = +tone_t ts2000_ctcss_list[] = { 670, 719, 744, 770, 797, 825, 854, 885, 915, 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, 1318, @@ -79,7 +79,7 @@ const tone_t ts2000_ctcss_list[] = /* * 103 available DCS codes */ -static const tone_t ts2000_dcs_list[] = +tone_t ts2000_dcs_list[] = { 23, 25, 26, 31, 32, 36, 43, 47, 51, 53, 54, 65, 71, 72, 73, 74, 114, 115, 116, 122, 125, 131, diff --git a/rigs/pcr/pcr.c b/rigs/pcr/pcr.c index 8352987f..8add36da 100644 --- a/rigs/pcr/pcr.c +++ b/rigs/pcr/pcr.c @@ -76,7 +76,7 @@ * Don't even touch a single bit! indexes will be used in the protocol! * 51 tones, the 60.0 Hz tone is missing. */ -const tone_t pcr_ctcss_list[] = +tone_t pcr_ctcss_list[] = { 670, 693, 710, 719, 744, 770, 797, 825, 854, 885, 915, 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, @@ -91,7 +91,7 @@ const tone_t pcr_ctcss_list[] = * Don't even touch a single bit! indexes will be used in the protocol! * 104 codes */ -const tone_t pcr_dcs_list[] = +tone_t pcr_dcs_list[] = { 23, 25, 26, 31, 32, 36, 43, 47, 51, 53, 54, 65, 71, 72, 73, 74, 114, 115, 116, 122, 125, 131, diff --git a/rigs/pcr/pcr.h b/rigs/pcr/pcr.h index 25516ca1..89714f1f 100644 --- a/rigs/pcr/pcr.h +++ b/rigs/pcr/pcr.h @@ -81,8 +81,8 @@ struct pcr_priv_caps #define pcr_caps(rig) ((struct pcr_priv_caps *)(rig)->caps->priv) -extern const tone_t pcr_ctcss_list[]; -extern const tone_t pcr_dcs_list[]; +extern tone_t pcr_ctcss_list[]; +extern tone_t pcr_dcs_list[]; int pcr_init(RIG *rig); int pcr_cleanup(RIG *rig); diff --git a/rigs/uniden/bc898.c b/rigs/uniden/bc898.c index bfaa4f6b..dd55beac 100644 --- a/rigs/uniden/bc898.c +++ b/rigs/uniden/bc898.c @@ -53,7 +53,7 @@ { 255, 60 }, \ } } -static const tone_t bc898_ctcss_list[] = +static tone_t bc898_ctcss_list[] = { 670, 693, 719, 744, 770, 797, 825, 854, 885, 915, 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, diff --git a/rigs/uniden/uniden.c b/rigs/uniden/uniden.c index 68ecf9da..bdd81e9a 100644 --- a/rigs/uniden/uniden.c +++ b/rigs/uniden/uniden.c @@ -55,7 +55,7 @@ uniden_id_string_list[] = }; -const tone_t uniden_ctcss_list[] = +tone_t uniden_ctcss_list[] = { 670, 719, 744, 770, 797, 825, 854, 885, 915, 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, @@ -64,7 +64,7 @@ const tone_t uniden_ctcss_list[] = 2418, 2503, 0 }; -const tone_t uniden_dcs_list[] = +tone_t uniden_dcs_list[] = { 23, 25, 26, 31, 32, 36, 43, 47, 51, 53, 54, 65, 71, 72, 73, 74, 114, 115, 116, 122, diff --git a/rigs/uniden/uniden.h b/rigs/uniden/uniden.h index ed3eea64..97d5f329 100644 --- a/rigs/uniden/uniden.h +++ b/rigs/uniden/uniden.h @@ -51,11 +51,11 @@ { 255, 60 }, \ } } -extern const tone_t uniden_ctcss_list[]; -extern const tone_t uniden_dcs_list[]; +extern tone_t uniden_ctcss_list[]; +extern tone_t uniden_dcs_list[]; int uniden_transaction (RIG *rig, const char *cmdstr, int cmd_len, - const char *replystr, char *data, size_t *datasize); +const char *replystr, char *data, size_t *datasize); int uniden_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int uniden_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int uniden_get_freq_2(RIG *rig, vfo_t vfo, freq_t *freq); diff --git a/rigs/yaesu/ft100.c b/rigs/yaesu/ft100.c index da0a018c..52b18a8b 100644 --- a/rigs/yaesu/ft100.c +++ b/rigs/yaesu/ft100.c @@ -120,7 +120,7 @@ static const yaesu_cmd_set_t ncmd[] = }; -static const tone_t ft100_ctcss_list[] = +static tone_t ft100_ctcss_list[] = { 670, 693, 719, 744, 770, 797, 825, 854, 885, 915, \ 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, \ @@ -129,7 +129,7 @@ static const tone_t ft100_ctcss_list[] = 2503, 0 }; -static const tone_t ft100_dcs_list[] = +static tone_t ft100_dcs_list[] = { 23, 25, 26, 31, 32, 36, 43, 47, 51, 53, \ 54, 65, 71, 72, 73, 74, 114, 115, 116, 122, 125, 131, \ diff --git a/rigs/yaesu/ft1000mp.c b/rigs/yaesu/ft1000mp.c index 0d59d7eb..814f6b59 100644 --- a/rigs/yaesu/ft1000mp.c +++ b/rigs/yaesu/ft1000mp.c @@ -157,7 +157,7 @@ static const yaesu_cmd_set_t ncmd[] = /** * 33 CTCSS sub-audible tones */ -static const tone_t ft1000mp_ctcss_list[] = +static tone_t ft1000mp_ctcss_list[] = { 670, 719, 770, 825, 885, 948, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, diff --git a/rigs/yaesu/ft736.c b/rigs/yaesu/ft736.c index a406431b..ec4a023e 100644 --- a/rigs/yaesu/ft736.c +++ b/rigs/yaesu/ft736.c @@ -80,7 +80,7 @@ static int ft736_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone); /* Some tones are present twice, the second value is * higher Q (80), according to manual. */ -static const tone_t ft736_ctcss_list[] = +static tone_t ft736_ctcss_list[] = { 670, 719, 770, 825, 885, 948, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, 1318, 1365, 1413, 1462, 1514, 1567, diff --git a/rigs/yaesu/ft767gx.c b/rigs/yaesu/ft767gx.c index 9ddad66b..290f4a6d 100644 --- a/rigs/yaesu/ft767gx.c +++ b/rigs/yaesu/ft767gx.c @@ -249,7 +249,7 @@ struct ft767_priv_data unsigned char ack_cmd[5]; }; -const tone_t static_767gx_ctcss_list[] = +tone_t static_767gx_ctcss_list[] = { CTCSS_TONE_LIST }; diff --git a/rigs/yaesu/ft847.c b/rigs/yaesu/ft847.c index 9ac8e081..da42a36d 100644 --- a/rigs/yaesu/ft847.c +++ b/rigs/yaesu/ft847.c @@ -193,7 +193,7 @@ static const yaesu_cmd_set_t ncmd[] = * 39 CTCSS sub-audible tones * c.f. ft847_set_ctcss_tone() */ -static const tone_t ft847_ctcss_list[] = +static tone_t ft847_ctcss_list[] = { 670, 693, 719, 744, 770, 797, 825, 854, 885, 915, 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, diff --git a/src/tones.c b/src/tones.c index bb3ec009..d5c2ff8b 100644 --- a/src/tones.c +++ b/src/tones.c @@ -44,7 +44,7 @@ /** * 52 CTCSS sub-audible tones */ -const tone_t full_ctcss_list[] = { FULL_CTCSS_LIST }; +tone_t full_ctcss_list[] = { FULL_CTCSS_LIST }; /** * 50 CTCSS sub-audible tones, from 67.0Hz to 254.1Hz @@ -53,17 +53,17 @@ const tone_t full_ctcss_list[] = { FULL_CTCSS_LIST }; * backends depend on it. If you need to, create a copy for your * own caps. --SF */ -const tone_t common_ctcss_list[] = { COMMON_CTCSS_LIST }; +tone_t common_ctcss_list[] = { COMMON_CTCSS_LIST }; /** * 104 DCS codes */ -const tone_t common_dcs_list[] = { COMMON_DCS_LIST }; +tone_t common_dcs_list[] = { COMMON_DCS_LIST }; /** * 106 DCS codes */ -const tone_t full_dcs_list[] = { FULL_DCS_LIST }; +tone_t full_dcs_list[] = { FULL_DCS_LIST }; #endif diff --git a/src/tones.h b/src/tones.h index 85255433..204b66f7 100644 --- a/src/tones.h +++ b/src/tones.h @@ -37,10 +37,12 @@ 2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418, 2503, 2541, \ 0, +#if 0 static const tone_t static_full_ctcss_list[] = { FULL_CTCSS_LIST }; +#endif #define FULL_CTCSS_LIST_COUNT 52 @@ -60,10 +62,12 @@ static const tone_t static_full_ctcss_list[] = 2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418, 2503, 2541, \ 0, +#if 0 static const tone_t static_common_ctcss_list[] = { COMMON_CTCSS_LIST }; +#endif #define COMMON_CTCSS_LIST_COUNT 50 @@ -83,10 +87,12 @@ static const tone_t static_common_ctcss_list[] = 662, 664, 703, 712, 723, 731, 732, 734, 743, 754, \ 0, +#if 0 static const tone_t static_common_dcs_list[] = { COMMON_DCS_LIST }; +#endif #define COMMON_DCS_LIST_COUNT 104 @@ -105,10 +111,12 @@ static const tone_t static_common_dcs_list[] = 662, 664, 703, 712, 723, 731, 732, 734, 743, 754, \ 0, +#if 0 static const tone_t static_full_dcs_list[] = { FULL_DCS_LIST }; +#endif #define FULL_DCS_LIST_COUNT 106 @@ -124,10 +132,10 @@ static const tone_t static_full_dcs_list[] = #else -extern const HAMLIB_EXPORT_VAR(tone_t) full_ctcss_list[]; -extern const HAMLIB_EXPORT_VAR(tone_t) common_ctcss_list[]; -extern const HAMLIB_EXPORT_VAR(tone_t) full_dcs_list[]; -extern const HAMLIB_EXPORT_VAR(tone_t) common_dcs_list[]; +extern HAMLIB_EXPORT_VAR(tone_t) full_ctcss_list[]; +extern HAMLIB_EXPORT_VAR(tone_t) common_ctcss_list[]; +extern HAMLIB_EXPORT_VAR(tone_t) full_dcs_list[]; +extern HAMLIB_EXPORT_VAR(tone_t) common_dcs_list[]; #endif diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 2e6813b4..01892211 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -4350,6 +4350,23 @@ declare_proto_rig(dump_state) fprintf(fout, "has_power2mW=%d\n", rig->caps->power2mW != NULL); fprintf(fout, "has_mW2power=%d\n", rig->caps->mW2power != NULL); fprintf(fout, "timeout=%d\n", rig->caps->timeout); + fprintf(fout, "ctcss_list="); + for (i = 0; i < CTCSS_LIST_SIZE && rig->caps->ctcss_list[i] != 0; i++) + { + fprintf(fout, + " %u.%1u", + rig->caps->ctcss_list[i] / 10, rig->caps->ctcss_list[i] % 10); + } + fprintf(fout, "\n"); + fprintf(fout, "dcs_list="); + for (i = 0; i < DCS_LIST_SIZE && rig->caps->dcs_list[i] != 0; i++) + { + fprintf(fout, + " %u", + rig->caps->dcs_list[i]); + } + fprintf(fout, "\n"); + fprintf(fout, "done\n"); } commit 4e60ebf1d6928bd8c7d3b485c6f4d045a75e7af7 Author: Mike Black W9MDB <mdb...@ya...> Date: Thu Apr 29 09:00:59 2021 -0500 Fix rig_get_vfo_info in rig.swg https://github.com/Hamlib/Hamlib/commit/6c13951da8928e8201cc59f9db3ff1dbfe71db9b#commitcomment-50159464 diff --git a/bindings/rig.swg b/bindings/rig.swg index 0d1c05fd..e34168e6 100644 --- a/bindings/rig.swg +++ b/bindings/rig.swg @@ -449,7 +449,7 @@ typedef channel_t * const_channel_t_p; METHOD1VGET(get_xit, shortfreq_t) METHOD1VGET(get_ts, shortfreq_t) extern void get_ant(ant_t *ant_rx, ant_t *ant_tx, ant_t *ant_curr, value_t * OUTPUT, ant_t ant, vfo_t vfo = RIG_VFO_CURR); - extern void get_vfo_info (split_t *split, pbwidth_t *width, rmode_t *mode, freq_t *freq, vfo_t vfo = RIG_VFO_CURR); + extern void get_vfo_info (int *satmode, split_t *split, pbwidth_t *width, rmode_t *mode, freq_t *freq, vfo_t vfo = RIG_VFO_CURR); METHOD1VGET(get_mem, int) METHOD1GET(get_powerstat, powerstat_t) METHOD1GET(get_trn, int) @@ -605,9 +605,9 @@ void Rig_get_ant(Rig *self, ant_t *ant_rx, ant_t *ant_tx, ant_t *ant_curr, value { self->error_status = rig_get_ant(self->rig, vfo, ant, option, ant_curr, ant_tx, ant_rx); } -void Rig_get_vfo_info (Rig *self, split_t *split, pbwidth_t *width, rmode_t *mode, freq_t *freq, vfo_t vfo) +void Rig_get_vfo_info (Rig *self, int *satmode, split_t *split, pbwidth_t *width, rmode_t *mode, freq_t *freq, vfo_t vfo) { - self->error_status = rig_get_vfo_info(self->rig, vfo, freq, mode, width, split); + self->error_status = rig_get_vfo_info(self->rig, vfo, freq, mode, width, split, satmode); } ----------------------------------------------------------------------- Summary of changes: bindings/rig.swg | 6 ++--- include/hamlib/rig.h | 6 +++-- rigs/dummy/netrigctl.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++--- rigs/kenwood/kenwood.c | 6 ++--- rigs/kenwood/kenwood.h | 6 ++--- rigs/kenwood/pihpsdr.c | 4 +-- rigs/kenwood/thf6a.c | 2 +- rigs/kenwood/thf7.c | 2 +- rigs/kenwood/tmd710.c | 11 +++++--- rigs/kenwood/ts2000.c | 4 +-- rigs/pcr/pcr.c | 4 +-- rigs/pcr/pcr.h | 4 +-- rigs/uniden/bc898.c | 2 +- rigs/uniden/uniden.c | 4 +-- rigs/uniden/uniden.h | 6 ++--- rigs/yaesu/ft100.c | 4 +-- rigs/yaesu/ft1000mp.c | 2 +- rigs/yaesu/ft736.c | 2 +- rigs/yaesu/ft767gx.c | 2 +- rigs/yaesu/ft847.c | 2 +- src/tones.c | 8 +++--- src/tones.h | 16 ++++++------ tests/rigctl_parse.c | 20 +++++++++++++++ 23 files changed, 140 insertions(+), 53 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-04-28 22:50:08
|
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 5473249e9ad75a302839804a0811039245f13c04 (commit) via 0b203c7e8f80f3190940d58a8df1f7a677db107b (commit) from 906b6e62d8f0eb07e3df5a029bc0f589c7eb1b1f (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 5473249e9ad75a302839804a0811039245f13c04 Author: Mike Black W9MDB <mdb...@ya...> Date: Wed Apr 28 17:39:08 2021 -0500 Add power2mW and mW2power to netrigctl.c diff --git a/rigs/dummy/netrigctl.c b/rigs/dummy/netrigctl.c index 6afc37b2..20c7cd50 100644 --- a/rigs/dummy/netrigctl.c +++ b/rigs/dummy/netrigctl.c @@ -512,6 +512,7 @@ static int netrigctl_open(RIG *rig) rig->caps->has_get_level = rs->has_get_level = strtoll(buf, NULL, 0); +#if 0 // don't think we need this anymore if (rs->has_get_level & RIG_LEVEL_RAWSTR) { /* include STRENGTH because the remote rig may be able to @@ -520,6 +521,7 @@ static int netrigctl_open(RIG *rig) rs->has_get_level |= RIG_LEVEL_STRENGTH; rig->caps->has_get_level |= RIG_LEVEL_STRENGTH; } +#endif ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1); @@ -645,6 +647,44 @@ static int netrigctl_open(RIG *rig) if (!has) { rig->caps->get_freq = NULL; } } + else if (strcmp(setting, "has_set_conf") == 0) + { + int has = strtol(value, NULL, 0); + + if (!has) { rig->caps->set_conf = NULL; } + } + else if (strcmp(setting, "has_get_conf") == 0) + { + int has = strtol(value, NULL, 0); + + if (!has) { rig->caps->get_conf = NULL; } + } +#if 0 // for the future + else if (strcmp(setting, "has_set_trn") == 0) + { + int has = strtol(value, NULL, 0); + + if (!has) { rig->caps->set_trn = NULL; } + } + else if (strcmp(setting, "has_get_trn") == 0) + { + int has = strtol(value, NULL, 0); + + if (!has) { rig->caps->get_trn = NULL; } + } +#endif + else if (strcmp(setting, "has_power2mW") == 0) + { + int has = strtol(value, NULL, 0); + + if (!has) { rig->caps->power2mW = NULL; } + } + else if (strcmp(setting, "has_mw2power") == 0) + { + int has = strtol(value, NULL, 0); + + if (!has) { rig->caps->mW2power = NULL; } + } else if (strcmp(setting, "timeout") == 0) { // use the rig's timeout value pluse 200ms for potential network delays @@ -2319,6 +2359,99 @@ static int netrigctl_set_vfo_opt(RIG *rig, int status) return RIG_OK; } +#if 0 // for the futurem -- would have to poll to get the pushed data +static int netrigctl_set_trn(RIG *rig, int trn) +{ + char cmdbuf[32]; + char buf[BUF_MAX]; + int ret; + + sprintf(cmdbuf, "\\set_trn %s\n", trn ? "ON" : "OFF"); + ret = netrigctl_transaction(rig, cmdbuf, strlen(cmdbuf), buf); + + if (ret < 0) + { + return -RIG_EPROTO; + } + + return RIG_OK; +} + + +static int netrigctl_get_trn(RIG *rig, int *trn) +{ + char cmdbuf[32]; + char buf[BUF_MAX]; + int ret; + + ENTERFUNC; + sprintf(cmdbuf, "\\get_trn\n"); + ret = netrigctl_transaction(rig, cmdbuf, strlen(cmdbuf), buf); + + if (ret <= 0) + { + return -RIG_EPROTO; + } + + if (strstr(buf,"OFF")) *trn = RIG_TRN_OFF; + else if (strstr(buf,"RIG")) *trn = RIG_TRN_RIG; + else if (strstr(buf,"POLL")) *trn = RIG_TRN_POLL; + else { + rig_debug(RIG_DEBUG_ERR, "%s: Expected OFF, RIG, or POLL, got '%s'\n", __func__, buf); + ret = -RIG_EINVAL; + } + + RETURNFUNC(ret); +} +#endif + +static int netrigctl_mW2power(RIG *rig, float *power, unsigned int mwpower, + freq_t freq, rmode_t mode) +{ + char cmdbuf[32]; + char buf[BUF_MAX]; + int ret; + + ENTERFUNC; + + sprintf(cmdbuf, "\\mW2power %u %.0f %s\n", mwpower, freq, rig_strrmode(mode)); + ret = netrigctl_transaction(rig, cmdbuf, strlen(cmdbuf), buf); + + if (ret <= 0) + { + return -RIG_EPROTO; + } + + *power = atof(buf); + + RETURNFUNC(RIG_OK); +} + + +static int netrigctl_power2mW(RIG *rig, unsigned int *mwpower, float power, + freq_t freq, rmode_t mode) +{ + char cmdbuf[32]; + char buf[BUF_MAX]; + int ret; + + ENTERFUNC; + + sprintf(cmdbuf, "\\power2mW %f %.0f %s\n", power, freq, rig_strrmode(mode)); + ret = netrigctl_transaction(rig, cmdbuf, strlen(cmdbuf), buf); + + if (ret <= 0) + { + return -RIG_EPROTO; + } + + *mwpower = atof(buf); + + RETURNFUNC(RIG_OK); +} + + + /* * Netrigctl rig capabilities. */ @@ -2328,7 +2461,7 @@ struct rig_caps netrigctl_caps = RIG_MODEL(RIG_MODEL_NETRIGCTL), .model_name = "NET rigctl", .mfg_name = "Hamlib", - .version = "20210409.0", + .version = "20210428.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_OTHER, @@ -2427,4 +2560,9 @@ struct rig_caps netrigctl_caps = .set_channel = netrigctl_set_channel, .get_channel = netrigctl_get_channel, .set_vfo_opt = netrigctl_set_vfo_opt, + //.set_trn = netrigctl_set_trn, + //.get_trn = netrigctl_get_trn, + .power2mW = netrigctl_power2mW, + .mW2power = netrigctl_mW2power, + }; diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index e1b9a65a..2e6813b4 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -4342,6 +4342,13 @@ declare_proto_rig(dump_state) fprintf(fout, "has_get_vfo=%d\n", rig->caps->get_vfo != NULL); fprintf(fout, "has_set_freq=%d\n", rig->caps->set_freq != NULL); fprintf(fout, "has_get_freq=%d\n", rig->caps->get_freq != NULL); + fprintf(fout, "has_set_conf=%d\n", rig->caps->set_conf != NULL); + fprintf(fout, "has_get_conf=%d\n", rig->caps->get_conf != NULL); + // for the future +// fprintf(fout, "has_set_trn=%d\n", rig->caps->set_trn != NULL); +// fprintf(fout, "has_get_trn=%d\n", rig->caps->get_trn != NULL); + fprintf(fout, "has_power2mW=%d\n", rig->caps->power2mW != NULL); + fprintf(fout, "has_mW2power=%d\n", rig->caps->mW2power != NULL); fprintf(fout, "timeout=%d\n", rig->caps->timeout); fprintf(fout, "done\n"); } commit 0b203c7e8f80f3190940d58a8df1f7a677db107b Author: Mike Black W9MDB <mdb...@ya...> Date: Wed Apr 28 17:38:54 2021 -0500 Add transceive ability to dummy rig diff --git a/rigs/dummy/dummy.c b/rigs/dummy/dummy.c index 4cb66af5..b5da2d1e 100644 --- a/rigs/dummy/dummy.c +++ b/rigs/dummy/dummy.c @@ -67,6 +67,7 @@ struct dummy_priv_data int bank; value_t parms[RIG_SETTING_MAX]; int ant_option[4]; /* simulate 4 antennas */ + int trn; /* transceive */ channel_t *curr; /* points to vfo_a, vfo_b or mem[] */ @@ -1988,7 +1989,9 @@ static int dummy_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, static int dummy_set_trn(RIG *rig, int trn) { - ENTERFUNC; + struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; + + priv->trn = trn; RETURNFUNC(RIG_OK); } @@ -1996,8 +1999,9 @@ static int dummy_set_trn(RIG *rig, int trn) static int dummy_get_trn(RIG *rig, int *trn) { - ENTERFUNC; - *trn = RIG_TRN_OFF; + struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; + + *trn = priv->trn; RETURNFUNC(RIG_OK); } @@ -2123,7 +2127,7 @@ struct rig_caps dummy_caps = RIG_MODEL(RIG_MODEL_DUMMY), .model_name = "Dummy", .mfg_name = "Hamlib", - .version = "20210313.0", + .version = "20210428.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_OTHER, @@ -2288,7 +2292,7 @@ struct rig_caps dummy_no_vfo_caps = RIG_MODEL(RIG_MODEL_DUMMY_NOVFO), .model_name = "Dummy No VFO", .mfg_name = "Hamlib", - .version = "20210218.0", + .version = "20210428.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_OTHER, @@ -2313,7 +2317,7 @@ struct rig_caps dummy_no_vfo_caps = }, .scan_ops = DUMMY_SCAN, .vfo_ops = DUMMY_VFO_OP, - .transceive = RIG_TRN_OFF, + .transceive = RIG_TRN_RIG, .attenuator = { 10, 20, 30, RIG_DBLST_END, }, .preamp = { 10, RIG_DBLST_END, }, .rx_range_list1 = { { ----------------------------------------------------------------------- Summary of changes: rigs/dummy/dummy.c | 16 +++--- rigs/dummy/netrigctl.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++++- tests/rigctl_parse.c | 7 +++ 3 files changed, 156 insertions(+), 7 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-04-28 12:14:17
|
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 906b6e62d8f0eb07e3df5a029bc0f589c7eb1b1f (commit) via 4c09c2362e6d3bb8b367a5fcde920dd19d4ac198 (commit) from 2066bb38fd8b77a46526826b1be2d0f9f34ddf8e (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 906b6e62d8f0eb07e3df5a029bc0f589c7eb1b1f Author: Mike Black W9MDB <mdb...@ya...> Date: Wed Apr 28 07:03:10 2021 -0500 Update man pages diff --git a/doc/man1/rigctl.1 b/doc/man1/rigctl.1 index b8751ffd..0f74d71c 100644 --- a/doc/man1/rigctl.1 +++ b/doc/man1/rigctl.1 @@ -1037,7 +1037,15 @@ Get DTMF . .TP .BR _ ", " get_info -Get misc information about the rig (no VFO in 'VFO mode' or value is passed). +Get misc information about the rig. +. +.TP +.BR 0xf5 ", " get_rig_info +Get misc information about the rig vfo status and other info. +. +.TP +.BR 0xf3 ", " get_vfo_info " \(aq" \fIVFO\fP \(aq +Get misc information about a specific vfo. . .TP .B dump_state diff --git a/doc/man1/rigctld.1 b/doc/man1/rigctld.1 index 8024b6c1..316b2eb2 100644 --- a/doc/man1/rigctld.1 +++ b/doc/man1/rigctld.1 @@ -1017,7 +1017,15 @@ Get DTMF . .TP .BR _ ", " get_info -Get misc information about the rig (no VFO in 'VFO mode' or value is passed). +Get misc information about the rig. +. +.TP +.BR 0xf5 ", " get_rig_info " +Get misc information about the rig vfos and other info. +. +.TP +.BR 0xf3 ", " get_vfo_info " \(aq" "\fIVFO\fP" \(aq +Get misc information about a specific vfo. . .TP .B dump_state commit 4c09c2362e6d3bb8b367a5fcde920dd19d4ac198 Author: Mike Black W9MDB <mdb...@ya...> Date: Wed Apr 28 06:44:10 2021 -0500 Fix rig_get_info to return "None" for VFO if needed instead of empty string Should make parsing easier ensuring all are token pairs https://github.com/Hamlib/Hamlib/issues/682 diff --git a/src/rig.c b/src/rig.c index d8412965..aece5b8b 100644 --- a/src/rig.c +++ b/src/rig.c @@ -6212,6 +6212,7 @@ int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len) vfo_t vfoA,vfoB; freq_t freqA,freqB; rmode_t modeA,modeB; + char *modeAstr, *modeBstr; pbwidth_t widthA,widthB; split_t split; int satmode; @@ -6236,11 +6237,15 @@ int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len) rig_get_cache(rig, vfoB, &freqB, &cache_ms_freq, &modeB, &cache_ms_mode, &widthB, &cache_ms_width); } + modeAstr = (char*)rig_strrmode(modeA); + modeBstr = (char*)rig_strrmode(modeB); + if (modeAstr[0]==0) modeAstr="None"; + if (modeBstr[0]==0) modeBstr="None"; rxa = 1; txa = split == 0; rxb = !rxa; txb = split == 1; - snprintf(response,max_response_len,"VFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nVFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nSplit=%d SatMode=%d", rig_strvfo(vfoA), freqA, rig_strrmode(modeA), (int)widthA, rxa, txa, rig_strvfo(vfoB), freqB, rig_strrmode(modeB), (int)widthB, rxb, txb, split, satmode); + snprintf(response,max_response_len,"VFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nVFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nSplit=%d SatMode=%d", rig_strvfo(vfoA), freqA, modeAstr, (int)widthA, rxa, txa, rig_strvfo(vfoB), freqB, modeBstr, (int)widthB, rxb, txb, split, satmode); RETURNFUNC(RIG_OK); } ----------------------------------------------------------------------- Summary of changes: doc/man1/rigctl.1 | 10 +++++++++- doc/man1/rigctld.1 | 10 +++++++++- src/rig.c | 7 ++++++- 3 files changed, 24 insertions(+), 3 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-04-27 22:34:40
|
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 2066bb38fd8b77a46526826b1be2d0f9f34ddf8e (commit) from bfa75996874d7d34b3921cdc76cc6a3c4e9af8fd (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 2066bb38fd8b77a46526826b1be2d0f9f34ddf8e Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Apr 27 17:32:10 2021 -0500 Change rig_get_rig_info to use cached values for VFOB when not targetable https://github.com/Hamlib/Hamlib/issues/682 diff --git a/src/rig.c b/src/rig.c index 22746071..d8412965 100644 --- a/src/rig.c +++ b/src/rig.c @@ -6223,8 +6223,19 @@ int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len) vfoB = vfo_fixup(rig, RIG_VFO_B); ret = rig_get_vfo_info(rig, vfoA, &freqA, &modeA, &widthA, &split, &satmode); if (ret != RIG_OK) RETURNFUNC(ret); - ret = rig_get_vfo_info(rig, vfoB, &freqB, &modeB, &widthB, &split, &satmode); - if (ret != RIG_OK) RETURNFUNC(ret); + // we need both vfo and mode targtable to avoid vfo swapping + if ((rig->caps->targetable_vfo & RIG_TARGETABLE_FREQ) && (rig->caps->targetable_vfo & RIG_TARGETABLE_MODE)) + { + ret = rig_get_vfo_info(rig, vfoB, &freqB, &modeB, &widthB, &split, &satmode); + if (ret != RIG_OK) RETURNFUNC(ret); + } + else + { + // we'll use cached info instead of doing the vfo swapping + int cache_ms_freq, cache_ms_mode, cache_ms_width; + rig_get_cache(rig, vfoB, &freqB, &cache_ms_freq, &modeB, &cache_ms_mode, &widthB, + &cache_ms_width); + } rxa = 1; txa = split == 0; rxb = !rxa; ----------------------------------------------------------------------- Summary of changes: src/rig.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-04-27 22:21:29
|
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 bfa75996874d7d34b3921cdc76cc6a3c4e9af8fd (commit) from 7b5765d549b9a4b68f327b9b62e69d91d2d2efc9 (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 bfa75996874d7d34b3921cdc76cc6a3c4e9af8fd Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Apr 27 17:18:51 2021 -0500 In kenwood.c skip verification for RU/RD commands. On the TS-2000 at least it caused Resource temporarily unavailable when sending ID right after RU/RD https://github.com/Hamlib/Hamlib/issues/677 diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index 1feabae5..c39cbf5c 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -331,7 +331,16 @@ transaction_write: // So we'll skip the checks just on this one command for now // The TS-480 PC Control says RX; should return RX0; but it doesn't // We may eventually want to verify PTT with rig_get_ptt instead - if (retval == RIG_OK && strncmp(cmdstr, "RX", 2) == 0) { goto transaction_quit; } + // The TS-2000 doesn't like doing and ID right after RU or RD + if (retval == RIG_OK) + { + int skip = strncmp(cmdstr, "RX", 2) == 0; + skip |= strncmp(cmdstr, "RU", 2) == 0; + skip |= strncmp(cmdstr, "RD", 2) == 0; + if (skip) { + goto transaction_quit; + } + } // Malachite SDR cannot send ID after FA if (!datasize && priv->no_id) { RETURNFUNC(RIG_OK); } @@ -340,6 +349,9 @@ transaction_write: { rig->state.hold_decode = 0; + // there are some commands that have problems with immediate follow-up + // so we'll just ignore them + /* 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 */ ----------------------------------------------------------------------- Summary of changes: rigs/kenwood/kenwood.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |
From: Michael B. <mdb...@us...> - 2021-04-27 21:12:53
|
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 7b5765d549b9a4b68f327b9b62e69d91d2d2efc9 (commit) via 9970323712b59ecf0f14ba74731fa4bac7887909 (commit) via 5034bf4451c604303e83404168196d5f9cd23a38 (commit) via af499a979ee2602f08527c3ab2c5ca9207a8b02e (commit) via 6b13c6c3a3ce65ce67c5a210d621521340128719 (commit) via 6c13951da8928e8201cc59f9db3ff1dbfe71db9b (commit) from 9a82ebf65229131e6425231f521a31d6a7efa312 (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 7b5765d549b9a4b68f327b9b62e69d91d2d2efc9 Author: Bill Somerville <bi...@cl...> Date: Tue Apr 27 20:40:32 2021 +0100 Add missing export definition diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index ada3cdbc..ffb08df7 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -3023,7 +3023,7 @@ extern HAMLIB_EXPORT(int) rig_set_cache_timeout_ms(RIG *rig, hamlib_cache_t sele extern HAMLIB_EXPORT(int) rig_set_vfo_opt(RIG *rig, int status); extern HAMLIB_EXPORT(int) rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, pbwidth_t *width, split_t *split, int *satmode); -extern int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len); +extern HAMLIB_EXPORT(int) rig_get_rig_info(RIG *rig, char *response, int max_response_len); extern HAMLIB_EXPORT(int) rig_get_cache(RIG *rig, vfo_t vfo, freq_t *freq, int * cache_ms_freq, rmode_t *mode, int *cache_ms_mode, pbwidth_t *width, int *cache_ms_width); commit 9970323712b59ecf0f14ba74731fa4bac7887909 Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Apr 27 13:16:37 2021 -0500 Update NEWS diff --git a/NEWS b/NEWS index 82c2c02e..5353a4c1 100644 --- a/NEWS +++ b/NEWS @@ -14,8 +14,8 @@ Version 4.2 Example output with rig in split mode This is a string return to allow for easy future expansion without changing the API New tokens may be introduced and can be skipped if not used by clients - VFOA Freq=10133000 Mode=LSB Width=0 RX=1 TX=0 - VFOB Freq=10134000 Mode=LSB Width=0 RX=0 TX=1 + VFO=VFOA Freq=10133000 Mode=LSB Width=0 RX=1 TX=0 + VFO=VFOB Freq=10134000 Mode=LSB Width=0 RX=0 TX=1 Split=1 SatMode=0 * USRP lib and gnuradio are deprecated and will be removed in 5.0 commit 5034bf4451c604303e83404168196d5f9cd23a38 Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Apr 27 13:14:54 2021 -0500 Make 1st token in get_rig_info a paired token too so all are A=B token pairs https://github.com/Hamlib/Hamlib/issues/682 diff --git a/src/rig.c b/src/rig.c index 0fecb56a..22746071 100644 --- a/src/rig.c +++ b/src/rig.c @@ -6229,7 +6229,7 @@ int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len) txa = split == 0; rxb = !rxa; txb = split == 1; - snprintf(response,max_response_len,"%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\n%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nSplit=%d SatMode=%d", rig_strvfo(vfoA), freqA, rig_strrmode(modeA), (int)widthA, rxa, txa, rig_strvfo(vfoB), freqB, rig_strrmode(modeB), (int)widthB, rxb, txb, split, satmode); + snprintf(response,max_response_len,"VFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nVFO=%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nSplit=%d SatMode=%d", rig_strvfo(vfoA), freqA, rig_strrmode(modeA), (int)widthA, rxa, txa, rig_strvfo(vfoB), freqB, rig_strrmode(modeB), (int)widthB, rxb, txb, split, satmode); RETURNFUNC(RIG_OK); } commit af499a979ee2602f08527c3ab2c5ca9207a8b02e Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Apr 27 12:13:15 2021 -0500 Fix freqB on rig_get_rig_info https://github.com/Hamlib/Hamlib/milestone/7 diff --git a/NEWS b/NEWS index e9982745..82c2c02e 100644 --- a/NEWS +++ b/NEWS @@ -7,7 +7,17 @@ Copyright (C) 2000-2021 Michael Black W9MDB, and others Please send Hamlib bug reports to ham...@li... Version 4.2 - * 2021-04-06 + * 2021-04-27 + * New rig_get_vfo_info + * New rig_get_rig_info + Also get_rig_info in rigctld too + Example output with rig in split mode + This is a string return to allow for easy future expansion without changing the API + New tokens may be introduced and can be skipped if not used by clients + VFOA Freq=10133000 Mode=LSB Width=0 RX=1 TX=0 + VFOB Freq=10134000 Mode=LSB Width=0 RX=0 TX=1 + Split=1 SatMode=0 + * USRP lib and gnuradio are deprecated and will be removed in 5.0 * Added Radan rotator * Added Malachite SDR diff --git a/src/rig.c b/src/rig.c index db1722e1..0fecb56a 100644 --- a/src/rig.c +++ b/src/rig.c @@ -6229,7 +6229,7 @@ int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len) txa = split == 0; rxb = !rxa; txb = split == 1; - snprintf(response,max_response_len,"%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\n%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nSplit=%d SatMode=%d", rig_strvfo(vfoA), freqA, rig_strrmode(modeA), (int)widthA, rxa, txa, rig_strvfo(vfoB), freqA, rig_strrmode(modeB), (int)widthB, rxb, txb, split, satmode); + snprintf(response,max_response_len,"%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\n%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nSplit=%d SatMode=%d", rig_strvfo(vfoA), freqA, rig_strrmode(modeA), (int)widthA, rxa, txa, rig_strvfo(vfoB), freqB, rig_strrmode(modeB), (int)widthB, rxb, txb, split, satmode); RETURNFUNC(RIG_OK); } diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 06eefd8a..e1b9a65a 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -333,7 +333,7 @@ static struct test_table test_list[] = { 0x8f, "dump_state", ACTION(dump_state), ARG_OUT | ARG_NOVFO }, { 0xf0, "chk_vfo", ACTION(chk_vfo), ARG_NOVFO, "ChkVFO" }, /* rigctld only--check for VFO mode */ { 0xf2, "set_vfo_opt", ACTION(set_vfo_opt), ARG_NOVFO | ARG_IN, "Status" }, /* turn vfo option on/off */ - { 0xf3, "get_vfo_info", ACTION(get_vfo_info), ARG_NOVFO | ARG_IN1 | ARG_OUT4, "Freq", "Mode", "Width", "Split", "SatMode" }, /* get several vfo parameters at once */ + { 0xf3, "get_vfo_info", ACTION(get_vfo_info), ARG_IN1 | ARG_OUT4, "Freq", "Mode", "Width", "Split", "SatMode" }, /* get several vfo parameters at once */ { 0xf5, "get_rig_info", ACTION(get_rig_info), ARG_NOVFO | ARG_OUT, "RigInfo" }, /* get several vfo parameters at once */ { 0xf4, "get_vfo_list", ACTION(get_vfo_list), ARG_OUT | ARG_NOVFO, "VFOs" }, { 0xf1, "halt", ACTION(halt), ARG_NOVFO }, /* rigctld only--halt the daemon */ commit 6b13c6c3a3ce65ce67c5a210d621521340128719 Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Apr 27 11:51:43 2021 -0500 New rig_get_rig_info function Also get_rig_info in rigctld too Example output with rig in split mode This is a string return to allow for easy future expansion without changing the API New tokens may be introduced and can be skipped if not used by clients VFOA Freq=10133000 Mode=LSB Width=0 RX=1 TX=0 VFOB Freq=10134000 Mode=LSB Width=0 RX=0 TX=1 Split=1 SatMode=0 https://github.com/Hamlib/Hamlib/issues/682 diff --git a/src/rig.c b/src/rig.c index 7e734a08..db1722e1 100644 --- a/src/rig.c +++ b/src/rig.c @@ -6209,14 +6209,28 @@ const char *HAMLIB_API rig_get_info(RIG *rig) */ int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len) { - vfo_t vfoA; - freq_t freqA; - rmode_t modeA; - pbwidth_t widthA; + vfo_t vfoA,vfoB; + freq_t freqA,freqB; + rmode_t modeA,modeB; + pbwidth_t widthA,widthB; split_t split; int satmode; + int ret; + int rxa, txa, rxb, txb; response[0] = 0; - RETURNFUNC(-RIG_ENIMPL); + + vfoA = vfo_fixup(rig, RIG_VFO_A); + vfoB = vfo_fixup(rig, RIG_VFO_B); + ret = rig_get_vfo_info(rig, vfoA, &freqA, &modeA, &widthA, &split, &satmode); + if (ret != RIG_OK) RETURNFUNC(ret); + ret = rig_get_vfo_info(rig, vfoB, &freqB, &modeB, &widthB, &split, &satmode); + if (ret != RIG_OK) RETURNFUNC(ret); + rxa = 1; + txa = split == 0; + rxb = !rxa; + txb = split == 1; + snprintf(response,max_response_len,"%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\n%s Freq=%.0f Mode=%s Width=%d RX=%d TX=%d\nSplit=%d SatMode=%d", rig_strvfo(vfoA), freqA, rig_strrmode(modeA), (int)widthA, rxa, txa, rig_strvfo(vfoB), freqA, rig_strrmode(modeB), (int)widthB, rxb, txb, split, satmode); + RETURNFUNC(RIG_OK); } /** diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 888cf05e..06eefd8a 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -166,6 +166,7 @@ declare_proto_rig(set_mode); declare_proto_rig(get_mode); declare_proto_rig(set_vfo); declare_proto_rig(get_vfo); +declare_proto_rig(get_rig_info); declare_proto_rig(get_vfo_info); declare_proto_rig(get_vfo_list); declare_proto_rig(set_ptt); @@ -333,6 +334,7 @@ static struct test_table test_list[] = { 0xf0, "chk_vfo", ACTION(chk_vfo), ARG_NOVFO, "ChkVFO" }, /* rigctld only--check for VFO mode */ { 0xf2, "set_vfo_opt", ACTION(set_vfo_opt), ARG_NOVFO | ARG_IN, "Status" }, /* turn vfo option on/off */ { 0xf3, "get_vfo_info", ACTION(get_vfo_info), ARG_NOVFO | ARG_IN1 | ARG_OUT4, "Freq", "Mode", "Width", "Split", "SatMode" }, /* get several vfo parameters at once */ + { 0xf5, "get_rig_info", ACTION(get_rig_info), ARG_NOVFO | ARG_OUT, "RigInfo" }, /* get several vfo parameters at once */ { 0xf4, "get_vfo_list", ACTION(get_vfo_list), ARG_OUT | ARG_NOVFO, "VFOs" }, { 0xf1, "halt", ACTION(halt), ARG_NOVFO }, /* rigctld only--halt the daemon */ { 0x8c, "pause", ACTION(pause), ARG_IN, "Seconds" }, @@ -2213,6 +2215,17 @@ declare_proto_rig(get_vfo) RETURNFUNC(status); } +declare_proto_rig(get_rig_info) +{ + char buf[1024]; // big enough to last numerous years hopefully + int ret; + ENTERFUNC; + ret = rig_get_rig_info(rig, buf, sizeof(buf)); + if (ret != RIG_OK) RETURNFUNC(ret); + fprintf(fout,"%s\n", buf); + RETURNFUNC(RIG_OK); +} + /* '\get_vfo_info' */ declare_proto_rig(get_vfo_info) { commit 6c13951da8928e8201cc59f9db3ff1dbfe71db9b Author: Mike Black W9MDB <mdb...@ya...> Date: Tue Apr 27 10:32:12 2021 -0500 Add satmode to rig_get_vfo_info Add prototype for rig_get_rig_info https://github.com/Hamlib/Hamlib/issues/682 diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 17dcf618..ada3cdbc 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -2376,7 +2376,12 @@ rig_get_vfo HAMLIB_PARAMS((RIG *rig, extern HAMLIB_EXPORT(int) rig_get_vfo_info HAMLIB_PARAMS((RIG *rig, - vfo_t vfo, freq_t *freq, rmode_t *mode, pbwidth_t *width, split_t *split)); + vfo_t vfo, + freq_t *freq, + rmode_t *mode, + pbwidth_t *width, + split_t *split, + int *satmode)); extern HAMLIB_EXPORT(int) rig_get_vfo_list HAMLIB_PARAMS((RIG *rig, char *buf, int buflen)); @@ -3017,7 +3022,8 @@ extern HAMLIB_EXPORT(int) rig_get_cache_timeout_ms(RIG *rig, hamlib_cache_t sele extern HAMLIB_EXPORT(int) rig_set_cache_timeout_ms(RIG *rig, hamlib_cache_t selection, int ms); extern HAMLIB_EXPORT(int) rig_set_vfo_opt(RIG *rig, int status); -extern HAMLIB_EXPORT(int) rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, pbwidth_t *width, split_t *split); +extern HAMLIB_EXPORT(int) rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, pbwidth_t *width, split_t *split, int *satmode); +extern int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len); extern HAMLIB_EXPORT(int) rig_get_cache(RIG *rig, vfo_t vfo, freq_t *freq, int * cache_ms_freq, rmode_t *mode, int *cache_ms_mode, pbwidth_t *width, int *cache_ms_width); diff --git a/src/rig.c b/src/rig.c index 0e12870c..7e734a08 100644 --- a/src/rig.c +++ b/src/rig.c @@ -6201,6 +6201,24 @@ const char *HAMLIB_API rig_get_info(RIG *rig) return (rig->caps->get_info(rig)); } +/** + * \brief get freq/mode/width for requested VFO + * \param rig The rig handle + * + * returns a string for all known VFOs plus rig split status and satellite mode status + */ +int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len) +{ + vfo_t vfoA; + freq_t freqA; + rmode_t modeA; + pbwidth_t widthA; + split_t split; + int satmode; + response[0] = 0; + RETURNFUNC(-RIG_ENIMPL); +} + /** * \brief get freq/mode/width for requested VFO * \param rig The rig handle @@ -6219,7 +6237,7 @@ const char *HAMLIB_API rig_get_info(RIG *rig) * */ int HAMLIB_API rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, - rmode_t *mode, pbwidth_t *width, split_t *split) + rmode_t *mode, pbwidth_t *width, split_t *split, int *satmode) { int retval; @@ -6262,6 +6280,7 @@ int HAMLIB_API rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, *width = rig->state.cache.widthMainA; } + *satmode = rig->state.cache.satmode; // we should only need to ask for VFO_CURR to minimize display swapping TRACE; retval = rig_get_split(rig, RIG_VFO_CURR, split); diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 860586d7..888cf05e 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -134,6 +134,7 @@ struct test_table const char *arg2; const char *arg3; const char *arg4; + const char *arg5; }; @@ -331,7 +332,7 @@ static struct test_table test_list[] = { 0x8f, "dump_state", ACTION(dump_state), ARG_OUT | ARG_NOVFO }, { 0xf0, "chk_vfo", ACTION(chk_vfo), ARG_NOVFO, "ChkVFO" }, /* rigctld only--check for VFO mode */ { 0xf2, "set_vfo_opt", ACTION(set_vfo_opt), ARG_NOVFO | ARG_IN, "Status" }, /* turn vfo option on/off */ - { 0xf3, "get_vfo_info", ACTION(get_vfo_info), ARG_NOVFO | ARG_IN1 | ARG_OUT3, "Freq", "Mode", "Width", "Split" }, /* get several vfo parameters at once */ + { 0xf3, "get_vfo_info", ACTION(get_vfo_info), ARG_NOVFO | ARG_IN1 | ARG_OUT4, "Freq", "Mode", "Width", "Split", "SatMode" }, /* get several vfo parameters at once */ { 0xf4, "get_vfo_list", ACTION(get_vfo_list), ARG_OUT | ARG_NOVFO, "VFOs" }, { 0xf1, "halt", ACTION(halt), ARG_NOVFO }, /* rigctld only--halt the daemon */ { 0x8c, "pause", ACTION(pause), ARG_IN, "Seconds" }, @@ -2232,7 +2233,8 @@ declare_proto_rig(get_vfo_info) rmode_t mode = RIG_MODE_NONE; pbwidth_t width = 0; split_t split; - retval = rig_get_vfo_info(rig, vfo, &freq, &mode, &width, &split); + int satmode = 0; + retval = rig_get_vfo_info(rig, vfo, &freq, &mode, &width, &split, &satmode); if (retval != RIG_OK) { @@ -2249,6 +2251,7 @@ declare_proto_rig(get_vfo_info) fprintf(fout, "%s: %s\n", cmd->arg2, modestr); fprintf(fout, "%s: %d\n", cmd->arg3, (int)width); fprintf(fout, "%s: %d\n", cmd->arg4, (int)split); + fprintf(fout, "%s: %d\n", cmd->arg5, (int)satmode); } else { diff --git a/tests/simicom.c b/tests/simicom.c deleted file mode 100644 index 87fcc76d..00000000 --- a/tests/simicom.c +++ /dev/null @@ -1,288 +0,0 @@ -// simicom will show the pts port to use for rigctl on Unix -// using virtual serial ports on Windows is to be developed yet -// gcc -g -Wall -o simicom simicom.c -lhamlib -// On mingw in the hamlib src directory -// gcc -static -I../include -g -Wall -o simicom simicom.c -L../../build/src/.libs -lhamlib -lwsock32 -lws2_32 -#define _XOPEN_SOURCE 600 -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/time.h> -#include <hamlib/rig.h> -#include "../src/misc.h" - -#define BUFSIZE 256 - -int civ_731_mode = 0; -vfo_t current_vfo = RIG_VFO_A; -int split = 0; - -// we make B different from A to ensure we see a difference at startup -float freqA = 14074000; -float freqB = 14074500; -mode_t modeA = RIG_MODE_CW; -mode_t modeB = RIG_MODE_USB; -pbwidth_t widthA = 0; -pbwidth_t widthB = 1; - -void dumphex(unsigned char *buf, int n) -{ - for (int i = 0; i < n; ++i) { printf("%02x ", buf[i]); } - - printf("\n"); -} - -int -frameGet(int fd, unsigned char *buf) -{ - int i = 0; - memset(buf, 0, BUFSIZE); - unsigned char c; - - while (read(fd, &c, 1) > 0) - { - buf[i++] = c; - //printf("i=%d, c=0x%02x\n",i,c); - - if (c == 0xfd) - { - dumphex(buf, i); - return i; - } - } - - printf("Error???\n"); - - return 0; -} - -void frameParse(int fd, unsigned char *frame, int len) -{ - double freq; - - dumphex(frame, len); - - if (frame[0] != 0xfe && frame[1] != 0xfe) - { - printf("expected fe fe, got "); - dumphex(frame, len); - return; - } - - switch (frame[4]) - { - case 0x03: - - //from_bcd(frameackbuf[2], (civ_731_mode ? 4 : 5) * 2); - if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) - { - printf("get_freqA\n"); - to_bcd(&frame[5], (long long)freqA, (civ_731_mode ? 4 : 5) * 2); - } - else - { - printf("get_freqB\n"); - to_bcd(&frame[5], (long long)freqB, (civ_731_mode ? 4 : 5) * 2); - } - - frame[10] = 0xfd; - write(fd, frame, 11); - break; - - case 0x04: - if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) - { - printf("get_modeA\n"); - frame[5] = modeA; - frame[6] = widthA; - } - else - { - printf("get_modeB\n"); - frame[5] = modeB; - frame[6] = widthB; - } - - frame[7] = 0xfd; - write(fd, frame, 8); - break; - - case 0x05: - freq = from_bcd(&frame[5], (civ_731_mode ? 4 : 5) * 2); - printf("set_freq to %.0f\n", freq); - - if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) { freqA = freq; } - else { freqB = freq; } - -// case 0x06: - - - case 0x07: - - switch (frame[5]) - { - case 0x00: current_vfo = RIG_VFO_A; break; - - case 0x01: current_vfo = RIG_VFO_B; break; - - case 0xd0: current_vfo = RIG_VFO_MAIN; break; - - case 0xd1: current_vfo = RIG_VFO_SUB; break; - } - - printf("set_vfo to %s\n", rig_strvfo(current_vfo)); - - frame[4] = 0xfb; - frame[5] = 0xfd; - write(fd, frame, 6); - break; - - case 0x0f: - if (frame[5] == 0) { split = 0; } - else { split = 1; } - - printf("set split %d\n", 1); - frame[4] = 0xfb; - frame[5] = 0xfd; - write(fd, frame, 6); - break; - - case 0x1a: // miscellaneous things - switch (frame[5]) - { - case 0x03: // width - if (current_vfo == RIG_VFO_A || current_vfo == RIG_VFO_MAIN) { frame[6] = widthA; } - else { frame[6] = widthB; } - - frame[7] = 0xfd; - write(fd, frame, 8); - break; - } - - break; - -#if 0 - case 0x25: - if (frame[6] == 0xfd) - { - if (frame[5] == 0x00) - { - to_bcd(&frame[6], (long long)freqA, (civ_731_mode ? 4 : 5) * 2); - printf("get_freqA=%.0f\n", freqA); - } - else - { - to_bcd(&frame[6], (long long)freqB, (civ_731_mode ? 4 : 5) * 2); - printf("get_freqB=%.0f\n", freqB); - } - - frame[11] = 0xfd; - write(fd, frame, 12); - } - else - { - freq = from_bcd(&frame[5], (civ_731_mode ? 4 : 5) * 2); - printf("set_freq to %.0f\n", freq); - - if (frame[5] == 0x00) { freqA = freq; } - else { freqB = freq; } - - frame[4] = 0xfb; - frame[5] = 0xfd; - } - - break; -#endif - - default: printf("cmd 0x%02x unknown\n", frame[4]); - } - - // don't care about the rig type yet - -} - -#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 - -void rigStatus() -{ - char vfoa = current_vfo == RIG_VFO_A ? '*' : ' '; - char vfob = current_vfo == RIG_VFO_B ? '*' : ' '; - printf("%cVFOA: mode=%s width=%ld freq=%.0f\n", vfoa, rig_strrmode(modeA), - widthA, - freqA); - printf("%cVFOB: mode=%s width=%ld freq=%.0f\n", vfob, rig_strrmode(modeB), - widthB, - freqB); -} - -int main(int argc, char **argv) -{ - unsigned char buf[256]; - int fd = openPort(argv[1]); - - printf("%s: %s\n", argv[0], rig_version()); -#if defined(WIN32) || defined(_WIN32) - - if (argc != 2) - { - printf("Missing comport argument\n"); - printf("%s [comport]\n", argv[0]); - exit(1); - } - -#endif - - while (1) - { - int len = frameGet(fd, buf); - - if (len <= 0) - { - close(fd); - fd = openPort(argv[1]); - } - - frameParse(fd, buf, len); - rigStatus(); - } - - return 0; -} ----------------------------------------------------------------------- Summary of changes: NEWS | 12 ++- include/hamlib/rig.h | 10 +- src/rig.c | 35 ++++++- tests/rigctl_parse.c | 20 +++- tests/simicom.c | 288 --------------------------------------------------- 5 files changed, 71 insertions(+), 294 deletions(-) delete mode 100644 tests/simicom.c hooks/post-receive -- Hamlib -- Ham radio control libraries |