Initialize previously unset FFTMeasurement members with defined default
values so newly constructed measurement objects start in a known state.
Although these fields are populated during normal measurement processing,
constructors should establish a complete and deterministic object state
rather than leaving scalar members with indeterminate values. This also
makes the class safer if the initialization sequence changes in the future.
This fixes a Coverity UNINIT_CTOR warning caused by uninitialized scalar
members in the constructor.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_min and m_max in the SensorMeasurements constructor to ensure
the object has a valid state immediately after construction, before init()
is called.
Although init() sets these values before normal use, constructors should
fully initialize all class members to avoid leaving objects with undefined
state and to make the class safe to use regardless of initialization order.
This fixes a Coverity UNINIT_CTOR warning caused by uninitialized scalar
members in the constructor.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
RadioAstronomyGUI::spectrumSeries_clicked() called
calcVrAndDistanceToPeak() without verifying that currentFFT() returned a
valid FFTMeasurement. Since currentFFT() can return nullptr and
calcVrAndDistanceToPeak() immediately dereferences the pointer, this could
result in a null pointer dereference.
Guard the calls so they are only made when a valid FFT measurement is
available, matching the existing pattern used elsewhere in the class.
Reported by Coverity (CID 649213).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
The ui object is created during MeshcoreDemodGUI and MeshtasticDemodGUI
construction and remains valid for the lifetime of the widget. Remove
the unnecessary null check to avoid misleading static analysis tools
into assuming ui can be null.
This resolves a Coverity false positive where the later call to
updateDechirpModeUI() was reported as a possible null dereference
in both places.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Fix Coverity CID 649243 (DIVIDE_BY_ZERO) by validating sweep step
values before calculating 2D sweep dimensions.
Move sweep step validation to on_startStop_clicked() so invalid sweep
configurations are reported to the user before a sweep begins. Display
an error message when either sweep step is zero and prevent the sweep
from starting.
Retain defensive validation when updating 2D sweep settings to guard
against invalid configurations received from saved settings or other
code paths.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the coordinate and bearing variables used by
VORModel::findIntersection() and declare the validity flags as bool.
Coverity reported that lat1, lon1, bearing1, lat2, lon2, and bearing2
could be passed uninitialized to calcIntersectionPoint(). While the
current control flow is intended to assign these values before the
corresponding validity flag is set, they were not initialized at
declaration, leaving undefined behavior if that invariant were ever
broken.
Initializing the variables removes the possibility of using
indeterminate values, satisfies static analysis, and makes the code
more robust against future modifications. The validity flags are also
changed from float to bool to match their intended use.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Fix a Coverity UNINIT warning in RadioAstronomyGUI::update2DImage()
where the intensity variable could be used uninitialized if
m_powerYUnits contained an unexpected value and followed the default path.
Handle the default switch case by logging a warning and falling back
to fft->m_totalPowerdBFS, ensuring intensity is always initialized
before being used while providing diagnostics for invalid enum values.
Fixes Coverity CID 649242.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Fix Coverity CID 649221 (DIVIDE_BY_ZERO) by validating the cold
calibration power sum before calculating the Y-factor.
Refactor calcCalTrx() to use early returns for invalid calibration
states and avoid duplicated UI clearing logic. Also handle the
undefined Y-factor case when hot and cold measurements have equal power.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Fix Coverity CID 649238 (DIVIDE_BY_ZERO) by validating the reference
column count before using it as a divisor in plotChart().
The reference column count can be cleared when removing reference data,
in on_clearReference_clicked() so ensure chart rendering handles an empty
reference configuration safely.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Fix Coverity CID 649215 (OVERFLOW_BEFORE_WIDEN) by ensuring the band
preset frequency calculation is widened to 64-bit before converting
kHz to Hz.
This prevents a potential 32-bit intermediate overflow when applying
band presets (which is likely not a real issue, but it keeps the
analyzer happy).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Fix Coverity CID 649088 (CONSTANT_EXPRESSION_RESULT) in the BDS 4,1
next waypoint decoding logic.
The high bit contribution to waypoint character c[5] was incorrectly
shifted right by 3, causing the expression to always evaluate to zero
and discard a valid bit from the decoded character. Change the shift
direction to correctly place the extracted bit into the character field.
This restores proper decoding of the BDS 4,1 waypoint string and removes
the Coverity warning.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Query the PlutoSDR hardware for the current RX gain range and use it
to configure the GUI gain control dynamically.
The AD936x gain limits vary with LO frequency. Previously the GUI used
a fixed gain range, allowing users to select values that the hardware
would reject after changing bands. The gain slider now refreshes its
minimum, maximum, and step size whenever the device center frequency is
updated.
Also change the gain setting serialization to use a signed integer so
negative gain values are preserved for operating modes that support
them.
Changes include:
- Add DevicePlutoSDRBox::getGainRange() to read
in_voltage0_hardwaregain_available.
- Expose gain range through PlutoSDRInput.
- Refresh GUI gain limits when the device frequency changes.
- Avoid unnecessary widget updates when limits are unchanged.
- Store/restore gain as a signed value.
- Add default RX gain limit constants for fallback when the device
cannot provide its range.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Add defensive null checks before dereferencing DeviceAPI::getBuddySharedPtr()
in the PlutoSDR input and output plugins.
DeviceAPI initializes the buddy shared pointer to nullptr, so a buddy may
exist before its shared state has been attached. This could result in null
pointer dereferences during device initialization, buddy thread
suspend/resume, or settings application.
Changes include:
- Validate buddy shared pointer in openDevice() and fail gracefully if absent.
- Guard suspendBuddies() and resumeBuddies() against null shared pointers.
- Skip buddies without shared state during applySettings() while logging a
warning.
- Prevent dereferencing null buddy shared pointers when restarting buddy
threads.
These changes improve robustness during PlutoSDR buddy initialization and
avoid crashes caused by partially initialized buddy relationships.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Fix an incorrect bit shift when decoding aircraft registration
markings from BDS 2,1 Comm-B messages.
Coverity (CID 649088) reported that the expression
'(data[7] & 0x1) >> 3' always evaluates to zero, causing one bit of
the 6-bit character value to be discarded.
The BDS 2,1 aircraft registration marking format encodes seven
6-bit characters. Based on the bit layout defined in ICAO Doc 9871
(Technical Provisions for Mode S Specific Services) and verified
against independent implementations such as pyModeS/rs1090, the
remaining bit from data[7] is the most significant bit of the
character and must be shifted left, not right.
Update the extraction to preserve this bit when combining it with
the remaining bits from data[8].
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the AircraftModel settings pointer to nullptr.
Coverity (CID 649096) flagged m_settings as potentially
uninitialized because the compiler-generated constructor does not
initialize it. Initialize it to nullptr, which is the appropriate
default until setSettings() provides a valid pointer.
This is likely not an issue, as m_settings is typically assigned
shortly after construction. However, correctness depends on that
assumption holding everywhere. Initializing it in the declaration
costs nothing, removes the dependency on initialization order, and
eliminates this class of bugs.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the remaining Aircraft members that were previously left
uninitialized by the constructor.
Coverity (CID 649090) flagged m_pressureAltitude, m_squawk,
m_range, m_lastColor, m_prevTrack, and
m_trackWhenHeadingSet as potentially uninitialized. Initialize
them to sensible default values consistent with their intended use.
This is likely not an issue, as these members are generally
initialized before use. However, correctness depends on that
assumption holding everywhere. Initializing them in the constructor
costs nothing, removes the dependency on call ordering, and
eliminates this class of bugs.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize all coordinate boundary members in the Interogator
constructor.
Coverity (CID 649097) flagged m_minLatitude, m_maxLatitude,
m_minLongitude, and m_maxLongitude as potentially uninitialized.
Initialize them to max()/lowest() sentinel values so subsequent
min/max accumulation logic operates on defined data.
This is likely not an issue, but safety depends on discipline
across the entire codebase, every place these members are
accessed must check m_valid first. Cleaner approach is to just
initialize them, it costs nothing and eliminates the entire class of bugs.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Both plugin readmes listed the SWGMeshtastic* placeholder as an
outstanding item needing dedicated SWGMeshcore* schemas. This PR
provides exactly that — strike the stale todo and note the resolution.
PR #2775 merged the MeshCore plugin source files but omitted the
parent CMakeLists.txt changes, the export.h API macro, and all
MeshCore-specific Swagger schema types. Without these the plugins
do not build and the REST API serves Meshtastic types for MeshCore
channels.
Adds:
- CMakeLists.txt parent directories + option definitions
- exports/export.h MODEMMESHCORE_API macro
- MeshcoreDemod/Mod swagger YAML specs + SWG client classes
- SWGChannelSettings/Report/Actions/ModelFactory MeshCore types
- Rename 164 Meshtastic donor references in plugin code
Fix multiple issues preventing SoapySDR output from producing RF:
- handleInputMessages() never called in DSP engine thread (Qt signal
lost without event loop) - scheduled properly
- setGain() moved to start() post-activation (pre-activation gain
silently fails on SoapyUHD)
- fullScale threshold corrected for CS16 format detection
- Timed first write pattern matching gr4-lora SoapySink
MCR pinning for SoapyUHD: inject auto_tick_rate=0 in
DeviceSoapySDR device-open path to prevent UHD from re-deriving the
master clock rate on set_tx_rate(), which breaks the decimator chain
and produces no RF. Also reads SDRANGEL_USRP_MASTER_CLOCK_RATE_HZ env
var for optional MCR override.
TX diagnostic counters: SoapySDROutputThread tracks packets,
underflows, errors. Exposed via REST as streamSettingsArgs
key-value pairs.