Skip to content

Commit 208f020

Browse files
authored
Merge pull request #439 from sparkfun/Add_Ref_Stn_Ethernet
Add antenna short / open detection. Fix warning in Form.ino
2 parents 4b6ebbd + 2ee2fa1 commit 208f020

File tree

8 files changed

+194
-16
lines changed

8 files changed

+194
-16
lines changed

.github/workflows/compile-rtk-firmware.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
7272
7373
74-
"SparkFun u-blox GNSS v3"@3.0.8
74+
"SparkFun u-blox GNSS v3"@3.0.9
7575
"SparkFun MAX1704x Fuel Gauge Arduino Library"@1.0.4
7676
"SparkFun LIS2DH12 Arduino Library"@1.0.3
7777
"ESP32-OTA-Pull"@1.0.0

Firmware/RTK_Surveyor/Begin.ino

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,23 @@ void configureGNSS()
754754
if (HAS_GNSS_TP_INT)
755755
theGNSS.setAutoTIMTPcallbackPtr(&storeTIMTPdata); //Enable automatic TIM TP messages with callback to storeTIMTPdata
756756

757+
if (HAS_ANTENNA_SHORT_OPEN)
758+
{
759+
theGNSS.newCfgValset();
760+
761+
theGNSS.addCfgValset(UBLOX_CFG_HW_ANT_CFG_SHORTDET, 1); // Enable antenna short detection
762+
theGNSS.addCfgValset(UBLOX_CFG_HW_ANT_CFG_OPENDET, 1); // Enable antenna open detection
763+
764+
if (theGNSS.sendCfgValset())
765+
{
766+
theGNSS.setAutoMONHWcallbackPtr(&storeMONHWdata); //Enable automatic MON HW messages with callback to storeMONHWdata
767+
}
768+
else
769+
{
770+
systemPrintln("Failed to configure GNSS antenna detection");
771+
}
772+
}
773+
757774
//Configuring the ZED can take more than 2000ms. We save configuration to
758775
//ZED so there is no need to update settings unless user has modified
759776
//the settings file or internal settings.

Firmware/RTK_Surveyor/Display.ino

Lines changed: 104 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@
7272
//Right bottom
7373
#define ICON_LOGGING_NTP (1<<10)
7474

75+
//Left bottom
76+
#define ICON_ANTENNA_SHORT (1<<11)
77+
#define ICON_ANTENNA_OPEN (1<<12)
78+
7579
//----------------------------------------
7680
//Locals
7781
//----------------------------------------
@@ -140,6 +144,31 @@ void displayBatteryVsEthernet()
140144
icons |= (blinking_icons & ICON_ETHERNET); //Top Right
141145
}
142146
}
147+
void displaySivVsOpenShort()
148+
{
149+
if (!HAS_ANTENNA_SHORT_OPEN)
150+
icons |= paintSIV();
151+
else
152+
{
153+
if (aStatus == SFE_UBLOX_ANTENNA_STATUS_SHORT)
154+
{
155+
blinking_icons ^= ICON_ANTENNA_SHORT;
156+
icons |= (blinking_icons & ICON_ANTENNA_SHORT);
157+
}
158+
else if (aStatus == SFE_UBLOX_ANTENNA_STATUS_OPEN)
159+
{
160+
blinking_icons ^= ICON_ANTENNA_OPEN;
161+
icons |= (blinking_icons & ICON_ANTENNA_OPEN);
162+
}
163+
else
164+
{
165+
blinking_icons &= ~ICON_ANTENNA_SHORT;
166+
blinking_icons &= ~ICON_ANTENNA_OPEN;
167+
icons |= paintSIV();
168+
}
169+
}
170+
}
171+
143172

144173
//Given the system state, display the appropriate information
145174
void updateDisplay()
@@ -218,41 +247,41 @@ void updateDisplay()
218247
case (STATE_ROVER_NOT_STARTED):
219248
icons = ICON_CROSS_HAIR //Center left
220249
| ICON_HORIZONTAL_ACCURACY //Center right
221-
| paintSIV() //Bottom left
222250
| ICON_LOGGING; //Bottom right
251+
displaySivVsOpenShort(); //Bottom left
223252
displayBatteryVsEthernet(); //Top right
224253
iconsRadio = setRadioIcons(); //Top left
225254
break;
226255
case (STATE_ROVER_NO_FIX):
227256
icons = ICON_CROSS_HAIR //Center left
228257
| ICON_HORIZONTAL_ACCURACY //Center right
229-
| paintSIV() //Bottom left
230258
| ICON_LOGGING; //Bottom right
259+
displaySivVsOpenShort(); //Bottom left
231260
displayBatteryVsEthernet(); //Top right
232261
iconsRadio = setRadioIcons(); //Top left
233262
break;
234263
case (STATE_ROVER_FIX):
235264
icons = ICON_CROSS_HAIR //Center left
236265
| ICON_HORIZONTAL_ACCURACY //Center right
237-
| paintSIV() //Bottom left
238266
| ICON_LOGGING; //Bottom right
267+
displaySivVsOpenShort(); //Bottom left
239268
displayBatteryVsEthernet(); //Top right
240269
iconsRadio = setRadioIcons(); //Top left
241270
break;
242271
case (STATE_ROVER_RTK_FLOAT):
243272
blinking_icons ^= ICON_CROSS_HAIR_DUAL;
244273
icons = (blinking_icons & ICON_CROSS_HAIR_DUAL) //Center left
245274
| ICON_HORIZONTAL_ACCURACY //Center right
246-
| paintSIV() //Bottom left
247275
| ICON_LOGGING; //Bottom right
276+
displaySivVsOpenShort(); //Bottom left
248277
displayBatteryVsEthernet(); //Top right
249278
iconsRadio = setRadioIcons(); //Top left
250279
break;
251280
case (STATE_ROVER_RTK_FIX):
252281
icons = ICON_CROSS_HAIR_DUAL//Center left
253282
| ICON_HORIZONTAL_ACCURACY //Center right
254-
| paintSIV() //Bottom left
255283
| ICON_LOGGING; //Bottom right
284+
displaySivVsOpenShort(); //Bottom left
256285
displayBatteryVsEthernet(); //Top right
257286
iconsRadio = setRadioIcons(); //Top left
258287
break;
@@ -268,8 +297,8 @@ void updateDisplay()
268297
blinking_icons ^= ICON_CROSS_HAIR;
269298
icons = (blinking_icons & ICON_CROSS_HAIR) //Center left
270299
| ICON_HORIZONTAL_ACCURACY //Center right
271-
| paintSIV() //Bottom left
272300
| ICON_LOGGING; //Bottom right
301+
displaySivVsOpenShort(); //Bottom left
273302
displayBatteryVsEthernet(); //Top right
274303
iconsRadio = setRadioIcons(); //Top left
275304
break;
@@ -301,8 +330,8 @@ void updateDisplay()
301330
case (STATE_NTPSERVER_NO_SYNC):
302331
blinking_icons ^= ICON_CLOCK;
303332
icons = (blinking_icons & ICON_CLOCK) //Center left
304-
| ICON_CLOCK_ACCURACY //Center right
305-
| paintSIV(); //Bottom left
333+
| ICON_CLOCK_ACCURACY; //Center right
334+
displaySivVsOpenShort(); //Bottom left
306335
if (online.ethernetStatus == ETH_CONNECTED)
307336
blinking_icons |= ICON_ETHERNET; //Don't blink if link is up
308337
else
@@ -314,8 +343,8 @@ void updateDisplay()
314343
case (STATE_NTPSERVER_SYNC):
315344
icons = ICON_CLOCK //Center left
316345
| ICON_CLOCK_ACCURACY //Center right
317-
| paintSIV() //Bottom left
318346
| ICON_LOGGING_NTP; //Bottom right
347+
displaySivVsOpenShort(); //Bottom left
319348
if (online.ethernetStatus == ETH_CONNECTED)
320349
blinking_icons |= ICON_ETHERNET; //Don't blink if link is up
321350
else
@@ -539,6 +568,10 @@ void updateDisplay()
539568
displayBitmap(2, 35, SIV_Antenna_Width, SIV_Antenna_Height, SIV_Antenna);
540569
else if (icons & ICON_SIV_ANTENNA_LBAND)
541570
displayBitmap(2, 35, SIV_Antenna_LBand_Width, SIV_Antenna_LBand_Height, SIV_Antenna_LBand);
571+
else if (icons & ICON_ANTENNA_SHORT)
572+
displayBitmap(2, 35, Antenna_Short_Width, Antenna_Short_Height, Antenna_Short);
573+
else if (icons & ICON_ANTENNA_OPEN)
574+
displayBitmap(2, 35, Antenna_Open_Width, Antenna_Open_Height, Antenna_Open);
542575

543576
//Bottom right corner
544577
if (icons & ICON_LOGGING)
@@ -1647,9 +1680,37 @@ void paintBaseTempSurveyStarted()
16471680
else
16481681
oled.print(">10");
16491682

1650-
oled.setCursor(0, 39); //x, y
1651-
oled.setFont(QW_FONT_5X7);
1652-
oled.print("Time:");
1683+
if (!HAS_ANTENNA_SHORT_OPEN)
1684+
{
1685+
oled.setCursor(0, 39); //x, y
1686+
oled.setFont(QW_FONT_5X7);
1687+
oled.print("Time:");
1688+
}
1689+
else
1690+
{
1691+
static uint32_t blinkers = 0;
1692+
if (aStatus == SFE_UBLOX_ANTENNA_STATUS_SHORT)
1693+
{
1694+
blinkers ^= ICON_ANTENNA_SHORT;
1695+
if (blinkers & ICON_ANTENNA_SHORT)
1696+
displayBitmap(2, 35, Antenna_Short_Width, Antenna_Short_Height, Antenna_Short);
1697+
}
1698+
else if (aStatus == SFE_UBLOX_ANTENNA_STATUS_OPEN)
1699+
{
1700+
blinkers ^= ICON_ANTENNA_OPEN;
1701+
if (blinkers & ICON_ANTENNA_OPEN)
1702+
displayBitmap(2, 35, Antenna_Open_Width, Antenna_Open_Height, Antenna_Open);
1703+
}
1704+
else
1705+
{
1706+
blinkers &= ~ICON_ANTENNA_SHORT;
1707+
blinkers &= ~ICON_ANTENNA_OPEN;
1708+
oled.setCursor(0, 39); //x, y
1709+
oled.setFont(QW_FONT_5X7);
1710+
oled.print("Time:");
1711+
}
1712+
}
1713+
16531714

16541715
oled.setCursor(30, 36); //x, y
16551716
oled.setFont(QW_FONT_8X16);
@@ -1680,9 +1741,37 @@ void paintRTCM()
16801741
else
16811742
printTextCenter("Xmitting", yPos, QW_FONT_8X16, 1, false); //text, y, font type, kerning, inverted
16821743

1683-
oled.setCursor(0, 39); //x, y
1684-
oled.setFont(QW_FONT_5X7);
1685-
oled.print("RTCM:");
1744+
1745+
if (!HAS_ANTENNA_SHORT_OPEN)
1746+
{
1747+
oled.setCursor(0, 39); //x, y
1748+
oled.setFont(QW_FONT_5X7);
1749+
oled.print("RTCM:");
1750+
}
1751+
else
1752+
{
1753+
static uint32_t blinkers = 0;
1754+
if (aStatus == SFE_UBLOX_ANTENNA_STATUS_SHORT)
1755+
{
1756+
blinkers ^= ICON_ANTENNA_SHORT;
1757+
if (blinkers & ICON_ANTENNA_SHORT)
1758+
displayBitmap(2, 35, Antenna_Short_Width, Antenna_Short_Height, Antenna_Short);
1759+
}
1760+
else if (aStatus == SFE_UBLOX_ANTENNA_STATUS_OPEN)
1761+
{
1762+
blinkers ^= ICON_ANTENNA_OPEN;
1763+
if (blinkers & ICON_ANTENNA_OPEN)
1764+
displayBitmap(2, 35, Antenna_Open_Width, Antenna_Open_Height, Antenna_Open);
1765+
}
1766+
else
1767+
{
1768+
blinkers &= ~ICON_ANTENNA_SHORT;
1769+
blinkers &= ~ICON_ANTENNA_OPEN;
1770+
oled.setCursor(0, 39); //x, y
1771+
oled.setFont(QW_FONT_5X7);
1772+
oled.print("RTCM:");
1773+
}
1774+
}
16861775

16871776
if (rtcmPacketsSent < 100)
16881777
oled.setCursor(30, 36); //x, y - Give space for two digits

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,8 @@ bool timTpUpdated = false;
306306
uint32_t timTpEpoch;
307307
uint32_t timTpMicros;
308308

309+
uint8_t aStatus = SFE_UBLOX_ANTENNA_STATUS_DONTKNOW;
310+
309311
const byte haeNumberOfDecimals = 8; //Used for printing and transmitting lat/lon
310312
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
311313

Firmware/RTK_Surveyor/Rover.ino

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,11 @@ void storeTIMTPdata(UBX_TIM_TP_data_t *ubxDataStruct)
248248
timTpUpdated = true;
249249
}
250250

251+
void storeMONHWdata(UBX_MON_HW_data_t *ubxDataStruct)
252+
{
253+
aStatus = ubxDataStruct->aStatus;
254+
}
255+
251256
//Helper method to convert GNSS time and date into Unix Epoch
252257
void convertGnssTimeToEpoch(uint32_t *epochSecs, uint32_t *epochMicros)
253258
{

Firmware/RTK_Surveyor/System.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,10 @@ bool setMessages(int maxRetries)
626626
if (ubxMessages[messageNumber].msgID == UBX_NMEA_GGA)
627627
if (rate == 0)
628628
rate = 1;
629+
if (ubxMessages[messageNumber].msgClass == UBX_CLASS_MON)
630+
if (ubxMessages[messageNumber].msgID == UBX_MON_HW)
631+
if (rate == 0)
632+
rate = 1;
629633
}
630634

631635
response &= theGNSS.addCfgValset(ubxMessages[messageNumber].msgConfigKey + spiOffset, rate);

Firmware/RTK_Surveyor/icons.h

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,64 @@ const uint8_t SIV_Antenna_LBand [] = {
363363
0x00, 0x10, 0x10, 0x1F, 0x1F, 0x12, 0x12, 0x04, 0x04, 0x05, 0x06, 0x00
364364
};
365365

366+
/*
367+
Antenna_Short [12, 13]
368+
369+
1
370+
123456789012
371+
.------------.
372+
0x01| * |
373+
0x02| * |
374+
0x04| * |
375+
0x08| ** |
376+
0x10| * * |
377+
0x20| * ***** |
378+
0x40| * * |
379+
0x80| ***** * |
380+
0x01| * * |
381+
0x02| ** |
382+
0x04| * |
383+
0x08| * |
384+
0x10| * |
385+
'------------'
386+
*/
387+
388+
const int Antenna_Short_Height = 13;
389+
const int Antenna_Short_Width = 12;
390+
const uint8_t Antenna_Short [] = {
391+
0x00, 0x80, 0xC0, 0xA0, 0x90, 0x88, 0x3F, 0x20, 0xA0, 0x60, 0x20, 0x00,
392+
0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00
393+
};
394+
395+
/*
396+
Antenna_Open [12, 13]
397+
398+
1
399+
123456789012
400+
.------------.
401+
0x01| ** |
402+
0x02| ** |
403+
0x04| ** |
404+
0x08| ** |
405+
0x10| ** |
406+
0x20| ** |
407+
0x40| ** ** |
408+
0x80| ** |
409+
0x01| ** |
410+
0x02| ** |
411+
0x04| ** |
412+
0x08| ** |
413+
0x10| ** |
414+
'------------'
415+
*/
416+
417+
const int Antenna_Open_Height = 13;
418+
const int Antenna_Open_Width = 12;
419+
const uint8_t Antenna_Open [] = {
420+
0x00, 0x00, 0x00, 0x60, 0x70, 0x1F, 0x0F, 0xC0, 0xC0, 0x00, 0x00, 0x00,
421+
0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x1F, 0x01, 0x00, 0x00, 0x00, 0x00
422+
};
423+
366424
/*
367425
Rover_Fusion [15, 9]
368426

Firmware/RTK_Surveyor/settings.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ ProductVariant productVariant = RTK_SURVEYOR;
8686
#define HAS_NO_BATTERY (productVariant == REFERENCE_STATION)
8787
#define HAS_BATTERY (!HAS_NO_BATTERY)
8888

89+
//Macro to show if the the RTK variant has antenna short circuit / open circuit detection
90+
#define HAS_ANTENNA_SHORT_OPEN (productVariant == REFERENCE_STATION)
91+
8992
typedef enum
9093
{
9194
BUTTON_ROVER = 0,

0 commit comments

Comments
 (0)