Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 32f8583

Browse files
committed
Change function call vars to be more clear. Fix example with correct latLong default.
1 parent 8638c35 commit 32f8583

File tree

3 files changed

+34
-31
lines changed

3 files changed

+34
-31
lines changed

examples/ZED-F9P/Example11_setStaticPosition/Example11_setStaticPosition.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
Buy a board from SparkFun!
1616
ZED-F9P RTK2: https://www.sparkfun.com/products/15136
1717
NEO-M8P RTK: https://www.sparkfun.com/products/15005
18-
SAM-M8Q: https://www.sparkfun.com/products/15106
1918
2019
Hardware Connections:
2120
Plug a Qwiic cable into the GPS and a BlackBoard
@@ -54,7 +53,7 @@ void setup()
5453
//myGPS.setStaticPosition(-128020831, -471680385, 408666581);
5554

5655
//Units are cm with a high precision extension so -1234.5678 should be called: (-123456, -78)
57-
myGPS.setStaticPosition(-128020830, -80, -471680384, -70, 408666581, 10, true, 250); //With high precision 0.1mm parts
56+
myGPS.setStaticPosition(-128020830, -80, -471680384, -70, 408666581, 10); //With high precision 0.1mm parts
5857

5958
//We can also set via lat/long
6059
//40.09029751,-105.18507900,1560.238

src/SparkFun_Ublox_Arduino_Library.cpp

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3534,10 +3534,12 @@ boolean SFE_UBLOX_GPS::getVehAtt(uint16_t maxWait)
35343534
return (true);
35353535
}
35363536

3537-
//Set the ECEF coordinates of a receiver
3537+
//Set the ECEF or Lat/Long coordinates of a receiver
35383538
//This imediately puts the receiver in TIME mode (fixed) and will begin outputting RTCM sentences if enabled
35393539
//This is helpful once an antenna's position has been established. See this tutorial: https://learn.sparkfun.com/tutorials/how-to-build-a-diy-gnss-reference-station#gather-raw-gnss-data
3540-
bool SFE_UBLOX_GPS::setStaticPosition(int32_t ecefX, int8_t ecefXHP, int32_t ecefY, int8_t ecefYHP, int32_t ecefZ, int8_t ecefZHP, bool latLong, uint16_t maxWait)
3540+
// For ECEF the units are: cm, 0.1mm, cm, 0.1mm, cm, 0.1mm
3541+
// For Lat/Lon/Alt the units are: degrees^-7, degrees^-9, degrees^-7, degrees^-9, cm, 0.1mm
3542+
bool SFE_UBLOX_GPS::setStaticPosition(int32_t ecefXOrLat, int8_t ecefXOrLatHP, int32_t ecefYOrLon, int8_t ecefYOrLonHP, int32_t ecefZOrAlt, int8_t ecefZOrAltHP, bool latLong, uint16_t maxWait)
35413543
{
35423544
packetCfg.cls = UBX_CLASS_CFG;
35433545
packetCfg.id = UBX_CFG_TMODE3;
@@ -3560,33 +3562,33 @@ bool SFE_UBLOX_GPS::setStaticPosition(int32_t ecefX, int8_t ecefXHP, int32_t ece
35603562
if (latLong == true)
35613563
payloadCfg[3] = (uint8_t)(1 << 0); //Set mode to fixed. Use LAT/LON/ALT.
35623564

3563-
//Set ECEF X
3564-
payloadCfg[4] = (ecefX >> 8 * 0) & 0xFF; //LSB
3565-
payloadCfg[5] = (ecefX >> 8 * 1) & 0xFF;
3566-
payloadCfg[6] = (ecefX >> 8 * 2) & 0xFF;
3567-
payloadCfg[7] = (ecefX >> 8 * 3) & 0xFF; //MSB
3568-
3569-
//Set ECEF Y
3570-
payloadCfg[8] = (ecefY >> 8 * 0) & 0xFF; //LSB
3571-
payloadCfg[9] = (ecefY >> 8 * 1) & 0xFF;
3572-
payloadCfg[10] = (ecefY >> 8 * 2) & 0xFF;
3573-
payloadCfg[11] = (ecefY >> 8 * 3) & 0xFF; //MSB
3574-
3575-
//Set ECEF Z
3576-
payloadCfg[12] = (ecefZ >> 8 * 0) & 0xFF; //LSB
3577-
payloadCfg[13] = (ecefZ >> 8 * 1) & 0xFF;
3578-
payloadCfg[14] = (ecefZ >> 8 * 2) & 0xFF;
3579-
payloadCfg[15] = (ecefZ >> 8 * 3) & 0xFF; //MSB
3580-
3581-
//Set ECEF high precision bits
3582-
payloadCfg[16] = ecefXHP;
3583-
payloadCfg[17] = ecefYHP;
3584-
payloadCfg[18] = ecefZHP;
3565+
//Set ECEF X or Lat
3566+
payloadCfg[4] = (ecefXOrLat >> 8 * 0) & 0xFF; //LSB
3567+
payloadCfg[5] = (ecefXOrLat >> 8 * 1) & 0xFF;
3568+
payloadCfg[6] = (ecefXOrLat >> 8 * 2) & 0xFF;
3569+
payloadCfg[7] = (ecefXOrLat >> 8 * 3) & 0xFF; //MSB
3570+
3571+
//Set ECEF Y or Long
3572+
payloadCfg[8] = (ecefYOrLon >> 8 * 0) & 0xFF; //LSB
3573+
payloadCfg[9] = (ecefYOrLon >> 8 * 1) & 0xFF;
3574+
payloadCfg[10] = (ecefYOrLon >> 8 * 2) & 0xFF;
3575+
payloadCfg[11] = (ecefYOrLon >> 8 * 3) & 0xFF; //MSB
3576+
3577+
//Set ECEF Z or Altitude
3578+
payloadCfg[12] = (ecefZOrAlt >> 8 * 0) & 0xFF; //LSB
3579+
payloadCfg[13] = (ecefZOrAlt >> 8 * 1) & 0xFF;
3580+
payloadCfg[14] = (ecefZOrAlt >> 8 * 2) & 0xFF;
3581+
payloadCfg[15] = (ecefZOrAlt >> 8 * 3) & 0xFF; //MSB
3582+
3583+
//Set high precision parts
3584+
payloadCfg[16] = ecefXOrLatHP;
3585+
payloadCfg[17] = ecefYOrLonHP;
3586+
payloadCfg[18] = ecefZOrAltHP;
35853587

35863588
return ((sendCommand(&packetCfg, maxWait)) == SFE_UBLOX_STATUS_DATA_SENT); // We are only expecting an ACK
35873589
}
35883590

3589-
bool SFE_UBLOX_GPS::setStaticPosition(int32_t ecefX, int32_t ecefY, int32_t ecefZ, bool latlong, uint16_t maxWait)
3591+
bool SFE_UBLOX_GPS::setStaticPosition(int32_t ecefXOrLat, int32_t ecefYOrLon, int32_t ecefZOrAlt, bool latlong, uint16_t maxWait)
35903592
{
3591-
return (setStaticPosition(ecefX, 0, ecefY, 0, ecefZ, 0, latlong, maxWait));
3593+
return (setStaticPosition(ecefXOrLat, 0, ecefYOrLon, 0, ecefZOrAlt, 0, latlong, maxWait));
35923594
}

src/SparkFun_Ublox_Arduino_Library.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -641,9 +641,11 @@ class SFE_UBLOX_GPS
641641
sfe_ublox_status_e getSensState(uint8_t sensor, uint16_t maxWait = 1100);
642642
boolean getVehAtt(uint16_t maxWait = 1100);
643643

644-
//Given coordinates, put receiver into static position. Set latlong to true to pass in lat/long values instead of ecef.
645-
bool setStaticPosition(int32_t ecefX, int8_t ecefXHP, int32_t ecefY, int8_t ecefYHP, int32_t ecefZ, int8_t ecefZHP, bool latLong = false, uint16_t maxWait = 250);
646-
bool setStaticPosition(int32_t ecefX, int32_t ecefY, int32_t ecefZ, bool latlong = true, uint16_t maxWait = 250);
644+
// Given coordinates, put receiver into static position. Set latlong to true to pass in lat/long values instead of ecef.
645+
// For ECEF the units are: cm, 0.1mm, cm, 0.1mm, cm, 0.1mm
646+
// For Lat/Lon/Alt the units are: degrees^-7, degrees^-9, degrees^-7, degrees^-9, cm, 0.1mm
647+
bool setStaticPosition(int32_t ecefXOrLat, int8_t ecefXOrLatHP, int32_t ecefYOrLon, int8_t ecefYOrLonHP, int32_t ecefZOrAlt, int8_t ecefZOrAltHP, bool latLong = false, uint16_t maxWait = 250);
648+
bool setStaticPosition(int32_t ecefXOrLat, int32_t ecefYOrLon, int32_t ecefZOrAlt, bool latLong = false, uint16_t maxWait = 250);
647649

648650
//Survey-in specific controls
649651
struct svinStructure

0 commit comments

Comments
 (0)