Skip to content

Commit

Permalink
Merge branch 'master' into ms-2020c
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiw committed Mar 22, 2023
2 parents 3252c4b + c0fbb6c commit c196ec7
Show file tree
Hide file tree
Showing 15 changed files with 344 additions and 159 deletions.
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ endif()
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING "Minimum OS X deployment version")

set(PROJECT_NAME FreeDV)
set(PROJECT_VERSION 1.8.8)
set(PROJECT_VERSION 1.8.9)
set(PROJECT_DESCRIPTION "HF Digital Voice for Radio Amateurs")
set(PROJECT_HOMEPAGE_URL "https://freedv.org")

Expand Down Expand Up @@ -513,9 +513,12 @@ endif()
if(FreeDV_VERSION_TWEAK)
set(CPACK_PACKAGE_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}.${FreeDV_VERSION_TWEAK}")
endif()
if(FREEDV_VERSION_TAG)
#set(CPACK_PACKAGE_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}-${FREEDV_VERSION_SUFFIX}")
set(CPACK_PACKAGE_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}-${FREEDV_VERSION_TAG}-${DATE_RESULT}-${FREEDV_HASH}")
if(FREEDV_VERSION_SUFFIX)
if(FREEDV_HASH)
set(CPACK_PACKAGE_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}-${FREEDV_VERSION_TAG}-${DATE_RESULT}-${FREEDV_HASH}")
else(FREEDV_HASH)
set(CPACK_PACKAGE_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}-${FREEDV_VERSION_TAG}-${DATE_RESULT}")
endif(FREEDV_HASH)
message(STATUS "package name = ${CPACK_PACKAGE_VERSION_PATCH}")
endif()

Expand Down
12 changes: 11 additions & 1 deletion USER_MANUAL.html
Original file line number Diff line number Diff line change
Expand Up @@ -590,13 +590,23 @@ <h1 data-number="15" id="glossary"><span class="header-section-number">15</span>
</tbody>
</table>
<h1 data-number="16" id="release-notes"><span class="header-section-number">16</span> Release Notes</h1>
<h2 data-number="16.1" id="tbd-tbd-2023"><span class="header-section-number">16.1</span> TBD TBD 2023</h2>
<h2 data-number="16.1" id="v1.8.8-march-2023"><span class="header-section-number">16.1</span> V1.8.8 March 2023</h2>
<ol type="1">
<li>Bugfixes:
<ul>
<li>Resolve compile failure in EasySetupDialog on openSUSE. (PR #344)</li>
<li>Prevent Mode box from auto-resizing to avoid unexpected movement of other controls. (PR #347)</li>
</ul></li>
<li>Build system:
<ul>
<li>CPack: Properly handle the case where FREEDV_HASH doesn’t exist. (PR #345)</li>
</ul></li>
<li>Enhancements:
<ul>
<li>Show friendlier error if serial ports can’t be opened. (PR #348)</li>
<li>Use same VFO retrieval mechanism for PTT as with frequency sync. (PR #350)</li>
<li>Tweak PSK Reporter handling to report received callsigns more quickly. (PR #352)</li>
</ul></li>
</ol>
<h2 data-number="16.2" id="v1.8.7-january-2023"><span class="header-section-number">16.2</span> V1.8.7 January 2023</h2>
<ol type="1">
Expand Down
8 changes: 7 additions & 1 deletion USER_MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -833,11 +833,17 @@ LDPC | Low Density Parity Check Codes - a family of powerful FEC codes

# Release Notes

## TBD TBD 2023
## V1.8.8 March 2023

1. Bugfixes:
* Resolve compile failure in EasySetupDialog on openSUSE. (PR #344)
* Prevent Mode box from auto-resizing to avoid unexpected movement of other controls. (PR #347)
2. Build system:
* CPack: Properly handle the case where FREEDV_HASH doesn't exist. (PR #345)
3. Enhancements:
* Show friendlier error if serial ports can't be opened. (PR #348)
* Use same VFO retrieval mechanism for PTT as with frequency sync. (PR #350)
* Tweak PSK Reporter handling to report received callsigns more quickly. (PR #352)

## V1.8.7 January 2023

Expand Down
10 changes: 10 additions & 0 deletions src/dlg_easy_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,11 @@ void EasySetupDialog::OnTest(wxCommandEvent& event)
m_cbSerialRate->GetValue().ToLong(&rate);
}

if (!wxGetApp().CanAccessSerialPort((const char*)serialPort.ToUTF8()))
{
return;
}

if (!hamlibTestObject_->connect(rig, (const char*)serialPort.ToUTF8(), rate, civHexAddress))
{
wxMessageBox(
Expand All @@ -797,6 +802,11 @@ void EasySetupDialog::OnTest(wxCommandEvent& event)
{
wxString serialPort = m_cbSerialPort->GetValue();

if (!wxGetApp().CanAccessSerialPort((const char*)serialPort.ToUTF8()))
{
return;
}

bool useRTS = m_rbUseRTS->GetValue();
bool RTSPos = m_ckRTSPos->IsChecked();
bool useDTR = m_rbUseDTR->GetValue();
Expand Down
105 changes: 55 additions & 50 deletions src/dlg_ptt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,40 +564,42 @@ void ComPortsDlg::OnTest(wxCommandEvent& event) {

if (g_verbose) fprintf(stderr, "serial rate: %d\n", serial_rate);

// try to open rig

Hamlib *hamlib = wxGetApp().m_hamlib;
bool status = hamlib->connect(rig, port.mb_str(wxConvUTF8), serial_rate, hexAddress);
if (status == false) {
wxMessageBox("Couldn't connect to Radio with Hamlib. Make sure the Hamlib serial Device, Rate, and Params match your radio",
wxT("Error"), wxOK | wxICON_ERROR, this);
return;
}
else {
wxString hamlib_serial_config;
hamlib_serial_config.sprintf(" %d, %d, %d",
hamlib->get_serial_rate(),
hamlib->get_data_bits(),
hamlib->get_stop_bits());
m_cbSerialParams->SetLabel(hamlib_serial_config);
}

// toggle PTT

wxString hamlibError;
if (hamlib->ptt(true, hamlibError) == false) {
wxMessageBox(wxString("Hamlib PTT Error: ") + hamlibError +
wxString(". Make sure the Hamlib serial Device, Rate, and Params match your radio"),
wxT("Error"), wxOK | wxICON_ERROR, this);
return;
}
if (wxGetApp().CanAccessSerialPort((const char*)port.ToUTF8()))
{
// try to open rig
Hamlib *hamlib = wxGetApp().m_hamlib;
bool status = hamlib->connect(rig, port.mb_str(wxConvUTF8), serial_rate, hexAddress);
if (status == false) {
wxMessageBox("Couldn't connect to Radio with Hamlib. Make sure the Hamlib serial Device, Rate, and Params match your radio",
wxT("Error"), wxOK | wxICON_ERROR, this);
return;
}
else {
wxString hamlib_serial_config;
hamlib_serial_config.sprintf(" %d, %d, %d",
hamlib->get_serial_rate(),
hamlib->get_data_bits(),
hamlib->get_stop_bits());
m_cbSerialParams->SetLabel(hamlib_serial_config);
}

// toggle PTT

wxString hamlibError;
if (hamlib->ptt(true, hamlibError) == false) {
wxMessageBox(wxString("Hamlib PTT Error: ") + hamlibError +
wxString(". Make sure the Hamlib serial Device, Rate, and Params match your radio"),
wxT("Error"), wxOK | wxICON_ERROR, this);
return;
}

wxSleep(1);
wxSleep(1);

if (hamlib->ptt(false, hamlibError) == false) {
wxMessageBox(wxString("Hamlib PTT Error: ") + hamlibError +
wxString(". Make sure the Hamlib serial Device, Rate, and Params match your radio"),
wxT("Error"), wxOK | wxICON_ERROR, this);
if (hamlib->ptt(false, hamlibError) == false) {
wxMessageBox(wxString("Hamlib PTT Error: ") + hamlibError +
wxString(". Make sure the Hamlib serial Device, Rate, and Params match your radio"),
wxT("Error"), wxOK | wxICON_ERROR, this);
}
}
}

Expand All @@ -611,29 +613,32 @@ void ComPortsDlg::OnTest(wxCommandEvent& event) {
if (g_verbose) fprintf(stderr, "opening serial port: ");
fputs(ctrlport.c_str(), stderr); // don't escape crazy Microsoft bakslash-ified comm port names
if (g_verbose) fprintf(stderr,"\n");

if (wxGetApp().CanAccessSerialPort((const char*)ctrlport.ToUTF8()))
{
bool success = serialport->openport(ctrlport.c_str(),
m_rbUseRTS->GetValue(),
m_ckRTSPos->IsChecked(),
m_rbUseDTR->GetValue(),
m_ckDTRPos->IsChecked());

bool success = serialport->openport(ctrlport.c_str(),
m_rbUseRTS->GetValue(),
m_ckRTSPos->IsChecked(),
m_rbUseDTR->GetValue(),
m_ckDTRPos->IsChecked());

if (g_verbose) fprintf(stderr, "serial port open\n");
if (g_verbose) fprintf(stderr, "serial port open\n");

if (!success) {
wxString errorMessage = "Couldn't open serial port " + ctrlport + ". This is likely due to not having permission to access the chosen port.";
wxMessageBox(errorMessage, wxT("Error"), wxOK | wxICON_ERROR, this);
}
if (!success) {
wxString errorMessage = "Couldn't open serial port " + ctrlport + ". This is likely due to not having permission to access the chosen port.";
wxMessageBox(errorMessage, wxT("Error"), wxOK | wxICON_ERROR, this);
}

// assert PTT port for 1 sec
// assert PTT port for 1 sec

serialport->ptt(true);
wxSleep(1);
serialport->ptt(false);
serialport->ptt(true);
wxSleep(1);
serialport->ptt(false);

if (g_verbose) fprintf(stderr, "closing serial port\n");
serialport->closeport();
if (g_verbose) fprintf(stderr, "serial port closed\n");
if (g_verbose) fprintf(stderr, "closing serial port\n");
serialport->closeport();
if (g_verbose) fprintf(stderr, "serial port closed\n");
}
}

}
Expand Down
12 changes: 10 additions & 2 deletions src/freedv_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ void FreeDVInterface::OnReliableTextRx_(reliable_text_t rt, const char* txt_ptr,
FreeDVInterface* obj = (FreeDVInterface*)state;
assert(obj != nullptr);

obj->receivedReliableText_ = txt_ptr;
{
std::unique_lock<std::mutex> lock(obj->reliableTextMutex_);
obj->receivedReliableText_ = txt_ptr;
}
reliable_text_reset(rt);
}

Expand Down Expand Up @@ -525,11 +528,16 @@ void FreeDVInterface::resetReliableText()
{
reliable_text_reset(rt);
}
receivedReliableText_ = "";

{
std::unique_lock<std::mutex> lock(reliableTextMutex_);
receivedReliableText_ = "";
}
}

const char* FreeDVInterface::getReliableText()
{
std::unique_lock<std::mutex> lock(reliableTextMutex_);
char* ret = new char[receivedReliableText_.size() + 1];
assert(ret != nullptr);

Expand Down
1 change: 1 addition & 0 deletions src/freedv_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class FreeDVInterface

std::deque<reliable_text_t> reliableText_;
std::string receivedReliableText_;
std::mutex reliableTextMutex_;

int preProcessRxFn_(ParallelStep* ps);
int postProcessRxFn_(ParallelStep* ps);
Expand Down
44 changes: 32 additions & 12 deletions src/hamlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Hamlib::Hamlib() :
m_currFreq(0),
m_currMode(RIG_MODE_USB),
m_vhfUhfMode(false),
pttSet_(false),
threadRunning_(false) {
/* Stop hamlib from spewing info to stderr. */
rig_set_debug(RIG_DEBUG_NONE);
Expand Down Expand Up @@ -220,20 +221,33 @@ bool Hamlib::ptt(bool press, wxString &hamlibError) {
if(!m_rig)
return false;

/* TODO(Joel): make ON_DATA and ON configurable. */

ptt_t on = press ? RIG_PTT_ON : RIG_PTT_OFF;

/* TODO(Joel): what should the VFO option be? */

int retcode = rig_set_ptt(m_rig, RIG_VFO_CURR, on);
if (g_verbose) fprintf(stderr,"Hamlib::ptt: rig_set_ptt returned: %d\n", retcode);
if (retcode != RIG_OK ) {
if (g_verbose) fprintf(stderr, "rig_set_ptt: error = %s \n", rigerror(retcode));
hamlibError = rigerror(retcode);
vfo_t currVfo = RIG_VFO_A;
int result = rig_get_vfo(m_rig, &currVfo);
if (result != RIG_OK && result != -RIG_ENAVAIL)
{
hamlibError = rigerror(result);
if (g_verbose) fprintf(stderr, "rig_get_vfo: error = %s \n", rigerror(result));
}

return retcode == RIG_OK;
else
{
result = rig_set_ptt(m_rig, currVfo, on);
if (g_verbose) fprintf(stderr,"Hamlib::ptt: rig_set_ptt returned: %d\n", result);
if (result != RIG_OK ) {
if (g_verbose) fprintf(stderr, "rig_set_ptt: error = %s \n", rigerror(result));
hamlibError = rigerror(result);
}
else
{
pttSet_ = press;
if (!press)
{
update_frequency_and_mode();
}
}
}

return result == RIG_OK;
}

int Hamlib::update_frequency_and_mode(void)
Expand Down Expand Up @@ -325,6 +339,12 @@ void Hamlib::statusUpdateThreadEntryFn_()

void Hamlib::update_from_hamlib_()
{
if (pttSet_)
{
// ignore Hamlib update when PTT active.
return;
}

rmode_t mode = RIG_MODE_NONE;
pbwidth_t passband = 0;
vfo_t currVfo = RIG_VFO_A;
Expand Down
1 change: 1 addition & 0 deletions src/hamlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Hamlib {
freq_t m_currFreq;
rmode_t m_currMode;
bool m_vhfUhfMode;
bool pttSet_;

// Data elements to support running Hamlib operations in a separate thread.
bool threadRunning_;
Expand Down
Loading

0 comments on commit c196ec7

Please sign in to comment.