Update the active list of demodulators for handling
| 42 | |
| 43 | // Update the active list of demodulators for handling |
| 44 | void SDRPostThread::updateActiveDemodulators() { |
| 45 | // In range? |
| 46 | |
| 47 | runDemods.clear(); |
| 48 | demodChannel.clear(); |
| 49 | |
| 50 | long long centerFreq = wxGetApp().getFrequency(); |
| 51 | |
| 52 | //retrieve the current list of demodulators: |
| 53 | auto demodulators = wxGetApp().getDemodMgr().getDemodulators(); |
| 54 | |
| 55 | for (const auto& demod : demodulators) { |
| 56 | |
| 57 | // not in range? |
| 58 | if (demod->isDeltaLock()) { |
| 59 | if (demod->getFrequency() != centerFreq + demod->getDeltaLockOfs()) { |
| 60 | demod->setFrequency(centerFreq + demod->getDeltaLockOfs()); |
| 61 | demod->updateLabel(demod->getFrequency()); |
| 62 | demod->setFollow(false); |
| 63 | demod->setTracking(false); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | if (abs(frequency - demod->getFrequency()) > (sampleRate / 2)) { |
| 68 | // deactivate if active |
| 69 | |
| 70 | if (wxGetApp().getDemodMgr().getCurrentModem() == demod) { |
| 71 | demod->setActive(false); |
| 72 | } |
| 73 | else if (demod->isActive() && !demod->isFollow() && !demod->isTracking()) { |
| 74 | demod->setActive(false); |
| 75 | } |
| 76 | |
| 77 | // follow if follow mode |
| 78 | if (demod->isFollow() && centerFreq != demod->getFrequency()) { |
| 79 | wxGetApp().setFrequency(demod->getFrequency()); |
| 80 | demod->setFollow(false); |
| 81 | } |
| 82 | } else if (!demod->isActive()) { // in range, activate if not activated |
| 83 | demod->setActive(true); |
| 84 | if (wxGetApp().getDemodMgr().getCurrentModem() == nullptr) { |
| 85 | |
| 86 | wxGetApp().getDemodMgr().setActiveDemodulator(demod); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | if (!demod->isActive()) { |
| 91 | continue; |
| 92 | } |
| 93 | |
| 94 | // Add active demods to the current run: |
| 95 | runDemods.push_back(demod); |
| 96 | demodChannel.push_back(-1); |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | |
| 101 | void SDRPostThread::resetAllDemodulators() { |
nothing calls this directly
no test coverage detected