| 514 | } |
| 515 | |
| 516 | void MainWindow::deactivateRADE() |
| 517 | { |
| 518 | // Capture slice ID before any field mutations below clear it. |
| 519 | const int radeSliceId = m_radeSliceId; |
| 520 | |
| 521 | // Restore audio mute state on the RADE slice |
| 522 | if (m_radeSliceId >= 0) { |
| 523 | if (auto* s = m_radioModel.slice(m_radeSliceId)) { |
| 524 | disconnect(s, &SliceModel::modeChanged, |
| 525 | this, &MainWindow::onRadeSliceModeChanged); |
| 526 | s->setAudioMute(m_radePrevMute); |
| 527 | } |
| 528 | // Clear RADE status label and disconnect VFO signal connections before resetting sliceId. |
| 529 | // Do this here (with m_radeSliceId still valid) rather than in the m_radeEngine block |
| 530 | // below where the slice ID has already been cleared. |
| 531 | if (auto* sw = spectrumForSlice(m_radioModel.slice(m_radeSliceId))) { |
| 532 | if (auto* vfo = sw->vfoWidget(m_radeSliceId)) { |
| 533 | vfo->setRadeActive(false); |
| 534 | if (m_radeEngine) { |
| 535 | disconnect(m_radeEngine, &RADEEngine::syncChanged, vfo, nullptr); |
| 536 | disconnect(m_radeEngine, &RADEEngine::snrChanged, vfo, nullptr); |
| 537 | disconnect(m_radeEngine, &RADEEngine::freqOffsetChanged, vfo, nullptr); |
| 538 | disconnect(m_radeEngine, &RADEEngine::eooCallsignReceived, vfo, nullptr); |
| 539 | } |
| 540 | } |
| 541 | } |
| 542 | m_radeSliceId = -1; |
| 543 | } |
| 544 | |
| 545 | m_radioModel.transmitModel().clearPttOffHook(); |
| 546 | disconnect(m_radeMoxFallbackConn); |
| 547 | m_radeEooPending = false; |
| 548 | m_radeTxActive = false; |
| 549 | syncKiwiSdrTransmitMute(); |
| 550 | |
| 551 | m_audio->setRadeMode(false); |
| 552 | m_radioModel.setDigitalVoiceTxSlice(-1); |
| 553 | m_audio->clearTxAccumulators(); // flush stale RADE modem data |
| 554 | m_appletPanel->phoneCwApplet()->setRadeActive(false); |
| 555 | |
| 556 | if (auto* applet = m_appletPanel->radeApplet()) { |
| 557 | applet->setRadeActive(false); |
| 558 | if (m_radeEngine) { |
| 559 | disconnect(m_radeEngine, &RADEEngine::syncChanged, applet, nullptr); |
| 560 | disconnect(m_radeEngine, &RADEEngine::snrChanged, applet, nullptr); |
| 561 | disconnect(m_radeEngine, &RADEEngine::freqOffsetChanged, applet, nullptr); |
| 562 | disconnect(m_radeEngine, &RADEEngine::eooCallsignReceived, applet, nullptr); |
| 563 | } |
| 564 | } |
| 565 | |
| 566 | // For hardware mics, reset to full gain — the radio controls hardware levels. |
| 567 | // PC mic keeps its PcMicGain so SSB sessions are unaffected. |
| 568 | if (m_radioModel.transmitModel().micSelection() != "PC") { |
| 569 | m_audio->setPcMicGain(100); |
| 570 | } |
| 571 | m_lastRadeRxCallsign.clear(); |
| 572 | |
| 573 | if (m_radeEngine) { |
nothing calls this directly
no test coverage detected