mirror of
https://github.com/smittix/intercept.git
synced 2026-05-02 18:49:57 -07:00
feat(gain): normalize gain controls across modes
- Pager and sensor gain inputs changed from unvalidated text fields to number inputs with min/max/step constraints - ADS-B dashboard now exposes a gain input in the tracking strip; previously gain was hardcoded to 40 dB with no user control - validate_gain() ceiling raised from 50 to 102 dB to support HackRF (LNA 40 + VGA 62 = 102 dB combined) and LimeSDR (73 dB) - sdrCapabilities gain_max values corrected: HackRF 62→102, Airspy 21→45 - onSDRTypeChanged() now propagates gain_max to all mode gain inputs so HTML constraints match the selected SDR's actual range Closes #162
This commit is contained in:
@@ -93,11 +93,16 @@ def validate_rtl_tcp_port(port: Any) -> int:
|
||||
|
||||
|
||||
def validate_gain(gain: Any) -> float:
|
||||
"""Validate and return gain value."""
|
||||
"""Validate and return gain value.
|
||||
|
||||
Accepts 0 (auto/minimum) up to 102 dB to cover multi-stage SDRs
|
||||
(HackRF LNA+VGA = 40+62 = 102 dB max). RTL-SDR caps at 50 dB
|
||||
internally; values above 50 are only meaningful for HackRF/LimeSDR.
|
||||
"""
|
||||
try:
|
||||
gain_float = float(gain)
|
||||
if not 0 <= gain_float <= 50:
|
||||
raise ValueError(f"Gain must be between 0 and 50, got {gain_float}")
|
||||
if not 0 <= gain_float <= 102:
|
||||
raise ValueError(f"Gain must be between 0 and 102, got {gain_float}")
|
||||
return gain_float
|
||||
except (ValueError, TypeError) as e:
|
||||
raise ValueError(f"Invalid gain: {gain}") from e
|
||||
|
||||
Reference in New Issue
Block a user