Skip to content

Commit 9fe73c9

Browse files
committed
Add ability to disable RADIO/DATA ports
Fix #734
1 parent 82f2d26 commit 9fe73c9

File tree

3 files changed

+355
-115
lines changed

3 files changed

+355
-115
lines changed

Firmware/RTK_Surveyor/System.ino

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,19 +144,38 @@ bool configureUbloxModule()
144144
}
145145
}
146146

147-
// The USB port on the ZED may be used for RTCM to/from the computer (as an NTRIP caster or client)
148-
// So let's be sure all protocols are on for the USB port
149-
response &= theGNSS.addCfgValset(UBLOX_CFG_USBOUTPROT_UBX, 1);
150-
response &= theGNSS.addCfgValset(UBLOX_CFG_USBOUTPROT_NMEA, 1);
151-
if (commandSupported(UBLOX_CFG_USBOUTPROT_RTCM3X) == true)
152-
response &= theGNSS.addCfgValset(UBLOX_CFG_USBOUTPROT_RTCM3X, 1);
153-
response &= theGNSS.addCfgValset(UBLOX_CFG_USBINPROT_UBX, 1);
154-
response &= theGNSS.addCfgValset(UBLOX_CFG_USBINPROT_NMEA, 1);
155-
response &= theGNSS.addCfgValset(UBLOX_CFG_USBINPROT_RTCM3X, 1);
156-
if (commandSupported(UBLOX_CFG_USBINPROT_SPARTN) == true)
147+
if (settings.enableZedUsb == true)
157148
{
158-
//See issue: https://github.com/sparkfun/SparkFun_RTK_Firmware/issues/713
159-
response &= theGNSS.addCfgValset(UBLOX_CFG_USBINPROT_SPARTN, 1);
149+
// The USB port on the ZED may be used for RTCM to/from the computer (as an NTRIP caster or client)
150+
// So let's be sure all protocols are on for the USB port
151+
response &= theGNSS.addCfgValset(UBLOX_CFG_USBOUTPROT_UBX, 1);
152+
response &= theGNSS.addCfgValset(UBLOX_CFG_USBOUTPROT_NMEA, 1);
153+
if (commandSupported(UBLOX_CFG_USBOUTPROT_RTCM3X) == true)
154+
response &= theGNSS.addCfgValset(UBLOX_CFG_USBOUTPROT_RTCM3X, 1);
155+
response &= theGNSS.addCfgValset(UBLOX_CFG_USBINPROT_UBX, 1);
156+
response &= theGNSS.addCfgValset(UBLOX_CFG_USBINPROT_NMEA, 1);
157+
response &= theGNSS.addCfgValset(UBLOX_CFG_USBINPROT_RTCM3X, 1);
158+
if (commandSupported(UBLOX_CFG_USBINPROT_SPARTN) == true)
159+
{
160+
// See issue: https://github.com/sparkfun/SparkFun_RTK_Firmware/issues/713
161+
response &= theGNSS.addCfgValset(UBLOX_CFG_USBINPROT_SPARTN, 1);
162+
}
163+
}
164+
else
165+
{
166+
//Disable all protocols over USB
167+
response &= theGNSS.addCfgValset(UBLOX_CFG_USBOUTPROT_UBX, 0);
168+
response &= theGNSS.addCfgValset(UBLOX_CFG_USBOUTPROT_NMEA, 0);
169+
if (commandSupported(UBLOX_CFG_USBOUTPROT_RTCM3X) == true)
170+
response &= theGNSS.addCfgValset(UBLOX_CFG_USBOUTPROT_RTCM3X, 0);
171+
response &= theGNSS.addCfgValset(UBLOX_CFG_USBINPROT_UBX, 0);
172+
response &= theGNSS.addCfgValset(UBLOX_CFG_USBINPROT_NMEA, 0);
173+
response &= theGNSS.addCfgValset(UBLOX_CFG_USBINPROT_RTCM3X, 0);
174+
if (commandSupported(UBLOX_CFG_USBINPROT_SPARTN) == true)
175+
{
176+
// See issue: https://github.com/sparkfun/SparkFun_RTK_Firmware/issues/713
177+
response &= theGNSS.addCfgValset(UBLOX_CFG_USBINPROT_SPARTN, 0);
178+
}
160179
}
161180

162181
if (commandSupported(UBLOX_CFG_NAVSPG_INFIL_MINCNO) == true)
@@ -597,7 +616,7 @@ bool messageSupported(int messageNumber)
597616

598617
return (messageSupported);
599618
}
600-
// Given a command key, return true if that key is supported on this platform and fimrware version
619+
// Given a command key, return true if that key is supported on this platform and firmware version
601620
bool commandSupported(const uint32_t key)
602621
{
603622
bool commandSupported = false;

0 commit comments

Comments
 (0)