Skip to content

Commit 8a31a59

Browse files
committed
Add mosaic antenna short / open detection
1 parent c34fc46 commit 8a31a59

File tree

8 files changed

+126
-28
lines changed

8 files changed

+126
-28
lines changed

Firmware/RTK_Everywhere/Developer.ino

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -298,18 +298,6 @@ void lg290pReset() {}
298298

299299
#ifndef COMPILE_ZED
300300

301-
// MON HW Antenna Status
302-
enum sfe_ublox_antenna_status_e
303-
{
304-
SFE_UBLOX_ANTENNA_STATUS_INIT,
305-
SFE_UBLOX_ANTENNA_STATUS_DONTKNOW,
306-
SFE_UBLOX_ANTENNA_STATUS_OK,
307-
SFE_UBLOX_ANTENNA_STATUS_SHORT,
308-
SFE_UBLOX_ANTENNA_STATUS_OPEN
309-
};
310-
311-
uint8_t aStatus = SFE_UBLOX_ANTENNA_STATUS_DONTKNOW;
312-
313301
// void checkRXMCOR() {}
314302
// void pushRXMPMP() {}
315303
void convertGnssTimeToEpoch(uint32_t *epochSecs, uint32_t *epochMicros) {

Firmware/RTK_Everywhere/Display.ino

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,7 +1575,7 @@ void displayBatteryVsEthernet(std::vector<iconPropertyBlinking> *iconList)
15751575

15761576
void displaySivVsOpenShort(std::vector<iconPropertyBlinking> *iconList)
15771577
{
1578-
if (present.antennaShortOpen == false)
1578+
if (gnss->supportsAntennaShortOpen() == false)
15791579
{
15801580
displayCoords textCoords = paintSIVIcon(iconList, nullptr, 0b11111111);
15811581
paintSIVText(textCoords);
@@ -1584,11 +1584,11 @@ void displaySivVsOpenShort(std::vector<iconPropertyBlinking> *iconList)
15841584
{
15851585
displayCoords textCoords;
15861586

1587-
if (aStatus == SFE_UBLOX_ANTENNA_STATUS_SHORT)
1587+
if (gnss->isAntennaShorted())
15881588
{
15891589
textCoords = paintSIVIcon(iconList, &ShortIconProperties, 0b01010101);
15901590
}
1591-
else if (aStatus == SFE_UBLOX_ANTENNA_STATUS_OPEN)
1591+
else if (gnss->isAntennaOpen())
15921592
{
15931593
textCoords = paintSIVIcon(iconList, &OpenIconProperties, 0b01010101);
15941594
}
@@ -1846,19 +1846,19 @@ void paintBaseTempSurveyStarted(std::vector<iconPropertyBlinking> *iconList)
18461846
xPos = SIVIconProperties.iconDisplay[present.display_type].xPos;
18471847
yPos = SIVIconProperties.iconDisplay[present.display_type].yPos;
18481848

1849-
if (present.antennaShortOpen == false)
1849+
if (gnss->supportsAntennaShortOpen() == false)
18501850
{
18511851
oled->setCursor((uint8_t)((int)xPos + SIVTextStartXPosOffset[present.display_type]), yPos + 4); // x, y
18521852
oled->setFont(QW_FONT_5X7);
18531853
oled->print("Time:");
18541854
}
18551855
else
18561856
{
1857-
if (aStatus == SFE_UBLOX_ANTENNA_STATUS_SHORT)
1857+
if (gnss->isAntennaShorted())
18581858
{
18591859
paintSIVIcon(iconList, &ShortIconProperties, 0b01010101);
18601860
}
1861-
else if (aStatus == SFE_UBLOX_ANTENNA_STATUS_OPEN)
1861+
else if (gnss->isAntennaOpen())
18621862
{
18631863
paintSIVIcon(iconList, &OpenIconProperties, 0b01010101);
18641864
}
@@ -1914,19 +1914,19 @@ void paintRTCM(std::vector<iconPropertyBlinking> *iconList)
19141914
xPos = SIVIconProperties.iconDisplay[present.display_type].xPos;
19151915
yPos = SIVIconProperties.iconDisplay[present.display_type].yPos;
19161916

1917-
if (present.antennaShortOpen == false)
1917+
if (gnss->supportsAntennaShortOpen() == false)
19181918
{
19191919
oled->setCursor((uint8_t)((int)xPos + SIVTextStartXPosOffset[present.display_type]), yPos + 4); // x, y
19201920
oled->setFont(QW_FONT_5X7);
19211921
oled->print("RTCM:");
19221922
}
19231923
else
19241924
{
1925-
if (aStatus == SFE_UBLOX_ANTENNA_STATUS_SHORT)
1925+
if (gnss->isAntennaShorted())
19261926
{
19271927
paintSIVIcon(iconList, &ShortIconProperties, 0b01010101);
19281928
}
1929-
else if (aStatus == SFE_UBLOX_ANTENNA_STATUS_OPEN)
1929+
else if (gnss->isAntennaOpen())
19301930
{
19311931
paintSIVIcon(iconList, &OpenIconProperties, 0b01010101);
19321932
}

Firmware/RTK_Everywhere/GNSS.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ class GNSS
238238
// Returns full year, ie 2023, not 23.
239239
virtual uint16_t getYear();
240240

241+
// Antenna Short / Open detection
242+
virtual bool isAntennaShorted();
243+
virtual bool isAntennaOpen();
244+
241245
virtual bool isBlocking();
242246

243247
// Date is confirmed once we have GNSS fix
@@ -374,6 +378,9 @@ class GNSS
374378

375379
virtual bool standby();
376380

381+
// Antenna Short / Open detection
382+
virtual bool supportsAntennaShortOpen();
383+
377384
// Reset the survey-in operation
378385
// Outputs:
379386
// Returns true if the survey-in operation was reset successfully

Firmware/RTK_Everywhere/GNSS.ino

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ float GNSS::getSurveyInStartingAccuracy()
4343
return (settings.surveyInStartingAccuracy);
4444
}
4545

46+
//----------------------------------------
47+
// Returns true if the antenna is shorted
48+
//----------------------------------------
49+
bool GNSS::isAntennaShorted() { return false; }
50+
51+
//----------------------------------------
52+
// Returns true if the antenna is shorted
53+
//----------------------------------------
54+
bool GNSS::isAntennaOpen() { return false; }
55+
4656
//----------------------------------------
4757
// Set the minimum satellite signal level for navigation.
4858
//----------------------------------------
@@ -55,6 +65,12 @@ bool GNSS::setMinCno(uint8_t cnoValue)
5565
return gnss->setMinCnoRadio(cnoValue);
5666
}
5767

68+
// Antenna Short / Open detection
69+
bool GNSS::supportsAntennaShortOpen()
70+
{
71+
return false;
72+
}
73+
5874
// Periodically push GGA sentence over NTRIP Client, to Caster, if enabled
5975
void pushGPGGA(char *ggaData)
6076
{

Firmware/RTK_Everywhere/GNSS_Mosaic.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ typedef struct {
1919
const mosaicExpectedID mosaicExpectedIDs[] = {
2020
{ 4007, true, 96, "PVTGeodetic" },
2121
{ 4013, false, 0, "ChannelStatus" },
22+
{ 4014, false, 0, "ReceiverStatus" },
2223
{ 4059, false, 0, "DiskStatus" },
2324
{ 4090, false, 0, "InputLink" },
2425
{ 4097, false, 0, "EncapsulatedOutput" },
@@ -48,7 +49,7 @@ const mosaicExpectedID mosaicExpectedIDs[] = {
4849
// This indicates if RTCM corrections are being received - on COM2
4950
#define MOSAIC_SBF_INPUTLINK_STREAM (MOSAIC_SBF_EXTEVENT_STREAM + 1)
5051

51-
// Output SBF ChannelStatus and DiskStatus messages on this stream - on COM1 only
52+
// Output SBF ChannelStatus, ReceiverStatus and DiskStatus messages on this stream - on COM1 only
5253
// ChannelStatus provides the count of satellites being tracked
5354
// DiskStatus provides the disk usage
5455
#define MOSAIC_SBF_STATUS_STREAM (MOSAIC_SBF_INPUTLINK_STREAM + 1)
@@ -561,7 +562,9 @@ class GNSS_MOSAIC : GNSS
561562

562563
// These globals are updated regularly via the SBF parser
563564
double _clkBias_ms; // PVTGeodetic RxClkBias (will be sawtooth unless clock steering is enabled)
564-
bool _determiningFixedPosition; // PVTGeodetic Mode Bit 6
565+
bool _determiningFixedPosition; // PVTGeodetic Mode Bit 6
566+
bool _antennaIsOpen; // ReceiverStatus RxState Bit 1 ACTIVEANTENNA indicates antenna current draw
567+
bool _antennaIsShorted; // ReceiverStatus RxError Bit 5 ANTENNA indicates antenna overcurrent
565568

566569
// Record NrBytesReceived so we can tell if Radio Ext (COM2) is receiving correction data.
567570
// On the mosaic, we know that InputLink will arrive at 1Hz. But on the ZED, UBX-MON-COMMS
@@ -598,6 +601,7 @@ class GNSS_MOSAIC : GNSS
598601
GNSS_MOSAIC() : _determiningFixedPosition(true), _clkBias_ms(0),
599602
_latStdDev(999.9), _lonStdDev(999.9), _receiverSetupSeen(false),
600603
_radioExtBytesReceived_millis(0), _diskStatusSeen(false),
604+
_antennaIsOpen(false), _antennaIsShorted(false),
601605
GNSS()
602606
{
603607
svInTracking.clear();
@@ -816,6 +820,10 @@ class GNSS_MOSAIC : GNSS
816820
// Currently the only two modes are Rover or Base
817821
bool inRoverMode();
818822

823+
// Antenna Short / Open detection
824+
bool isAntennaShorted();
825+
bool isAntennaOpen();
826+
819827
bool isBlocking();
820828

821829
// Date is confirmed once we have GNSS fix
@@ -1054,6 +1062,9 @@ class GNSS_MOSAIC : GNSS
10541062
// Save the data from the SBF Block 4013
10551063
void storeBlock4013(SEMP_PARSE_STATE *parse);
10561064

1065+
// Save the data from the SBF Block 4014
1066+
void storeBlock4014(SEMP_PARSE_STATE *parse);
1067+
10571068
// Save the data from the SBF Block 4059
10581069
void storeBlock4059(SEMP_PARSE_STATE *parse);
10591070

@@ -1063,6 +1074,9 @@ class GNSS_MOSAIC : GNSS
10631074
// Save the data from the SBF Block 5914
10641075
void storeBlock5914(SEMP_PARSE_STATE *parse);
10651076

1077+
// Antenna Short / Open detection
1078+
bool supportsAntennaShortOpen();
1079+
10661080
// Reset the survey-in operation
10671081
// Outputs:
10681082
// Returns true if the survey-in operation was reset successfully

Firmware/RTK_Everywhere/GNSS_Mosaic.ino

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,10 +582,10 @@ bool GNSS_MOSAIC::configureOnce()
582582
setting = String("sso,Stream" + String(MOSAIC_SBF_INPUTLINK_STREAM) + ",COM1,InputLink,sec1\n\r");
583583
response &= sendWithResponse(setting, "SBFOutput");
584584

585-
// Output SBF ChannelStatus and DiskStatus on their own stream - at 0.5Hz - on COM1 only
585+
// Output SBF ChannelStatus, ReceiverStatus and DiskStatus on their own stream - at 0.5Hz - on COM1 only
586586
// For ChannelStatus: OnChange is too often. The message is typically 1000 bytes in size.
587587
// For DiskStatus: DiskUsage is slow to update. 0.5Hz is plenty fast enough.
588-
setting = String("sso,Stream" + String(MOSAIC_SBF_STATUS_STREAM) + ",COM1,ChannelStatus+DiskStatus,sec2\n\r");
588+
setting = String("sso,Stream" + String(MOSAIC_SBF_STATUS_STREAM) + ",COM1,ChannelStatus+ReceiverStatus+DiskStatus,sec2\n\r");
589589
response &= sendWithResponse(setting, "SBFOutput");
590590

591591
// Mark L5 as healthy
@@ -1511,6 +1511,22 @@ bool GNSS_MOSAIC::inRoverMode()
15111511
return (true); // Default to Rover
15121512
}
15131513

1514+
//----------------------------------------
1515+
// Returns true if the antenna is shorted
1516+
//----------------------------------------
1517+
bool GNSS_MOSAIC::isAntennaShorted()
1518+
{
1519+
return _antennaIsShorted;
1520+
}
1521+
1522+
//----------------------------------------
1523+
// Returns true if the antenna is shorted
1524+
//----------------------------------------
1525+
bool GNSS_MOSAIC::isAntennaOpen()
1526+
{
1527+
return _antennaIsOpen;
1528+
}
1529+
15141530
//----------------------------------------
15151531
bool GNSS_MOSAIC::isBlocking()
15161532
{
@@ -2539,6 +2555,22 @@ void GNSS_MOSAIC::storeBlock4013(SEMP_PARSE_STATE *parse)
25392555

25402556
}
25412557

2558+
//----------------------------------------
2559+
// Save the data from the SBF Block 4014
2560+
//----------------------------------------
2561+
void GNSS_MOSAIC::storeBlock4014(SEMP_PARSE_STATE *parse)
2562+
{
2563+
uint16_t N = (uint16_t)sempSbfGetU1(parse, 14);
2564+
uint32_t RxState = (uint16_t)sempSbfGetU4(parse, 20);
2565+
uint32_t RxError = (uint16_t)sempSbfGetU4(parse, 24);
2566+
2567+
_antennaIsShorted = ((RxError >> 5) & 0x1) == 0x1;
2568+
if (_antennaIsShorted)
2569+
_antennaIsOpen = false; // Shorted has priority
2570+
else
2571+
_antennaIsOpen = ((RxState >> 1) & 0x1) == 0x0;
2572+
}
2573+
25422574
//----------------------------------------
25432575
// Save the data from the SBF Block 4059
25442576
//----------------------------------------
@@ -2621,6 +2653,12 @@ void GNSS_MOSAIC::storeBlock5914(SEMP_PARSE_STATE *parse)
26212653
_leapSeconds = sempSbfGetU1(parse, 20);
26222654
}
26232655

2656+
// Antenna Short / Open detection
2657+
bool GNSS_MOSAIC::supportsAntennaShortOpen()
2658+
{
2659+
return true;
2660+
}
2661+
26242662
//----------------------------------------
26252663
// Reset the survey-in operation
26262664
// Outputs:
@@ -2927,6 +2965,10 @@ void processUart1SBF(SEMP_PARSE_STATE *parse, uint16_t type)
29272965
if (sempSbfGetBlockNumber(parse) == 4013)
29282966
mosaic->storeBlock4013(parse);
29292967

2968+
// If this is ReceiverStatus, extract some data
2969+
if (sempSbfGetBlockNumber(parse) == 4014)
2970+
mosaic->storeBlock4014(parse);
2971+
29302972
// If this is DiskStatus, extract some data
29312973
if (sempSbfGetBlockNumber(parse) == 4059)
29322974
mosaic->storeBlock4059(parse);

Firmware/RTK_Everywhere/GNSS_ZED.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ GNSS_ZED.h
1111

1212
#include <SparkFun_u-blox_GNSS_v3.h> //http://librarymanager/All#SparkFun_u-blox_GNSS_v3
1313

14-
uint8_t aStatus = SFE_UBLOX_ANTENNA_STATUS_DONTKNOW;
15-
1614
// Each constellation will have its config key, enable, and a visible name
1715
typedef struct
1816
{
@@ -385,6 +383,8 @@ class GNSS_ZED : GNSS
385383
{
386384
}
387385

386+
uint8_t aStatus = SFE_UBLOX_ANTENNA_STATUS_DONTKNOW;
387+
388388
// If we have decryption keys, configure module
389389
// Note: don't check online.lband_neo here. We could be using ip corrections
390390
void applyPointPerfectKeys();
@@ -570,6 +570,10 @@ class GNSS_ZED : GNSS
570570
// Returns full year, ie 2023, not 23.
571571
uint16_t getYear();
572572

573+
// Antenna Short / Open detection
574+
bool isAntennaShorted();
575+
bool isAntennaOpen();
576+
573577
bool isBlocking();
574578

575579
// Date is confirmed once we have GNSS fix
@@ -736,6 +740,9 @@ class GNSS_ZED : GNSS
736740
// Callback to store MON-COMMS information
737741
void storeMONCOMMSdataRadio(UBX_MON_COMMS_data_t *ubxDataStruct);
738742

743+
// Antenna Short / Open detection
744+
bool supportsAntennaShortOpen();
745+
739746
// Reset the survey-in operation
740747
// Outputs:
741748
// Returns true if the survey-in operation was reset successfully

Firmware/RTK_Everywhere/GNSS_ZED.ino

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1423,6 +1423,22 @@ uint16_t GNSS_ZED::getYear()
14231423
return (_year);
14241424
}
14251425

1426+
//----------------------------------------
1427+
// Returns true if the antenna is shorted
1428+
//----------------------------------------
1429+
bool GNSS_ZED::isAntennaShorted()
1430+
{
1431+
return (aStatus == SFE_UBLOX_ANTENNA_STATUS_SHORT);
1432+
}
1433+
1434+
//----------------------------------------
1435+
// Returns true if the antenna is shorted
1436+
//----------------------------------------
1437+
bool GNSS_ZED::isAntennaOpen()
1438+
{
1439+
return (aStatus == SFE_UBLOX_ANTENNA_STATUS_OPEN);
1440+
}
1441+
14261442
//----------------------------------------
14271443
bool GNSS_ZED::isBlocking()
14281444
{
@@ -2484,7 +2500,9 @@ void GNSS_ZED::storeHPdataRadio(UBX_NAV_HPPOSLLH_data_t *ubxDataStruct)
24842500
//----------------------------------------
24852501
void storeMONHWdata(UBX_MON_HW_data_t *ubxDataStruct)
24862502
{
2487-
aStatus = ubxDataStruct->aStatus;
2503+
GNSS_ZED *zed = (GNSS_ZED *)gnss;
2504+
2505+
zed->aStatus = ubxDataStruct->aStatus;
24882506
}
24892507

24902508
//----------------------------------------
@@ -2627,6 +2645,12 @@ void storeTIMTPdata(UBX_TIM_TP_data_t *ubxDataStruct)
26272645
timTpUpdated = true;
26282646
}
26292647

2648+
// Antenna Short / Open detection
2649+
bool GNSS_ZED::supportsAntennaShortOpen()
2650+
{
2651+
return present.antennaShortOpen;
2652+
}
2653+
26302654
//----------------------------------------
26312655
// Slightly modified method for restarting survey-in from:
26322656
// https://portal.u-blox.com/s/question/0D52p00009IsVoMCAV/restarting-surveyin-on-an-f9p

0 commit comments

Comments
 (0)