Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds initial abstraction for retrieving and adjusting spectrum scope data from rigs. This implementation is based on documentation for Icom (IC-7300, IC-7610, IC-785x, IC-705, IC-9700 and IC-R8600) and Kenwood (TS-890S, TS-990S) rigs, where common features have been implemented as standardized levels/funcs and as an abstraction for the spectrum data structures.
The actual implementation to read and parse spectrum data exists only for Icom rigs and has been tested only on an IC-7300 (via serial port connection). The rest of the Icom implementations are based on documentation only. It is necessary to test this on other rigs that support Ethernet connectivity, as the format for spectrum data is slightly different with a single line of spectrum data delivered in a single CI-V frame instead of being split into multiple frames -- the parser should support this already.
The spectrum data is parsed in
decode_event
functions (likeicom_decode_event
), as the data is pushed by the rig once the feature is enabled. Reading the spectrum data requires Hamlib transceive function to be enabled viaA ON
command.The actual data is delivered to a new
spectrum_event
callback that is currently simply wired to print out the spectrum line in ASCII format, as the multicast server implementation #695 that should output the data is not finished yet.The implementation supports multiple spectrum scopes, as rigs with multiple receivers, like the Kenwood ones and IC-7610, IC-785x and IC-9700, allow choosing and enabling output of spectrum data for one or both of the Main/Sub spectrum scopes.
This PR adds the following funcs and levels:
RIG_FUNC_TRANSCEIVE
- Enable transceive functionality in rig to push state changes automatically to computer. Added the command for multiple Icom rigs. Should be extended to all models supporting this. Enabling transceive mode is NOT needed for spectrum support, but it was easy to add this level, as we will be using the transceive mode soon for the multicast server.RIG_LEVEL_SPECTRUM_MODE
- Spectrum scope mode: CENTER, FIXED, CENTER_SCROLL or FIXED_SCROLLRIG_LEVEL_SPECTRUM_SPAN
- Spectrum span in Hz (in CENTER mode)RIG_FUNC_SPECTRUM_HOLD
- Pause spectrum updatesRIG_LEVEL_SPECTRUM_SPEED
- Spectrum speedRIG_LEVEL_SPECTRUM_REF
- Spectrum reference level in dBRIG_LEVEL_SPECTRUM_AVG
- Spectrum scope averagingRIG_LEVEL_SPECTRUM_EDGE_LOW
- Spectrum scope low edge in Hz (in FIXED or the SCROLL modes)RIG_LEVEL_SPECTRUM_EDGE_HIGH
- Spectrum scope high edge in Hz (in FIXED or the SCROLL modes)RIG_LEVEL_SPECTRUM_ATT
- Spectrum attenuator, supported only by Kenwood rigs and IC-785xAdditionally, the following Icom-specific ext levels have been implemented:
SPECTRUM_DUAL
- Single/Dual spectrum scope choiceSPECTRUM_TX
- Spectrum scope enabled during TXSPECTRUM_CENTER
- Spectrum center position regarding filter widthSPECTRUM_VBW
- Video Band Width for scopeSPECTRUM_EDGE
- Currently selected frequency edge number (in FIXED or SCROLL modes)SPECTRUM_RBW
- Resolution Band Width for scope (only IC-7610)The Icom rigs implement the FIXED/SCROLL mode edges in a slightly complex way by storing 4 edge freq presets for each frequency range. This has been simplified so that the
RIG_LEVEL_SPECTRUM_EDGE*
levels simply pick the current edge number and the frequency range based on the current frequency and modify that frequency range automatically. Kenwood rigs seem to have a simpler way of setting the edge frequencies directly without many presets.NOTE: This implementation is not yet ready for "production use" and needs changes in other parts of Hamlib. The constant spectrum data stream pushed by the rig seems to interfere with responses expected for other commands. It may also be that the flushing of serial port might remove some of the spectrum data accidentally. We will need to refactor the way commands expect responses as the rig may output transceive / spectrum data at any moment.