kopia lustrzana https://github.com/cyoung/stratux
sdr: some refactoring
rodzic
f508d0331c
commit
1c08a12fff
43
main/sdr.go
43
main/sdr.go
|
@ -475,42 +475,21 @@ func sdrWatcher() {
|
||||||
count = 2
|
count = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for either no dongles or none enabled
|
if count == prevCount && prevES_Enabled == globalSettings.ES_Enabled &&
|
||||||
if count < 1 || (!globalSettings.UAT_Enabled && !globalSettings.ES_Enabled) {
|
prevUAT_Enabled == globalSettings.UAT_Enabled {
|
||||||
if UATDev != nil {
|
|
||||||
UATDev.shutdown()
|
|
||||||
UATDev = nil
|
|
||||||
}
|
|
||||||
if ESDev != nil {
|
|
||||||
ESDev.shutdown()
|
|
||||||
ESDev = nil
|
|
||||||
}
|
|
||||||
prevCount = count
|
|
||||||
prevUAT_Enabled = false
|
|
||||||
prevES_Enabled = false
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the device count or the global settings change, do a reconfig.
|
// the device count or the global settings have changed, reconfig
|
||||||
// both events are significant and the least convoluted way to handle it
|
if UATDev != nil {
|
||||||
// is to reconfigure all dongle/s across the board. The reconfig
|
UATDev.shutdown()
|
||||||
// should happen fairly quick so the user shouldn't notice any
|
UATDev = nil
|
||||||
// major disruption; if it is significant we can split the dongle
|
|
||||||
// count check from the global settings check where the gloabl settings
|
|
||||||
// check won't do a reconfig.
|
|
||||||
if count != prevCount || prevES_Enabled != globalSettings.ES_Enabled ||
|
|
||||||
prevUAT_Enabled != globalSettings.UAT_Enabled {
|
|
||||||
if UATDev != nil {
|
|
||||||
UATDev.shutdown()
|
|
||||||
UATDev = nil
|
|
||||||
|
|
||||||
}
|
|
||||||
if ESDev != nil {
|
|
||||||
ESDev.shutdown()
|
|
||||||
ESDev = nil
|
|
||||||
}
|
|
||||||
configDevices(count, globalSettings.ES_Enabled, globalSettings.UAT_Enabled)
|
|
||||||
}
|
}
|
||||||
|
if ESDev != nil {
|
||||||
|
ESDev.shutdown()
|
||||||
|
ESDev = nil
|
||||||
|
}
|
||||||
|
configDevices(count, globalSettings.ES_Enabled, globalSettings.UAT_Enabled)
|
||||||
|
|
||||||
prevCount = count
|
prevCount = count
|
||||||
prevUAT_Enabled = globalSettings.UAT_Enabled
|
prevUAT_Enabled = globalSettings.UAT_Enabled
|
||||||
|
|
Ładowanie…
Reference in New Issue