Browse Source

feat: add driver/uri/deviceArgs backend config plumbing

tags/v0.9.0
Jan Svabenik 1 month ago
parent
commit
ce12ff92b8
4 changed files with 21 additions and 5 deletions
  1. +2
    -0
      .gitignore
  2. +9
    -1
      cmd/fmrtx/main.go
  3. +3
    -0
      docs/config.plutosdr.json
  4. +7
    -4
      internal/config/config.go

+ 2
- 0
.gitignore View File

@@ -7,3 +7,5 @@ build/
*.iq *.iq
*.raw *.raw
*.bak *.bak
*.zip
*.exe

+ 9
- 1
cmd/fmrtx/main.go View File

@@ -153,9 +153,17 @@ func runTXMode(cfg cfgpkg.Config, driver platform.SoapyDriver, autoStart bool, a
// OutputDrive controls composite signal level, NOT hardware gain. // OutputDrive controls composite signal level, NOT hardware gain.
// Hardware TX gain is always 0 dB (max power). Use external attenuator for power control. // Hardware TX gain is always 0 dB (max power). Use external attenuator for power control.
soapyCfg := platform.SoapyConfig{ soapyCfg := platform.SoapyConfig{
Driver: cfg.Backend.Device,
Driver: cfg.Backend.Driver,
Device: cfg.Backend.Device,
CenterFreqHz: cfg.FM.FrequencyMHz * 1e6, CenterFreqHz: cfg.FM.FrequencyMHz * 1e6,
GainDB: 0, // 0 dB = max TX power on PlutoSDR GainDB: 0, // 0 dB = max TX power on PlutoSDR
DeviceArgs: map[string]string{},
}
if cfg.Backend.URI != "" {
soapyCfg.DeviceArgs["uri"] = cfg.Backend.URI
}
for k, v := range cfg.Backend.DeviceArgs {
soapyCfg.DeviceArgs[k] = v
} }
soapyCfg.SampleRateHz = cfg.EffectiveDeviceRate() soapyCfg.SampleRateHz = cfg.EffectiveDeviceRate()




+ 3
- 0
docs/config.plutosdr.json View File

@@ -32,6 +32,9 @@
"backend": { "backend": {
"kind": "pluto", "kind": "pluto",
"device": "usb:", "device": "usb:",
"driver": "",
"uri": "",
"deviceArgs": {},
"outputPath": "", "outputPath": "",
"deviceSampleRateHz": 2280000 "deviceSampleRateHz": 2280000
}, },


+ 7
- 4
internal/config/config.go View File

@@ -50,10 +50,13 @@ type FMConfig struct {
} }


type BackendConfig struct { type BackendConfig struct {
Kind string `json:"kind"`
Device string `json:"device"`
OutputPath string `json:"outputPath"`
DeviceSampleRateHz float64 `json:"deviceSampleRateHz"` // actual SDR device rate; 0 = same as compositeRateHz
Kind string `json:"kind"`
Driver string `json:"driver,omitempty"`
Device string `json:"device"`
URI string `json:"uri,omitempty"`
DeviceArgs map[string]string `json:"deviceArgs,omitempty"`
OutputPath string `json:"outputPath"`
DeviceSampleRateHz float64 `json:"deviceSampleRateHz"` // actual SDR device rate; 0 = same as compositeRateHz
} }


type ControlConfig struct { type ControlConfig struct {


Loading…
Cancel
Save