Skip to content

Commit d0e7835

Browse files
committed
Enabel two features for newer Neo8m modules: set timepulse; enable galileo sat network together with gps and glonass
1 parent 150403e commit d0e7835

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

src/gps.cpp

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,20 @@ void Gps::configureGpsModule() {
212212
0x00, 0x00, 0x00, 0x00
213213
};
214214
sendAndWaitForAck(UBX_MSG::CFG_NAV5, UBX_CFG_NAV5, sizeof(UBX_CFG_NAV5));
215+
// on m8n enable all nav systems but baidou - baidou fails when used together with galileo
216+
const uint8_t UBX_CFG_GNSS[] = {
217+
0x00, 0x20, 0x20, 0x07, 0x00, 0x08, 0x10, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x03,
218+
0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x04, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x03, 0x08,
219+
0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05,
220+
0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x06, 0x08, 0x0e, 0x00, 0x01, 0x00, 0x01, 0x00
221+
} ;
222+
bool success = sendAndWaitForAck(UBX_MSG::CFG_GNSS, UBX_CFG_GNSS, sizeof(UBX_CFG_GNSS));
223+
if (success) {
224+
addStatisticsMessage("Successfully set GNSS");
225+
}
226+
else {
227+
addStatisticsMessage("GNSS not configured, likely older GPS");
228+
}
215229
#endif
216230
#ifdef UBX_M10
217231
sendCfgAndWaitForAck(UBX_CFG_LAYER::RAM, UBX_CFG_KEY_ID::CFG_NAVSPG_DYNMODEL, 4); // Set dynamic model to 4 (automotive)
@@ -226,7 +240,16 @@ void Gps::configureGpsModule() {
226240
0x01, 0x01, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00,
227241
0x00, 0x00, 0x00, 0x00
228242
};
229-
sendAndWaitForAck(UBX_MSG::CFG_TP, UBX_CFG_TP, sizeof(UBX_CFG_TP));
243+
success = sendAndWaitForAck(UBX_MSG::CFG_TP, UBX_CFG_TP, sizeof(UBX_CFG_TP));
244+
// newer gps (m8n) use tp5 for timepulse config
245+
if (!success) {
246+
const uint8_t UBX_CFG_TP5[] = { 0x00, 0x01, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x40, 0x42, 0x0f, 0x00, 0x40, 0x42, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00};
247+
if (!sendAndWaitForAck(UBX_MSG::CFG_TP5, UBX_CFG_TP5, sizeof(UBX_CFG_TP5))) {
248+
addStatisticsMessage("Successfully set timepulse for newer gps");
249+
} else {
250+
addStatisticsMessage("No ack for setting timepulse in either new or old format");
251+
}
252+
}
230253
#endif
231254

232255
#ifdef UBX_M6
@@ -1026,7 +1049,7 @@ void Gps::parseUbxMessage() {
10261049
break;
10271050
case (uint16_t) UBX_MSG::ACK_NAK: {
10281051
if (mLastAckMsgId != 0) {
1029-
log_e("ACK overrun had ack: %d for 0x%04x", mAckReceived, mLastAckMsgId);
1052+
log_e("ACK-NAK overrun had ack: %d for 0x%04x", mAckReceived, mLastAckMsgId);
10301053
}
10311054
log_e("ACK-NAK 0x%04x", mGpsBuffer.ack.ubxMsgId);
10321055
mAckReceived = false;
@@ -1260,7 +1283,10 @@ void Gps::parseUbxMessage() {
12601283
log_d("CFG_SBAS");
12611284
break;
12621285
case (uint16_t) UBX_MSG::CFG_NAV5:
1263-
log_d("CFG_SBAS");
1286+
log_d("CFG_NAV5");
1287+
break;
1288+
case (uint16_t) UBX_MSG::CFG_GNSS:
1289+
log_d("CFG_GNSS");
12641290
break;
12651291
default:
12661292
log_e("Got UBX_MESSAGE! Id: 0x%04x Len %d iTOW %d", mGpsBuffer.ubxHeader.ubxMsgId,
@@ -1288,7 +1314,7 @@ void Gps::handleUbxNavTimeGps(const GpsBuffer::UbxNavTimeGps &message, const uin
12881314
mIncomingGpsRecord.setWeek(mLastGpsWeek);
12891315
}
12901316
if ((message.valid & 0x03) == 0x03 // WEEK && TOW
1291-
&& delayMs < 200 // FIXME: needs to be lower once we have multi GPS versions support 20
1317+
&& delayMs < 80
12921318
&& message.tAcc < (20 * 1000 * 1000 /* 20ms */)
12931319
&& (mLastTimeTimeSet == 0
12941320
|| (mLastTimeTimeSet + (2 * 60 * 1000 /* 2 minutes */)) < receivedMs)) {

src/gps.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,10 @@ class Gps {
160160
CFG_VALSET = 0x8a06, // Only available in M10
161161
CFG_RST = 0x0406,
162162
CFG_TP = 0x0706,
163+
CFG_TP5 = 0x3106,
164+
163165
CFG_CFG = 0x0906,
166+
CFG_GNSS = 0x3e06,
164167
CFG_SBAS = 0x1606,
165168
CFG_NAVX5 = 0x2306,
166169
CFG_NAV5 = 0x2406,

0 commit comments

Comments
 (0)