Merge branch 'sparkfun:main' into master

This commit is contained in:
UT2UH
2021-06-20 19:32:51 +03:00
committed by GitHub
4 changed files with 59 additions and 46 deletions
@@ -156,7 +156,17 @@ void loop()
//Serial.print("Pushing "); //Serial.print("Pushing ");
//Serial.print(numBytes); //Serial.print(numBytes);
//Serial.println(" bytes via I2C"); //Serial.println(" bytes via I2C");
myGNSS.pushRawData(((uint8_t *)&store), numBytes); // Push the RTCM data via I2C
//On processors which have large I2C buffers, like the ESP32, we can make the push more efficient by
//calling setI2CTransactionSize first to increase the maximum I2C transmission size
//(setI2CTransactionSize only needs to be called once, so it should be in setup, not loop)
//myGNSS.setI2CTransactionSize(128); // Send up to 128 bytes in one I2C transmission
//The ESP32 seems to have an issue when using a restarts to break up long RTCM pushes
//You may need to call pushRawData and set the optional 'stop' argument to true:
//myGNSS.pushRawData(((uint8_t *)&store), numBytes, true); // Push the RTCM data via I2C - always use stops on long RTCM pushes
myGNSS.pushRawData(((uint8_t *)&store), numBytes); // Push the RTCM data via I2C - using restarts to break up long I2C pushes
numBytes = 0; // Reset numBytes numBytes = 0; // Reset numBytes
} }
#endif #endif
+1 -1
View File
@@ -1,5 +1,5 @@
name=SparkFun u-blox GNSS Arduino Library name=SparkFun u-blox GNSS Arduino Library
version=2.0.6 version=2.0.7
author=SparkFun Electronics <techsupport@sparkfun.com> author=SparkFun Electronics <techsupport@sparkfun.com>
maintainer=SparkFun Electronics <sparkfun.com> maintainer=SparkFun Electronics <sparkfun.com>
sentence=Library for I2C and Serial Communication with u-blox GNSS modules<br/><br/> sentence=Library for I2C and Serial Communication with u-blox GNSS modules<br/><br/>
+16 -14
View File
@@ -1435,7 +1435,7 @@ void SFE_UBLOX_GNSS::processRTCMframe(uint8_t incoming)
//This function is called for each byte of an RTCM frame //This function is called for each byte of an RTCM frame
//Ths user can overwrite this function and process the RTCM frame as they please //Ths user can overwrite this function and process the RTCM frame as they please
//Bytes can be piped to Serial or other interface. The consumer could be a radio or the internet (Ntrip broadcaster) //Bytes can be piped to Serial or other interface. The consumer could be a radio or the internet (Ntrip broadcaster)
void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming) void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming) // IGNORE COMPILER WARNING unused parameter 'incoming'
{ {
//Radio.sendReliable((String)incoming); //An example of passing this byte to a radio //Radio.sendReliable((String)incoming); //An example of passing this byte to a radio
@@ -1458,7 +1458,7 @@ void SFE_UBLOX_GNSS::processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_
//If incomingUBX is a user-defined custom packet, then the payload size could be different to packetCfgPayloadSize. //If incomingUBX is a user-defined custom packet, then the payload size could be different to packetCfgPayloadSize.
//TO DO: update this to prevent an overrun when receiving an automatic message //TO DO: update this to prevent an overrun when receiving an automatic message
// and the incomingUBX payload size is smaller than packetCfgPayloadSize. // and the incomingUBX payload size is smaller than packetCfgPayloadSize.
size_t maximum_payload_size; uint16_t maximum_payload_size;
if (activePacketBuffer == SFE_UBLOX_PACKET_PACKETCFG) if (activePacketBuffer == SFE_UBLOX_PACKET_PACKETCFG)
maximum_payload_size = packetCfgPayloadSize; maximum_payload_size = packetCfgPayloadSize;
else if (activePacketBuffer == SFE_UBLOX_PACKET_PACKETAUTO) else if (activePacketBuffer == SFE_UBLOX_PACKET_PACKETAUTO)
@@ -2404,7 +2404,7 @@ void SFE_UBLOX_GNSS::processUBXpacket(ubxPacket *msg)
packetUBXESFMEAS->data.timeTag = extractLong(msg, 0); packetUBXESFMEAS->data.timeTag = extractLong(msg, 0);
packetUBXESFMEAS->data.flags.all = extractInt(msg, 4); packetUBXESFMEAS->data.flags.all = extractInt(msg, 4);
packetUBXESFMEAS->data.id = extractInt(msg, 6); packetUBXESFMEAS->data.id = extractInt(msg, 6);
for (int i = 0; (i < DEF_NUM_SENS) && (i < packetUBXESFMEAS->data.flags.bits.numMeas) for (uint16_t i = 0; (i < DEF_NUM_SENS) && (i < packetUBXESFMEAS->data.flags.bits.numMeas)
&& ((i * 4) < (msg->len - 8)); i++) && ((i * 4) < (msg->len - 8)); i++)
{ {
packetUBXESFMEAS->data.data[i].data.all = extractLong(msg, 8 + (i * 4)); packetUBXESFMEAS->data.data[i].data.all = extractLong(msg, 8 + (i * 4));
@@ -2435,10 +2435,10 @@ void SFE_UBLOX_GNSS::processUBXpacket(ubxPacket *msg)
//Parse various byte fields into storage - but only if we have memory allocated for it //Parse various byte fields into storage - but only if we have memory allocated for it
if (packetUBXESFRAW != NULL) if (packetUBXESFRAW != NULL)
{ {
for (int i = 0; (i < DEF_NUM_SENS) && ((i * 8) < (msg->len - 4)); i++) for (uint16_t i = 0; (i < DEF_NUM_SENS) && ((i * 8) < (msg->len - 4)); i++)
{ {
packetUBXESFRAW->data.data[i].data.all = extractLong(msg, 8 + (i * 8)); packetUBXESFRAW->data.data[i].data.all = extractLong(msg, 4 + (i * 8));
packetUBXESFRAW->data.data[i].sTag = extractLong(msg, 8 + (i * 8) + 4); packetUBXESFRAW->data.data[i].sTag = extractLong(msg, 8 + (i * 8));
} }
//Mark all datums as fresh (not read before) //Mark all datums as fresh (not read before)
@@ -2468,7 +2468,7 @@ void SFE_UBLOX_GNSS::processUBXpacket(ubxPacket *msg)
packetUBXESFSTATUS->data.version = extractByte(msg, 4); packetUBXESFSTATUS->data.version = extractByte(msg, 4);
packetUBXESFSTATUS->data.fusionMode = extractByte(msg, 12); packetUBXESFSTATUS->data.fusionMode = extractByte(msg, 12);
packetUBXESFSTATUS->data.numSens = extractByte(msg, 15); packetUBXESFSTATUS->data.numSens = extractByte(msg, 15);
for (int i = 0; (i < DEF_NUM_SENS) && (i < packetUBXESFSTATUS->data.numSens) for (uint16_t i = 0; (i < DEF_NUM_SENS) && (i < packetUBXESFSTATUS->data.numSens)
&& ((i * 4) < (msg->len - 16)); i++) && ((i * 4) < (msg->len - 16)); i++)
{ {
packetUBXESFSTATUS->data.status[i].sensStatus1.all = extractByte(msg, 16 + (i * 4) + 0); packetUBXESFSTATUS->data.status[i].sensStatus1.all = extractByte(msg, 16 + (i * 4) + 0);
@@ -2771,7 +2771,7 @@ void SFE_UBLOX_GNSS::sendSerialCommand(ubxPacket *outgoingUBX)
_serialPort->write(outgoingUBX->len >> 8); //MSB _serialPort->write(outgoingUBX->len >> 8); //MSB
//Write payload. //Write payload.
for (int i = 0; i < outgoingUBX->len; i++) for (uint16_t i = 0; i < outgoingUBX->len; i++)
{ {
_serialPort->write(outgoingUBX->payload[i]); _serialPort->write(outgoingUBX->payload[i]);
} }
@@ -2823,7 +2823,7 @@ void SFE_UBLOX_GNSS::printPacket(ubxPacket *packet, boolean alwaysPrintPayload)
{ {
_debugSerial->print(F(" Payload:")); _debugSerial->print(F(" Payload:"));
for (int x = 0; x < packet->len; x++) for (uint16_t x = 0; x < packet->len; x++)
{ {
_debugSerial->print(F(" ")); _debugSerial->print(F(" "));
_debugSerial->print(packet->payload[x], HEX); _debugSerial->print(packet->payload[x], HEX);
@@ -3394,7 +3394,9 @@ void SFE_UBLOX_GNSS::checkCallbacks(void)
// Push (e.g.) RTCM data directly to the module // Push (e.g.) RTCM data directly to the module
// Returns true if all numDataBytes were pushed successfully // Returns true if all numDataBytes were pushed successfully
// Warning: this function does not check that the data is valid. It is the user's responsibility to ensure the data is valid before pushing. // Warning: this function does not check that the data is valid. It is the user's responsibility to ensure the data is valid before pushing.
boolean SFE_UBLOX_GNSS::pushRawData(uint8_t *dataBytes, size_t numDataBytes) // Default to using a restart between transmissions. But processors like ESP32 seem to need a stop (#30). Set stop to true to use a stop instead.
// On processors like the ESP32, you can use setI2CTransactionSize to increase the size of each transmission - to e.g. 128 bytes
boolean SFE_UBLOX_GNSS::pushRawData(uint8_t *dataBytes, size_t numDataBytes, boolean stop)
{ {
if (commType == COMM_TYPE_SERIAL) if (commType == COMM_TYPE_SERIAL)
{ {
@@ -3425,12 +3427,12 @@ boolean SFE_UBLOX_GNSS::pushRawData(uint8_t *dataBytes, size_t numDataBytes)
if (bytesLeftToWrite > 0) if (bytesLeftToWrite > 0)
{ {
if (_i2cPort->endTransmission(false) != 0) //Send a restart command. Do not release bus. if (_i2cPort->endTransmission(stop) != 0) //Send a restart or stop command
return (false); //Sensor did not ACK return (false); //Sensor did not ACK
} }
else else
{ {
if (_i2cPort->endTransmission() != 0) //We're done. Release bus. if (_i2cPort->endTransmission() != 0) //We're done. Release bus. Always use a stop here
return (false); //Sensor did not ACK return (false); //Sensor did not ACK
} }
} }
@@ -10141,7 +10143,7 @@ uint16_t SFE_UBLOX_GNSS::getMagAcc(uint16_t maxWait)
} }
// getGeoidSeparation is currently redundant. The geoid separation seems to only be provided in NMEA GGA and GNS messages. // getGeoidSeparation is currently redundant. The geoid separation seems to only be provided in NMEA GGA and GNS messages.
int32_t SFE_UBLOX_GNSS::getGeoidSeparation(uint16_t maxWait) int32_t SFE_UBLOX_GNSS::getGeoidSeparation(uint16_t maxWait) // IGNORE COMPILER WARNING unused parameter 'maxWait'
{ {
return (0); return (0);
} }
+2 -1
View File
@@ -641,7 +641,8 @@ public:
// Push (e.g.) RTCM data directly to the module // Push (e.g.) RTCM data directly to the module
// Warning: this function does not check that the data is valid. It is the user's responsibility to ensure the data is valid before pushing. // Warning: this function does not check that the data is valid. It is the user's responsibility to ensure the data is valid before pushing.
boolean pushRawData(uint8_t *dataBytes, size_t numDataBytes); // Default to using a restart between transmissions. But processors like ESP32 seem to need a stop (#30). Set stop to true to use a stop instead.
boolean pushRawData(uint8_t *dataBytes, size_t numDataBytes, boolean stop = false);
// Support for data logging // Support for data logging
void setFileBufferSize(uint16_t bufferSize); // Set the size of the file buffer. This must be called _before_ .begin. void setFileBufferSize(uint16_t bufferSize); // Set the size of the file buffer. This must be called _before_ .begin.