mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 20:37:33 +00:00
feat: unify sample-rate presets across desktop + web UIs
Sample-rate (span) presets were duplicated in three places and none was authoritative: HPSDR set hardcoded in the desktop overlay (SPAN_RATES), Pluto set in backend caps, and a separate hardcoded list in the web JS. The web showed HPSDR rates even on Pluto, and the web adapter silently dropped any rate outside a hardcoded HPSDR whitelist (so Pluto-only rates like 960k/2304k never switched). Single source of truth = backend caps -> controller: - HPSDRNetwork.Caps now fills RatePresets [48k..1536k] (was nil). - RadioBackend: named type TBackendRateArray. - TRadioController.SampleRatePresets returns BackendCaps.RatePresets. Both UIs derive from it: - Desktop: ApplyBackendCapsToUI always feeds the overlay from SampleRatePresets (overlay no longer owns the HPSDR list). - Web: WebServer.SetRatePresets + rate_presets in state JSON; hosts (daemon OnState/startup, GUI ApplyBackendCapsToUI/startup) push SampleRatePresets; JS builds span buttons dynamically from it. - WebAdapter.SyncSpan validates against SampleRatePresets instead of a hardcoded whitelist, so any backend rate is accepted. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+2
-1
@@ -29,6 +29,7 @@ uses
|
||||
type
|
||||
TBackendKind = (bkHPSDR, bkPluto);
|
||||
TSampleRateMode = (srmDiscrete, srmContinuous);
|
||||
TBackendRateArray = array of Integer; // пресеты sample-rate (общий тип UI)
|
||||
|
||||
// Описание возможностей бэкенда. Контроллер гейтит UI/поведение по этим полям.
|
||||
TBackendCaps = record
|
||||
@@ -46,7 +47,7 @@ type
|
||||
MinSampleRate: Integer;
|
||||
MaxSampleRate: Integer;
|
||||
SampleRateMode: TSampleRateMode;
|
||||
RatePresets: array of Integer; // пресеты для SampleRateOverlay
|
||||
RatePresets: TBackendRateArray; // пресеты для SampleRateOverlay
|
||||
MinFreqHz: Double;
|
||||
MaxFreqHz: Double;
|
||||
end;
|
||||
|
||||
Reference in New Issue
Block a user