From 16767c0d8c5b64bc839fc892f3cbb511fcfb5eac Mon Sep 17 00:00:00 2001
From: DL1YCF <dl1ycf@darc.de>
Date: Wed, 1 Jan 2020 16:32:23 +0100
Subject: [PATCH] Fix the call to getFrequencyInfo to reflect the current
 status of the TX frequency.

---
 vfo.c | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/vfo.c b/vfo.c
index 4fb1331..2453bdb 100644
--- a/vfo.c
+++ b/vfo.c
@@ -1094,7 +1094,37 @@ void vfo_update() {
         cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
         cairo_show_text(cr, temp_text);
 
-        getFrequencyInfo(af,active_receiver->filter_low,active_receiver->filter_high);
+        //
+        // af: Frequency of VFO_A, bf: Frequency of VFO_B, without xit/rit etc.
+        //
+        long long txfreq;
+        int txlow, txhigh;
+
+        if ((id == 0 && ! split) || (id == 1 && split)) {
+	  // txfreq derived from VFO A
+          txfreq=af;
+        } else {
+          txfreq=bf;
+        }
+        if (transmitter->xit_enabled) txfreq += transmitter->xit;
+	//
+	// In CW modes, the signal is generated explicitly (without WDSP),
+	// so we can assume a zero-width filter. Note that the CW signal
+	// can be on the VFO frequency or offset by the side tone freq.
+	//
+        switch (transmitter->mode) {
+	  case modeCWU:
+            txlow = txhigh = cw_is_on_vfo_freq ? 0 : cw_keyer_sidetone_frequency;
+	    break;
+	  case modeCWL:
+            txlow = txhigh = cw_is_on_vfo_freq ? 0 : -cw_keyer_sidetone_frequency;
+	    break;
+	  default:
+            txlow =transmitter->filter_low;
+            txhigh=transmitter->filter_high;
+	    break;
+	}
+        getFrequencyInfo(txfreq, txlow, txhigh);
 /*
         cairo_move_to(cr, (my_width/4)*3, 50);
         cairo_show_text(cr, getFrequencyInfo(af));
-- 
2.45.2