Skip to content

Commit b786d33

Browse files
committed
GPSDR++ V1.0.6
Add "Sync to 24MHz" option on GPS side page. GPS postion fixing will no longer cause freezing with this option turned OFF.
1 parent 9465915 commit b786d33

File tree

7 files changed

+42
-15
lines changed

7 files changed

+42
-15
lines changed

core/src/core.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ int gpsdrpp_main(int argc, char* argv[]) {
150150
return 0;
151151
}
152152

153-
// Tell GPS to output 24MHz timepulse, align to UTC if possible
154-
core::gps.sendData((unsigned char *)Gps::UBX_CFG_TP5, Gps::UBX_CFG_TP5_SIZE);
153+
// Tell GPS to output 24MHz timepulse
154+
core::gps.outputReferenceClock(false);
155155

156156
bool serverMode = (bool)core::args["server"];
157157

@@ -205,6 +205,9 @@ int gpsdrpp_main(int argc, char* argv[]) {
205205
// Side Bar
206206
defConfig["selectedPage"] = 0;
207207

208+
// GPS Page
209+
defConfig["lockToGpsFreq"] = false;
210+
208211
// CLK OUT Page
209212
defConfig["clkOut"] = true;
210213
defConfig["reg58"] = 0;

core/src/dev_refresh_worker.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ void DeviceRefreshWorker::workerLoop() {
5151
executeCommand("vgp set 4B2 0");
5252
delay(500);
5353

54-
// Tell GPS to output 24MHz
55-
try {
56-
core::gps.sendData((unsigned char *)Gps::UBX_CFG_TP5, Gps::UBX_CFG_TP5_SIZE);
57-
} catch (const std::exception& e) {
58-
std::cerr << "GPS sendData failed: " << e.what() << std::endl;
59-
}
60-
61-
delay(500);
54+
// Tell GPS to output 24MHz
55+
core::configManager.acquire();
56+
bool lockToGpsFreq = core::configManager.conf["lockToGpsFreq"];
57+
core::configManager.release(true);
58+
if (lockToGpsFreq) {
59+
core::gps.outputReferenceClock(lockToGpsFreq);
60+
}
61+
delay(500);
6262

6363
// Initialize Si5351
6464
try {

core/src/gps.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,4 +581,8 @@ void Gps::readerLoop() {
581581

582582
int32_t Gps::getProcessedNMEA() {
583583
return processedNMEA;
584+
}
585+
586+
void Gps::outputReferenceClock(bool lockToGpsFreq) {
587+
sendData((unsigned char *)(lockToGpsFreq ? UBX_CFG_TP5 : UBX_CFG_TP5_NO_SYNC), UBX_CFG_TP5_SIZE);
584588
}

core/src/gps.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,14 @@ class Gps {
6868
0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
6969
0x00, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x43, 0x50
7070
};
71-
71+
static constexpr unsigned char UBX_CFG_TP5_NO_SYNC[40] = {
72+
0xB5, 0x62, 0x06, 0x31, 0x20, 0x00, 0x00, 0x01,
73+
0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x36,
74+
0x6E, 0x01, 0x00, 0x36, 0x6E, 0x01, 0x00, 0x00,
75+
0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
76+
0x00, 0x00, 0x6D, 0x00, 0x00, 0x00, 0xC1, 0xC8
77+
};
78+
7279
uint8_t getUtcHour();
7380
uint8_t getUtcMinute();
7481
uint8_t getUtcSecond();
@@ -80,6 +87,8 @@ class Gps {
8087
uint8_t getFixQuality();
8188
uint8_t getUsedSatellites();
8289

90+
void outputReferenceClock(bool lockToGpsFreq);
91+
8392
int32_t processedNMEA = 0;
8493
std::vector<Satellite> getSatellites();
8594

core/src/gui/widgets/gps_page.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,26 @@ const char* GPSPage::getLabel() {
3131
}
3232

3333
void GPSPage::init() {
34-
34+
core::configManager.acquire();
35+
lockToGpsFreq = core::configManager.conf["lockToGpsFreq"];
36+
core::configManager.release(true);
37+
if (lockToGpsFreq) {
38+
core::gps.outputReferenceClock(lockToGpsFreq);
39+
}
3540
}
3641

3742
void GPSPage::deinit() {
38-
43+
core::configManager.acquire();
44+
core::configManager.conf["lockToGpsFreq"] = lockToGpsFreq;
45+
core::configManager.release(true);
3946
}
4047

4148
void GPSPage::draw() {
4249
const float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing() + 10;
4350
if (ImGui::BeginChild("GPS_Content", ImVec2(0, -footer_height_to_reserve), true)) {
51+
if (ImGui::Checkbox("Sync to 24MHz", &lockToGpsFreq)) {
52+
core::gps.outputReferenceClock(lockToGpsFreq);
53+
}
4454
ImGui::Text("Status: ");
4555
ImGui::SameLine();
4656
if (core::gps.getFixQuality() != 0) {

core/src/gui/widgets/gps_page.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class GPSPage : public SideBar::SidePage {
2121

2222
private:
2323
void drawSatelliteTable();
24-
24+
25+
bool lockToGpsFreq = false;
2526
LoadingAnimation loader;
2627
};

core/src/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#pragma once
22

3-
#define VERSION_STR "1.0.5"
3+
#define VERSION_STR "1.0.6"

0 commit comments

Comments
 (0)