Push the current frequency and S-meter/power reading to the TMate 2 LCD. Called whenever the active-slice frequency, S-meter level, or device connection state changes. Frequency comes from activeSlice(); S-meter uses the last value cached in m_tmate2SmeterDbm. small_val mapping: RX: linear dBm offset from S9, clamped 0-999. S9 (-73 dBm) → 90; each dB above S9 adds 1 (S9+10 dB → 100); each dB bel
| 727 | // each dB below S9 subtracts 1 (S8 → 84, S5 → 66, S1 → 42). |
| 728 | // TX: forward power in watts from the last txMetersChanged sample. |
| 729 | void MainWindow::updateTMate2Display() |
| 730 | { |
| 731 | if (!m_hidEncoder || !m_hidEncoder->isOpen() || !m_hidEncoder->isTMate2()) return; |
| 732 | if (m_tmate2DisplayBlanked) return; |
| 733 | |
| 734 | if (tmate2OverlayActive()) { |
| 735 | const int32_t mainVal = m_tmate2OverlayValue; |
| 736 | QString overlayText; |
| 737 | auto fixed3 = [](int value) { |
| 738 | return QStringLiteral("%1").arg(std::clamp(value, 0, 999), 3, 10, |
| 739 | QLatin1Char('0')); |
| 740 | }; |
| 741 | switch (m_tmate2Overlay) { |
| 742 | case TMate2Overlay::Text: |
| 743 | overlayText = m_tmate2OverlayText; |
| 744 | break; |
| 745 | case TMate2Overlay::Volume: |
| 746 | overlayText = QStringLiteral("VOL %1").arg(fixed3(mainVal)); |
| 747 | break; |
| 748 | case TMate2Overlay::Power: |
| 749 | overlayText = QStringLiteral("PWR %1").arg(fixed3(mainVal)); |
| 750 | break; |
| 751 | case TMate2Overlay::Agc: |
| 752 | overlayText = QStringLiteral("AGC %1").arg(fixed3(mainVal)); |
| 753 | break; |
| 754 | case TMate2Overlay::Apf: |
| 755 | overlayText = QStringLiteral("APF %1").arg(fixed3(mainVal)); |
| 756 | break; |
| 757 | case TMate2Overlay::Wpm: |
| 758 | overlayText = QStringLiteral("WPM %1").arg(fixed3(mainVal)); |
| 759 | break; |
| 760 | case TMate2Overlay::Rit: |
| 761 | overlayText = QStringLiteral("RIT %1") |
| 762 | .arg(mainVal, 5, 10, QLatin1Char(' ')); |
| 763 | break; |
| 764 | case TMate2Overlay::Xit: |
| 765 | overlayText = QStringLiteral("XIT %1") |
| 766 | .arg(mainVal, 5, 10, QLatin1Char(' ')); |
| 767 | break; |
| 768 | case TMate2Overlay::Speed: |
| 769 | // Tuning step in Hz. Max preset step is 10 kHz, so use the short |
| 770 | // "STP" label: "STP 10000" is exactly 9 chars and fits the main |
| 771 | // display ("STEP 10000" would be 10 and truncate to "STEP 1000"). |
| 772 | overlayText = QStringLiteral("STP %1") |
| 773 | .arg(mainVal, 5, 10, QLatin1Char(' ')); |
| 774 | break; |
| 775 | case TMate2Overlay::Shift: |
| 776 | // Groundwork: not yet triggered (no dispatcher raises Shift). Own |
| 777 | // label so it never inherits the STEP readout if it is wired later. |
| 778 | overlayText = QStringLiteral("SHFT %1") |
| 779 | .arg(mainVal, 4, 10, QLatin1Char(' ')); |
| 780 | break; |
| 781 | case TMate2Overlay::None: |
| 782 | overlayText.clear(); |
| 783 | break; |
| 784 | } |
| 785 | QMetaObject::invokeMethod(m_hidEncoder, [this, overlayText] { |
| 786 | m_hidEncoder->setTMate2OverlayDisplay(overlayText); |
nothing calls this directly
no test coverage detected