MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / restoreBandState

Method restoreBandState

src/gui/MainWindow.cpp:7857–7898  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7855}
7856
7857void MainWindow::restoreBandState(const BandSnapshot& snap)
7858{
7859 m_updatingFromModel = true;
7860 if (auto* s = activeSlice()) {
7861 s->setMode(snap.mode);
7862 TuneCenteringResult result;
7863 if (auto* pan = m_radioModel.panadapter(s->panId())) {
7864 result.oldCenterMhz = pan->centerMhz();
7865 result.bandwidthMhz = pan->bandwidthMhz();
7866 }
7867 result.newCenterMhz = snap.frequencyMhz;
7868 result.followRevealTriggered = true;
7869 result.hardCenterUsed = true;
7870 logTunePolicyDecision("restore-band-state", TuneIntent::AbsoluteJump,
7871 s->frequency(), snap.frequencyMhz, result);
7872 s->tuneAndRecenter(snap.frequencyMhz);
7873 if (!snap.rxAntenna.isEmpty())
7874 s->setRxAntenna(snap.rxAntenna);
7875 s->setFilterWidth(snap.filterLow, snap.filterHigh);
7876 if (!snap.agcMode.isEmpty())
7877 s->setAgcMode(snap.agcMode);
7878 s->setAgcThreshold(snap.agcThreshold);
7879 }
7880 if (auto* pan = m_radioModel.activePanadapter()) {
7881 // Don't push center or bandwidth — slice tune recenters the pan and
7882 // the radio determines bandwidth. Pushing stale saved values causes
7883 // FFT/waterfall misalignment during the transition (#279, #291).
7884 // Only restore dBm scale (client-side display preference).
7885 m_radioModel.sendCommand(
7886 QString("display pan set %1 min_dbm=%2 max_dbm=%3").arg(pan->panId())
7887 .arg(static_cast<double>(snap.minDbm), 0, 'f', 2)
7888 .arg(static_cast<double>(snap.maxDbm), 0, 'f', 2));
7889 }
7890 m_radioModel.setPanRfGain(snap.rfGain);
7891 m_radioModel.setPanWnb(snap.wnbOn);
7892 if (auto* sw = spectrum()) {
7893 sw->setSpectrumFrac(snap.spectrumFrac);
7894 sw->setRfGain(snap.rfGain);
7895 sw->setWnbActive(snap.wnbOn);
7896 }
7897 m_updatingFromModel = false;
7898}
7899
7900SliceModel* MainWindow::swrSweepTargetSlice(int requestedSliceId) const
7901{

Callers

nothing calls this directly

Calls 15

frequencyMethod · 0.80
tuneAndRecenterMethod · 0.80
setRxAntennaMethod · 0.80
setFilterWidthMethod · 0.80
setAgcModeMethod · 0.80
setAgcThresholdMethod · 0.80
activePanadapterMethod · 0.80
setPanRfGainMethod · 0.80
setPanWnbMethod · 0.80
setSpectrumFracMethod · 0.80
setWnbActiveMethod · 0.80
setModeMethod · 0.45

Tested by

no test coverage detected