| 7855 | } |
| 7856 | |
| 7857 | void 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 | |
| 7900 | SliceModel* MainWindow::swrSweepTargetSlice(int requestedSliceId) const |
| 7901 | { |
nothing calls this directly
no test coverage detected