1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

XTRX: refactored GPS lock test using workaround using change in 1PPS iterval clock counts. Fixes hanging for 1PPS signal

This commit is contained in:
f4exb 2019-01-20 00:52:57 +01:00
parent 989dbc28b6
commit 5ad63b7376
2 changed files with 35 additions and 5 deletions

View File

@ -31,9 +31,11 @@ DeviceXTRXShared::DeviceXTRXShared() :
m_channel(-1), m_channel(-1),
m_source(0), m_source(0),
m_sink(0), m_sink(0),
m_thread(0), m_thread(0),
m_threadWasRunning(false) m_threadWasRunning(false),
m_first_1pps_count(true),
m_last_1pps_count(0),
m_no_1pps_count_change_counter(0)
{} {}
DeviceXTRXShared::~DeviceXTRXShared() DeviceXTRXShared::~DeviceXTRXShared()
@ -56,11 +58,34 @@ bool DeviceXTRXShared::get_gps_status()
{ {
uint64_t val = 0; uint64_t val = 0;
int res = xtrx_val_get(m_dev->getDevice(), XTRX_TRX, XTRX_CH_AB, XTRX_WAIT_1PPS, &val); int res = xtrx_val_get(m_dev->getDevice(), (xtrx_direction_t) 0, XTRX_CH_AB, XTRX_OSC_LATCH_1PPS, &val);
if (res) { if (res)
{
return false; return false;
} }
else
{
if (m_first_1pps_count)
{
m_last_1pps_count = val;
m_first_1pps_count = false;
}
else
{
if (m_last_1pps_count != val)
{
m_no_1pps_count_change_counter = 7;
m_last_1pps_count = val;
}
else if (m_no_1pps_count_change_counter != 0)
{
m_no_1pps_count_change_counter--;
}
return val != 0; }
//qDebug("DeviceXTRXShared::get_gps_status: XTRX_OSC_LATCH_1PPS: %lu %u", val, m_no_1pps_count_change_counter);
return m_no_1pps_count_change_counter != 0;
}
} }

View File

@ -148,6 +148,11 @@ public:
double get_board_temperature(); double get_board_temperature();
bool get_gps_status(); bool get_gps_status();
private:
bool m_first_1pps_count;
uint64_t m_last_1pps_count;
uint32_t m_no_1pps_count_change_counter;
}; };
#endif /* DEVICES_LIMESDR_DEVICELIMESDRSHARED_H_ */ #endif /* DEVICES_LIMESDR_DEVICELIMESDRSHARED_H_ */