Skip to content

Commit

Permalink
GPS: Threading Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Oct 25, 2024
1 parent 61d37c0 commit 5724122
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/GPS/GPSProvider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,16 @@ GPSProvider::GPSProvider(const QString &device, GPSType type, const rtk_data_s &
, _type(type)
, _requestStop(requestStop)
, _rtkData(rtkData)
, _serial(new QSerialPort(this))
{
// qCDebug(GPSProviderLog) << Q_FUNC_INFO << this;

qCDebug(GPSProviderLog) << QString("Survey in accuracy: %1 | duration: %2").arg(_rtkData.surveyInAccMeters).arg(_rtkData.surveyInDurationSecs);

_serial->setPortName(_device);
}

GPSProvider::~GPSProvider()
{
delete _serial;

// qCDebug(GPSProviderLog) << Q_FUNC_INFO << this;
}

Expand Down Expand Up @@ -169,11 +168,16 @@ void GPSProvider::run()
delete gpsDriver;
gpsDriver = nullptr;

delete _serial;
_serial = nullptr;

qCDebug(GPSProviderLog) << Q_FUNC_INFO << "Exiting GPS thread";
}

bool GPSProvider::_connectSerial()
{
_serial = new QSerialPort();
_serial->setPortName(_device);
if (!_serial->open(QIODevice::ReadWrite)) {
// Give the device some time to come up. In some cases the device is not
// immediately accessible right after startup for some reason. This can take 10-20s.
Expand Down

0 comments on commit 5724122

Please sign in to comment.