Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Frequency column to RX drop-down. #663

Merged
merged 4 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion USER_MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,9 @@ LDPC | Low Density Parity Check Codes - a family of powerful FEC codes

1. Bugfixes:
* Prevent unnecessary recreation of resamplers in analog mode. (PR #661)

2. Enhancements:
* Add Frequency column to RX drop-down. (PR #663)

## V1.9.7.2 January 2024

1. Bugfixes:
Expand Down
21 changes: 18 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,21 @@ void MainFrame::OnTimer(wxTimerEvent &evt)
std::string pendingCallsign = rxCallsign.ToStdString();
auto pendingSnr = (int)(g_snr + 0.5);

if (m_lastReportedCallsignListView->GetItemCount() == 0 || m_lastReportedCallsignListView->GetItemText(0, 0) != rxCallsign)
wxString freqString;
if (wxGetApp().appConfiguration.reportingConfiguration.reportingFrequencyAsKhz)
{
double freq = wxGetApp().appConfiguration.reportingConfiguration.reportingFrequency.get() / 1000.0;
freqString = wxString::Format("%.01f", freq);
}
else
{
double freq = wxGetApp().appConfiguration.reportingConfiguration.reportingFrequency.get() / 1000000.0;
freqString = wxString::Format("%.04f", freq);
}

if (m_lastReportedCallsignListView->GetItemCount() == 0 ||
m_lastReportedCallsignListView->GetItemText(0, 0) != rxCallsign ||
m_lastReportedCallsignListView->GetItemText(0, 1) != freqString)
{
auto currentTime = wxDateTime::Now();
wxString currentTimeAsString = "";
Expand All @@ -1450,13 +1464,14 @@ void MainFrame::OnTimer(wxTimerEvent &evt)
currentTimeAsString.Printf(wxT("%s %s"), currentTime.FormatISODate(), currentTime.FormatISOTime());

auto index = m_lastReportedCallsignListView->InsertItem(0, rxCallsign, 0);
m_lastReportedCallsignListView->SetItem(index, 1, currentTimeAsString);
m_lastReportedCallsignListView->SetItem(index, 1, freqString);
m_lastReportedCallsignListView->SetItem(index, 2, currentTimeAsString);
}

wxString snrAsString;
snrAsString.Printf(wxT("%0.1f"), g_snr);
auto index = m_lastReportedCallsignListView->GetTopItem();
m_lastReportedCallsignListView->SetItem(index, 2, snrAsString);
m_lastReportedCallsignListView->SetItem(index, 3, snrAsString);

m_cboLastReportedCallsigns->SetText(rxCallsign);
m_cboLastReportedCallsigns->Enable(m_lastReportedCallsignListView->GetItemCount() > 0);
Expand Down
30 changes: 29 additions & 1 deletion src/ongui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ void MainFrame::OnToolsFilter(wxCommandEvent& event)
//-------------------------------------------------------------------------
void MainFrame::OnToolsOptions(wxCommandEvent& event)
{
bool oldFreqAsKHz = wxGetApp().appConfiguration.reportingConfiguration.reportingFrequencyAsKhz;

wxUnusedVar(event);
if (optionsDlg->ShowModal() == wxOK)
{
Expand Down Expand Up @@ -226,7 +228,33 @@ void MainFrame::OnToolsOptions(wxCommandEvent& event)
{
m_freqBox->SetLabel(_("Report Freq. (MHz)"));
}


// If the "Frequency as kHz" option has changed, update the frequencies
// in the main window's callsign list.
if (oldFreqAsKHz != wxGetApp().appConfiguration.reportingConfiguration.reportingFrequencyAsKhz)
{
for (int index = 0; index < m_lastReportedCallsignListView->GetItemCount(); index++)
{
wxString newFreq = "";
wxString freq = m_lastReportedCallsignListView->GetItemText(index, 1);
double freqDouble = 0;
freq.ToDouble(&freqDouble);

if (wxGetApp().appConfiguration.reportingConfiguration.reportingFrequencyAsKhz)
{
freqDouble *= 1000.0;
newFreq = wxString::Format("%.01f", freqDouble);
}
else
{
freqDouble /= 1000.0;
newFreq = wxString::Format("%.04f", freqDouble);
}

m_lastReportedCallsignListView->SetItem(index, 1, newFreq);
}
}

// Initialize FreeDV Reporter if required.
initializeFreeDVReporter_();

Expand Down
7 changes: 4 additions & 3 deletions src/topFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,10 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
m_cboLastReportedCallsigns->SetPopupControl(m_lastReportedCallsignListView);
m_cboLastReportedCallsigns->SetSizeHints(wxSize(100,-1));

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

bSizer15->Add(m_txtCtrlCallSign, 1, wxALL|wxEXPAND, 5);
bSizer15->Add(m_cboLastReportedCallsigns, 1, wxALL|wxEXPAND, 5);
Expand Down
Loading