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

Commit 6efce21

Browse files
committed
Change default setVal to RAM+BBR+Flash. Expanding key set.
When a user wants to make a module configuration change they probably want the change to take effect immediately. The previous default of BBR didn't do a lot of good. I am also experimenting with generating key groups using defines.
1 parent 2816b95 commit 6efce21

File tree

2 files changed

+30
-19
lines changed

2 files changed

+30
-19
lines changed

src/SparkFun_Ublox_Arduino_Library.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,7 +1662,7 @@ uint8_t SFE_UBLOX_GPS::getVal8(uint16_t group, uint16_t id, uint8_t size, uint8_
16621662

16631663
//Given a key, return its value
16641664
//This function takes a full 32-bit key
1665-
//Default layer is BBR
1665+
//Default layer is RAM
16661666
//Configuration of modern Ublox modules is now done via getVal/setVal/delVal, ie protocol v27 and above found on ZED-F9P
16671667
uint8_t SFE_UBLOX_GPS::getVal8(uint32_t key, uint8_t layer, uint16_t maxWait)
16681668
{
@@ -1724,7 +1724,7 @@ uint8_t SFE_UBLOX_GPS::getVal8(uint32_t key, uint8_t layer, uint16_t maxWait)
17241724

17251725
//Given a key, set a 16-bit value
17261726
//This function takes a full 32-bit key
1727-
//Default layer is BBR
1727+
//Default layer is all: RAM+BBR+Flash
17281728
//Configuration of modern Ublox modules is now done via getVal/setVal/delVal, ie protocol v27 and above found on ZED-F9P
17291729
uint8_t SFE_UBLOX_GPS::setVal(uint32_t key, uint16_t value, uint8_t layer, uint16_t maxWait)
17301730
{
@@ -1733,7 +1733,7 @@ uint8_t SFE_UBLOX_GPS::setVal(uint32_t key, uint16_t value, uint8_t layer, uint1
17331733

17341734
//Given a key, set a 16-bit value
17351735
//This function takes a full 32-bit key
1736-
//Default layer is BBR
1736+
//Default layer is all: RAM+BBR+Flash
17371737
//Configuration of modern Ublox modules is now done via getVal/setVal/delVal, ie protocol v27 and above found on ZED-F9P
17381738
uint8_t SFE_UBLOX_GPS::setVal16(uint32_t key, uint16_t value, uint8_t layer, uint16_t maxWait)
17391739
{
@@ -1765,7 +1765,7 @@ uint8_t SFE_UBLOX_GPS::setVal16(uint32_t key, uint16_t value, uint8_t layer, uin
17651765

17661766
//Given a key, set an 8-bit value
17671767
//This function takes a full 32-bit key
1768-
//Default layer is BBR
1768+
//Default layer is all: RAM+BBR+Flash
17691769
//Configuration of modern Ublox modules is now done via getVal/setVal/delVal, ie protocol v27 and above found on ZED-F9P
17701770
uint8_t SFE_UBLOX_GPS::setVal8(uint32_t key, uint8_t value, uint8_t layer, uint16_t maxWait)
17711771
{
@@ -1796,7 +1796,7 @@ uint8_t SFE_UBLOX_GPS::setVal8(uint32_t key, uint8_t value, uint8_t layer, uint1
17961796

17971797
//Given a key, set a 32-bit value
17981798
//This function takes a full 32-bit key
1799-
//Default layer is BBR
1799+
//Default layer is all: RAM+BBR+Flash
18001800
//Configuration of modern Ublox modules is now done via getVal/setVal/delVal, ie protocol v27 and above found on ZED-F9P
18011801
uint8_t SFE_UBLOX_GPS::setVal32(uint32_t key, uint32_t value, uint8_t layer, uint16_t maxWait)
18021802
{

src/SparkFun_Ublox_Arduino_Library.h

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -353,21 +353,32 @@ const uint8_t VAL_SIZE_64 = 0x05; //Eight bytes
353353
const uint8_t VAL_LAYER_RAM = (1 << 0);
354354
const uint8_t VAL_LAYER_BBR = (1 << 1);
355355
const uint8_t VAL_LAYER_FLASH = (1 << 2);
356+
const uint8_t VAL_LAYER_ALL = VAL_LAYER_RAM | VAL_LAYER_BBR | VAL_LAYER_FLASH; //Not valid with getVal()
356357

357358
//Below are various Groups, IDs, and sizes for various settings
358359
//These can be used to call getVal/setVal/delVal
359-
const uint8_t VAL_GROUP_I2COUTPROT = 0x72;
360-
const uint8_t VAL_GROUP_I2COUTPROT_SIZE = VAL_SIZE_1; //All fields in I2C group are currently 1 bit
361-
362-
const uint8_t VAL_ID_I2COUTPROT_UBX = 0x01;
363-
const uint8_t VAL_ID_I2COUTPROT_NMEA = 0x02;
364-
const uint8_t VAL_ID_I2COUTPROT_RTCM3 = 0x03;
360+
const uint8_t VAL_ID_PROT_UBX = 0x01;
361+
const uint8_t VAL_ID_PROT_NMEA = 0x02;
362+
const uint8_t VAL_ID_PROT_RTCM3 = 0x04;
365363

364+
const uint8_t VAL_GROUP_I2COUTPROT = 0x72;
365+
const uint8_t VAL_GROUP_UART1INPROT = 0x73;
366+
const uint8_t VAL_GROUP_UART1OUTPROT = 0x74;
366367
const uint8_t VAL_GROUP_I2C = 0x51;
367-
const uint8_t VAL_GROUP_I2C_SIZE = VAL_SIZE_8; //All fields in I2C group are currently 1 byte
368+
369+
const uint8_t VAL_GROUP_UART_SIZE = VAL_SIZE_1; //All fields in UART group are currently 1 bit
370+
const uint8_t VAL_GROUP_I2C_SIZE = VAL_SIZE_8; //All fields in I2C group are currently 1 byte
368371

369372
const uint8_t VAL_ID_I2C_ADDRESS = 0x01;
370373

374+
const uint32_t UBLOX_CFG_UART1INPROT_UBX = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART1INPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_UBX << (8 * 0)); //0x10730001
375+
const uint32_t UBLOX_CFG_UART1INPROT_NMEA = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART1INPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_NMEA << (8 * 0));
376+
const uint32_t UBLOX_CFG_UART1INPROT_RTCM3X = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART1INPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_RTCM3 << (8 * 0));
377+
378+
const uint32_t UBLOX_CFG_UART1OUTPROT_UBX = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART1OUTPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_UBX << (8 * 0));
379+
const uint32_t UBLOX_CFG_UART1OUTPROT_NMEA = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART1OUTPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_NMEA << (8 * 0));
380+
const uint32_t UBLOX_CFG_UART1OUTPROT_RTCM3X = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART1OUTPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_RTCM3 << (8 * 0));
381+
371382
// Configuration Sub-Section mask definitions for saveConfigSelective (UBX-CFG-CFG)
372383
const uint32_t VAL_CFG_SUBSEC_IOPORT = 0x00000001; // ioPort - communications port settings (causes IO system reset!)
373384
const uint32_t VAL_CFG_SUBSEC_MSGCONF = 0x00000002; // msgConf - message configuration
@@ -461,7 +472,7 @@ class SFE_UBLOX_GPS
461472
//Control the size of the internal I2C transaction amount
462473
void setI2CTransactionSize(uint8_t bufferSize);
463474
uint8_t getI2CTransactionSize(void);
464-
475+
465476
//Set the max number of bytes set in a given I2C transaction
466477
uint8_t i2cTransactionSize = 32; //Default to ATmega328 limit
467478

@@ -579,12 +590,12 @@ class SFE_UBLOX_GPS
579590
//General configuration (used only on protocol v27 and higher - ie, ZED-F9P)
580591
//It is probably safe to assume that users of the ZED-F9P will be using I2C / Qwiic.
581592
//If they are using Serial then the higher baud rate will also help. So let's leave maxWait set to 250ms.
582-
uint8_t getVal8(uint16_t group, uint16_t id, uint8_t size, uint8_t layer = VAL_LAYER_BBR, uint16_t maxWait = 250); //Returns the value at a given group/id/size location
583-
uint8_t getVal8(uint32_t keyID, uint8_t layer = VAL_LAYER_BBR, uint16_t maxWait = 250); //Returns the value at a given group/id/size location
584-
uint8_t setVal(uint32_t keyID, uint16_t value, uint8_t layer = VAL_LAYER_BBR, uint16_t maxWait = 250); //Sets the 16-bit value at a given group/id/size location
585-
uint8_t setVal8(uint32_t keyID, uint8_t value, uint8_t layer = VAL_LAYER_BBR, uint16_t maxWait = 250); //Sets the 8-bit value at a given group/id/size location
586-
uint8_t setVal16(uint32_t keyID, uint16_t value, uint8_t layer = VAL_LAYER_BBR, uint16_t maxWait = 250); //Sets the 16-bit value at a given group/id/size location
587-
uint8_t setVal32(uint32_t keyID, uint32_t value, uint8_t layer = VAL_LAYER_BBR, uint16_t maxWait = 250); //Sets the 32-bit value at a given group/id/size location
593+
uint8_t getVal8(uint16_t group, uint16_t id, uint8_t size, uint8_t layer = VAL_LAYER_RAM, uint16_t maxWait = 250); //Returns the value at a given group/id/size location
594+
uint8_t getVal8(uint32_t keyID, uint8_t layer = VAL_LAYER_RAM, uint16_t maxWait = 250); //Returns the value at a given group/id/size location
595+
uint8_t setVal(uint32_t keyID, uint16_t value, uint8_t layer = VAL_LAYER_ALL, uint16_t maxWait = 250); //Sets the 16-bit value at a given group/id/size location
596+
uint8_t setVal8(uint32_t keyID, uint8_t value, uint8_t layer = VAL_LAYER_ALL, uint16_t maxWait = 250); //Sets the 8-bit value at a given group/id/size location
597+
uint8_t setVal16(uint32_t keyID, uint16_t value, uint8_t layer = VAL_LAYER_ALL, uint16_t maxWait = 250); //Sets the 16-bit value at a given group/id/size location
598+
uint8_t setVal32(uint32_t keyID, uint32_t value, uint8_t layer = VAL_LAYER_ALL, uint16_t maxWait = 250); //Sets the 32-bit value at a given group/id/size location
588599
uint8_t newCfgValset8(uint32_t keyID, uint8_t value, uint8_t layer = VAL_LAYER_BBR); //Define a new UBX-CFG-VALSET with the given KeyID and 8-bit value
589600
uint8_t newCfgValset16(uint32_t keyID, uint16_t value, uint8_t layer = VAL_LAYER_BBR); //Define a new UBX-CFG-VALSET with the given KeyID and 16-bit value
590601
uint8_t newCfgValset32(uint32_t keyID, uint32_t value, uint8_t layer = VAL_LAYER_BBR); //Define a new UBX-CFG-VALSET with the given KeyID and 32-bit value

0 commit comments

Comments
 (0)