Save Hamlib rig names on startup as they're able to change out from under us. (#834)

* Save Hamlib rig names on startup as they're able to change out from under us.

* Bump up Hamlib to 4.6.2.

* Add PR #834 to changelog.

* Capture rig names after sorting the rig list. This ensures that the rig names are in the same order as the main list.

* Append -D to USB/LSB if radio is using digital variant.
pull/840/head
Mooneer Salem 2025-02-19 18:08:54 -08:00 committed by GitHub
parent 0426ed8944
commit e56e21e9a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 40 additions and 18 deletions

View File

@ -899,6 +899,7 @@ LDPC | Low Density Parity Check Codes - a family of powerful FEC codes
* Fix issue preventing non-ASCII text from appearing properly in FreeDV Reporter messages. (PR #812)
* Don't adjust Msg column width when user disconnects. (PR #828)
* Fix issue preventing suppression of the Msg tooltip for non-truncated messages. (PR #829)
* Preserve Hamlib rig names on startup to guard against changes by Hamlib during execution. (PR #834)
2. Enhancements:
* Show green line indicating RX frequency. (PR #725)
* Update configuration of the Voice Keyer feature based on user feedback. (PR #730, #746, #793)
@ -913,7 +914,7 @@ LDPC | Low Density Parity Check Codes - a family of powerful FEC codes
3. Build system:
* Allow overrriding the version tag when building. (PR #727)
* Update wxWidgets to 3.2.6. (PR #748)
* Update Hamlib to 4.6. (PR #795)
* Update Hamlib to 4.6.2. (PR #834)
4. Miscellaneous:
* Add issue template for SW bugs. (PR #759)

View File

@ -41,7 +41,7 @@ cd $FREEDVGUIDIR
if [ ! -d hamlib-code ]; then
git clone https://github.com/Hamlib/Hamlib.git hamlib-code
fi
cd hamlib-code && git checkout 4.6 && git pull
cd hamlib-code && git checkout 4.6.2 && git pull
./bootstrap
if [ $UNIV_BUILD == 1 ]; then
CFLAGS="-g -O2 -mmacosx-version-min=10.9 -arch x86_64 -arch arm64" CXXFLAGS="-g -O2 -mmacosx-version-min=10.9 -arch x86_64 -arch arm64" ./configure --enable-shared --prefix $HAMLIBDIR

View File

@ -16,7 +16,7 @@ endif(MINGW AND CMAKE_CROSSCOMPILING)
include(ExternalProject)
ExternalProject_Add(build_hamlib
URL https://github.com/Hamlib/Hamlib/archive/refs/tags/4.6.zip
URL https://github.com/Hamlib/Hamlib/archive/refs/tags/4.6.2.zip
BUILD_IN_SOURCE 1
INSTALL_DIR external/dist
PATCH_COMMAND ${HAMLIB_PATCH_CMD}

View File

@ -451,20 +451,29 @@ bool MainFrame::OpenHamlibRig() {
switch(mode)
{
case IRigFrequencyController::USB:
case IRigFrequencyController::DIGU:
m_txtModeStatus->SetLabel(wxT("USB"));
m_txtModeStatus->Enable(true);
break;
case IRigFrequencyController::DIGU:
m_txtModeStatus->SetLabel(wxT("USB-D"));
m_txtModeStatus->Enable(true);
break;
case IRigFrequencyController::LSB:
case IRigFrequencyController::DIGL:
m_txtModeStatus->SetLabel(wxT("LSB"));
m_txtModeStatus->Enable(true);
break;
case IRigFrequencyController::DIGL:
m_txtModeStatus->SetLabel(wxT("LSB-D"));
m_txtModeStatus->Enable(true);
break;
case IRigFrequencyController::FM:
case IRigFrequencyController::DIGFM:
m_txtModeStatus->SetLabel(wxT("FM"));
m_txtModeStatus->Enable(true);
break;
case IRigFrequencyController::DIGFM:
m_txtModeStatus->SetLabel(wxT("FM-D"));
m_txtModeStatus->Enable(true);
break;
case IRigFrequencyController::AM:
m_txtModeStatus->SetLabel(wxT("AM"));
m_txtModeStatus->Enable(true);
@ -578,20 +587,29 @@ void MainFrame::OpenOmniRig()
switch(mode)
{
case IRigFrequencyController::USB:
case IRigFrequencyController::DIGU:
m_txtModeStatus->SetLabel(wxT("USB"));
m_txtModeStatus->Enable(true);
break;
case IRigFrequencyController::DIGU:
m_txtModeStatus->SetLabel(wxT("USB-D"));
m_txtModeStatus->Enable(true);
break;
case IRigFrequencyController::LSB:
case IRigFrequencyController::DIGL:
m_txtModeStatus->SetLabel(wxT("LSB"));
m_txtModeStatus->Enable(true);
break;
case IRigFrequencyController::DIGL:
m_txtModeStatus->SetLabel(wxT("LSB-D"));
m_txtModeStatus->Enable(true);
break;
case IRigFrequencyController::FM:
case IRigFrequencyController::DIGFM:
m_txtModeStatus->SetLabel(wxT("FM"));
m_txtModeStatus->Enable(true);
break;
case IRigFrequencyController::DIGFM:
m_txtModeStatus->SetLabel(wxT("FM-D"));
m_txtModeStatus->Enable(true);
break;
case IRigFrequencyController::AM:
m_txtModeStatus->SetLabel(wxT("AM"));
m_txtModeStatus->Enable(true);

View File

@ -33,6 +33,7 @@
#include "util/logging/ulog.h"
HamlibRigController::RigList HamlibRigController::RigList_;
HamlibRigController::RigNameList HamlibRigController::RigNameList_;
std::mutex HamlibRigController::RigListMutex_;
#if RIGCAPS_NOT_CONST
@ -175,6 +176,12 @@ void HamlibRigController::InitializeHamlibLibrary()
rig_load_all_backends();
rig_list_foreach(&HamlibRigController::BuildRigList_, &RigList_);
std::sort(RigList_.begin(), RigList_.end(), &HamlibRigController::RigCompare_);
// Capture names of rigs for configuration use.
for (auto& rig : RigList_)
{
RigNameList_.push_back(std::string(rig->mfg_name) + std::string(" ") + std::string(rig->model_name));
}
/* Reset debug output. */
rig_set_debug(RIG_DEBUG_VERBOSE);
@ -224,12 +231,9 @@ int HamlibRigController::RigNameToIndex(std::string rigName)
InitializeHamlibLibrary();
int index = 0;
for (auto& entry : RigList_)
for (auto& entry : RigNameList_)
{
char name[128];
snprintf(name, 128, "%s %s", entry->mfg_name, entry->model_name);
if (rigName == std::string(name))
if (rigName == entry)
{
return index;
}
@ -243,10 +247,7 @@ int HamlibRigController::RigNameToIndex(std::string rigName)
std::string HamlibRigController::RigIndexToName(unsigned int rigIndex)
{
InitializeHamlibLibrary();
char name[128];
snprintf(name, 128, "%s %s", RigList_[rigIndex]->mfg_name, RigList_[rigIndex]->model_name);
return name;
return RigNameList_[rigIndex];
}
int HamlibRigController::GetNumberSupportedRadios()

View File

@ -66,6 +66,7 @@ public:
private:
using RigList = std::vector<const struct rig_caps *>;
using RigNameList = std::vector<std::string>;
std::string rigName_;
std::string serialPort_;
@ -96,6 +97,7 @@ private:
void requestCurrentFrequencyModeImpl_();
static RigList RigList_;
static RigNameList RigNameList_;
static std::mutex RigListMutex_;
static bool RigCompare_(const struct rig_caps *rig1, const struct rig_caps *rig2);