Skip to content

Commit 40eac72

Browse files
committed
differentiate between Neo6m and newer dialects for MON_HW
1 parent 434aacd commit 40eac72

2 files changed

Lines changed: 56 additions & 11 deletions

File tree

src/gps.cpp

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,18 +1181,33 @@ void Gps::parseUbxMessage() {
11811181
break;
11821182
case (uint16_t) UBX_MSG::MON_HW: {
11831183
const char* aStatus;
1184-
switch (mGpsBuffer.monHw.aStatus) {
1185-
case mGpsBuffer.monHw.INIT: aStatus = "init"; break;
1186-
case mGpsBuffer.monHw.DONTKNOW: aStatus = "?"; break;
1187-
case mGpsBuffer.monHw.OK: aStatus = "ok"; break;
1188-
case mGpsBuffer.monHw.SHORT: aStatus = "short"; break;
1189-
case mGpsBuffer.monHw.OPEN: aStatus = "open"; break;
1190-
default: aStatus = "invalid";
1184+
if (is_neo6()) {
1185+
switch (mGpsBuffer.monHw.aStatus) {
1186+
case mGpsBuffer.monHw.INIT: aStatus = "init"; break;
1187+
case mGpsBuffer.monHw.DONTKNOW: aStatus = "?"; break;
1188+
case mGpsBuffer.monHw.OK: aStatus = "ok"; break;
1189+
case mGpsBuffer.monHw.SHORT: aStatus = "short"; break;
1190+
case mGpsBuffer.monHw.OPEN: aStatus = "open"; break;
1191+
default: aStatus = "invalid";
1192+
}
1193+
log_d("MON-HW Antenna Status %d %s, Antenna Power %d, Gain (0-8191) %d, noise level %d", mGpsBuffer.monHw.aStatus, aStatus, mGpsBuffer.monHw.aPower, mGpsBuffer.monHw.agcCnt, mGpsBuffer.monHw.noisePerMs);
1194+
mLastNoiseLevel = mGpsBuffer.monHw.noisePerMs;
1195+
mLastGain = mGpsBuffer.monHw.agcCnt;
1196+
mLastJamInd = mGpsBuffer.monHw.jamInd;
1197+
} else {
1198+
switch (mGpsBuffer.monHwNew.aStatus) {
1199+
case mGpsBuffer.monHwNew.INIT: aStatus = "init"; break;
1200+
case mGpsBuffer.monHwNew.DONTKNOW: aStatus = "?"; break;
1201+
case mGpsBuffer.monHwNew.OK: aStatus = "ok"; break;
1202+
case mGpsBuffer.monHwNew.SHORT: aStatus = "short"; break;
1203+
case mGpsBuffer.monHwNew.OPEN: aStatus = "open"; break;
1204+
default: aStatus = "invalid";
1205+
}
1206+
log_d("MON-HW Antenna Status %d %s, Antenna Power %d, Gain (0-8191) %d, noise level %d", mGpsBuffer.monHwNew.aStatus, aStatus, mGpsBuffer.monHwNew.aPower, mGpsBuffer.monHwNew.agcCnt, mGpsBuffer.monHwNew.noisePerMs);
1207+
mLastNoiseLevel = mGpsBuffer.monHwNew.noisePerMs;
1208+
mLastGain = mGpsBuffer.monHwNew.agcCnt;
1209+
mLastJamInd = mGpsBuffer.monHwNew.jamInd;
11911210
}
1192-
log_d("MON-HW Antenna Status %d %s, Antenna Power %d, Gain (0-8191) %d, noise level %d", mGpsBuffer.monHw.aStatus, aStatus, mGpsBuffer.monHw.aPower, mGpsBuffer.monHw.agcCnt, mGpsBuffer.monHw.noisePerMs);
1193-
mLastNoiseLevel = mGpsBuffer.monHw.noisePerMs;
1194-
mLastGain = mGpsBuffer.monHw.agcCnt;
1195-
mLastJamInd = mGpsBuffer.monHw.jamInd;
11961211
}
11971212
break;
11981213
case (uint16_t) UBX_MSG::NAV_STATUS: {

src/gps.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,36 @@ class Gps {
320320
uint32_t pinIrq;
321321
uint32_t pullH;
322322
uint32_t pullL;
323+
} monHwNew;
324+
struct __attribute__((__packed__)) {
325+
UBX_HEADER ubxHeader;
326+
uint32_t pinSel;
327+
uint32_t pinBank;
328+
uint32_t pinDir;
329+
uint32_t pinVal;
330+
uint16_t noisePerMs;
331+
uint16_t agcCnt; // AGC (Automatic Gain Control) Monitor, as percentage of maximum gain,range 0 to 8191 (100%)
332+
enum ANT_STATUS : uint8_t {
333+
INIT = 0,
334+
DONTKNOW = 1,
335+
OK = 2,
336+
SHORT = 3,
337+
OPEN = 4,
338+
} aStatus;
339+
enum ANT_POWER : uint8_t {
340+
OFF = 0,
341+
ON = 1,
342+
POWER_DONTKNOW = 2,
343+
} aPower;
344+
uint8_t flags;
345+
uint8_t reserved1;
346+
uint32_t usedMask;
347+
uint8_t vp[25];
348+
uint8_t jamInd;
349+
uint16_t reserved3;
350+
uint32_t pinIrq;
351+
uint32_t pullH;
352+
uint32_t pullL;
323353
} monHw;
324354
struct __attribute__((__packed__)) {
325355
UBX_HEADER ubxHeader;

0 commit comments

Comments
 (0)