Skip to content

Commit 2560107

Browse files
authored
Merge pull request #663 from drowe67/ms-frequency-rx-call
Add Frequency column to RX drop-down.
2 parents 82577e0 + f46bbc7 commit 2560107

File tree

4 files changed

+54
-8
lines changed

4 files changed

+54
-8
lines changed

USER_MANUAL.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,9 @@ LDPC | Low Density Parity Check Codes - a family of powerful FEC codes
893893

894894
1. Bugfixes:
895895
* Prevent unnecessary recreation of resamplers in analog mode. (PR #661)
896-
896+
2. Enhancements:
897+
* Add Frequency column to RX drop-down. (PR #663)
898+
897899
## V1.9.7.2 January 2024
898900

899901
1. Bugfixes:

src/main.cpp

+18-3
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,21 @@ void MainFrame::OnTimer(wxTimerEvent &evt)
14381438
std::string pendingCallsign = rxCallsign.ToStdString();
14391439
auto pendingSnr = (int)(g_snr + 0.5);
14401440

1441-
if (m_lastReportedCallsignListView->GetItemCount() == 0 || m_lastReportedCallsignListView->GetItemText(0, 0) != rxCallsign)
1441+
wxString freqString;
1442+
if (wxGetApp().appConfiguration.reportingConfiguration.reportingFrequencyAsKhz)
1443+
{
1444+
double freq = wxGetApp().appConfiguration.reportingConfiguration.reportingFrequency.get() / 1000.0;
1445+
freqString = wxString::Format("%.01f", freq);
1446+
}
1447+
else
1448+
{
1449+
double freq = wxGetApp().appConfiguration.reportingConfiguration.reportingFrequency.get() / 1000000.0;
1450+
freqString = wxString::Format("%.04f", freq);
1451+
}
1452+
1453+
if (m_lastReportedCallsignListView->GetItemCount() == 0 ||
1454+
m_lastReportedCallsignListView->GetItemText(0, 0) != rxCallsign ||
1455+
m_lastReportedCallsignListView->GetItemText(0, 1) != freqString)
14421456
{
14431457
auto currentTime = wxDateTime::Now();
14441458
wxString currentTimeAsString = "";
@@ -1450,13 +1464,14 @@ void MainFrame::OnTimer(wxTimerEvent &evt)
14501464
currentTimeAsString.Printf(wxT("%s %s"), currentTime.FormatISODate(), currentTime.FormatISOTime());
14511465

14521466
auto index = m_lastReportedCallsignListView->InsertItem(0, rxCallsign, 0);
1453-
m_lastReportedCallsignListView->SetItem(index, 1, currentTimeAsString);
1467+
m_lastReportedCallsignListView->SetItem(index, 1, freqString);
1468+
m_lastReportedCallsignListView->SetItem(index, 2, currentTimeAsString);
14541469
}
14551470

14561471
wxString snrAsString;
14571472
snrAsString.Printf(wxT("%0.1f"), g_snr);
14581473
auto index = m_lastReportedCallsignListView->GetTopItem();
1459-
m_lastReportedCallsignListView->SetItem(index, 2, snrAsString);
1474+
m_lastReportedCallsignListView->SetItem(index, 3, snrAsString);
14601475

14611476
m_cboLastReportedCallsigns->SetText(rxCallsign);
14621477
m_cboLastReportedCallsigns->Enable(m_lastReportedCallsignListView->GetItemCount() > 0);

src/ongui.cpp

+29-1
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ void MainFrame::OnToolsFilter(wxCommandEvent& event)
189189
//-------------------------------------------------------------------------
190190
void MainFrame::OnToolsOptions(wxCommandEvent& event)
191191
{
192+
bool oldFreqAsKHz = wxGetApp().appConfiguration.reportingConfiguration.reportingFrequencyAsKhz;
193+
192194
wxUnusedVar(event);
193195
if (optionsDlg->ShowModal() == wxOK)
194196
{
@@ -226,7 +228,33 @@ void MainFrame::OnToolsOptions(wxCommandEvent& event)
226228
{
227229
m_freqBox->SetLabel(_("Report Freq. (MHz)"));
228230
}
229-
231+
232+
// If the "Frequency as kHz" option has changed, update the frequencies
233+
// in the main window's callsign list.
234+
if (oldFreqAsKHz != wxGetApp().appConfiguration.reportingConfiguration.reportingFrequencyAsKhz)
235+
{
236+
for (int index = 0; index < m_lastReportedCallsignListView->GetItemCount(); index++)
237+
{
238+
wxString newFreq = "";
239+
wxString freq = m_lastReportedCallsignListView->GetItemText(index, 1);
240+
double freqDouble = 0;
241+
freq.ToDouble(&freqDouble);
242+
243+
if (wxGetApp().appConfiguration.reportingConfiguration.reportingFrequencyAsKhz)
244+
{
245+
freqDouble *= 1000.0;
246+
newFreq = wxString::Format("%.01f", freqDouble);
247+
}
248+
else
249+
{
250+
freqDouble /= 1000.0;
251+
newFreq = wxString::Format("%.04f", freqDouble);
252+
}
253+
254+
m_lastReportedCallsignListView->SetItem(index, 1, newFreq);
255+
}
256+
}
257+
230258
// Initialize FreeDV Reporter if required.
231259
initializeFreeDVReporter_();
232260

src/topFrame.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,10 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
582582
m_cboLastReportedCallsigns->SetPopupControl(m_lastReportedCallsignListView);
583583
m_cboLastReportedCallsigns->SetSizeHints(wxSize(100,-1));
584584

585-
m_lastReportedCallsignListView->InsertColumn(0, wxT("Callsign"), wxLIST_FORMAT_LEFT, 125);
586-
m_lastReportedCallsignListView->InsertColumn(1, wxT("Date/Time"), wxLIST_FORMAT_CENTRE, 175);
587-
m_lastReportedCallsignListView->InsertColumn(2, wxT("SNR (dB)"), wxLIST_FORMAT_CENTRE, 75);
585+
m_lastReportedCallsignListView->InsertColumn(0, wxT("Callsign"), wxLIST_FORMAT_LEFT, 100);
586+
m_lastReportedCallsignListView->InsertColumn(1, wxT("Frequency"), wxLIST_FORMAT_RIGHT, 75);
587+
m_lastReportedCallsignListView->InsertColumn(2, wxT("Date/Time"), wxLIST_FORMAT_LEFT, 175);
588+
m_lastReportedCallsignListView->InsertColumn(3, wxT("SNR"), wxLIST_FORMAT_RIGHT, 50);
588589

589590
bSizer15->Add(m_txtCtrlCallSign, 1, wxALL|wxEXPAND, 5);
590591
bSizer15->Add(m_cboLastReportedCallsigns, 1, wxALL|wxEXPAND, 5);

0 commit comments

Comments
 (0)