Skip to content

Commit cde6db4

Browse files
committed
Fix more compiler warnings
1 parent 464de91 commit cde6db4

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

.github/workflows/compile-sketch.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,20 @@ jobs:
2727
platforms: |
2828
- name: esp32:esp32
2929
source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
30-
env: |
31-
- CS: 1
32-
- LED_BUILTIN: 13
3330
3431
# ESP32-S2
3532
# https://github.com/espressif/arduino-esp32/blob/master/boards.txt
3633
- fqbn: esp32:esp32:esp32s2
3734
platforms: |
3835
- name: esp32:esp32
3936
source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
40-
env: |
41-
- CS: 1
42-
- LED_BUILTIN: 13
4337
4438
# ESP32-C3
4539
# https://github.com/espressif/arduino-esp32/blob/master/boards.txt
4640
- fqbn: esp32:esp32:esp32c3
4741
platforms: |
4842
- name: esp32:esp32
4943
source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
50-
env: |
51-
- CS: 1
52-
- LED_BUILTIN: 13
5344
5445
# Artemis / Apollo3
5546
# https://github.com/sparkfun/Arduino_Apollo3/blob/main/boards.txt
@@ -64,8 +55,6 @@ jobs:
6455
platforms: |
6556
- name: esp8266:esp8266
6657
source-url: https://arduino.esp8266.com/stable/package_esp8266com_index.json
67-
env: |
68-
- CS: 1
6958
7059
# SAMD21
7160
# https://github.com/arduino/ArduinoCore-samd/blob/master/boards.txt
@@ -115,7 +104,6 @@ jobs:
115104
- examples/Example15_GetDateTime
116105
- examples/Example16_Nanosecond_MaxOutput
117106
- examples/Example16_PartialSecond_MaxOutput
118-
- examples/Example17_Geofence
119107
- examples/Example18_PowerSaveMode
120108
- examples/Example19_DynamicModel
121109
- examples/Example20_SendCustomCommand

src/SparkFun_u-blox_GNSS_Arduino_Library.cpp

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,7 +1650,7 @@ void SFE_UBLOX_GNSS::processRTCMframe(uint8_t incoming)
16501650
//Bytes can be piped to Serial or other interface. The consumer could be a radio or the internet (Ntrip broadcaster)
16511651
void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming)
16521652
{
1653-
uint8_t ignoreMe = incoming; // Do something with incoming just to get rid of the pesky compiler warning!
1653+
uint8_t ignoreMe = incoming; ignoreMe += 0; // Do something with incoming just to get rid of the pesky compiler warning!
16541654

16551655
//Radio.sendReliable((String)incoming); //An example of passing this byte to a radio
16561656

@@ -2934,7 +2934,7 @@ sfe_ublox_status_e SFE_UBLOX_GNSS::sendCommand(ubxPacket *outgoingUBX, uint16_t
29342934
//Returns false if sensor fails to respond to I2C traffic
29352935
sfe_ublox_status_e SFE_UBLOX_GNSS::sendI2cCommand(ubxPacket *outgoingUBX, uint16_t maxWait)
29362936
{
2937-
uint16_t ignoreMe = maxWait; // Do something with maxWait just to avoid the pesky compiler warnings!
2937+
uint16_t ignoreMe = maxWait; ignoreMe += 0; // Do something with maxWait just to avoid the pesky compiler warnings!
29382938

29392939
// From the integration guide:
29402940
// "The receiver does not provide any write access except for writing UBX and NMEA messages to the
@@ -3182,6 +3182,12 @@ void SFE_UBLOX_GNSS::sendSpiCommand(ubxPacket *outgoingUBX)
31823182
//Pretty prints the current ubxPacket
31833183
void SFE_UBLOX_GNSS::printPacket(ubxPacket *packet, bool alwaysPrintPayload)
31843184
{
3185+
// Only print the payload is ignoreThisPayload is false otherwise
3186+
// we could be printing gibberish from beyond the end of packetBuf
3187+
// (These two lines get rid of a pesky compiler warning)
3188+
bool printPayload = (ignoreThisPayload == false);
3189+
printPayload |= (alwaysPrintPayload == true);
3190+
31853191
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
31863192
if (_printDebug == true)
31873193
{
@@ -3216,9 +3222,7 @@ void SFE_UBLOX_GNSS::printPacket(ubxPacket *packet, bool alwaysPrintPayload)
32163222
_debugSerial->print(F(" Len: 0x"));
32173223
_debugSerial->print(packet->len, HEX);
32183224

3219-
// Only print the payload is ignoreThisPayload is false otherwise
3220-
// we could be printing gibberish from beyond the end of packetBuf
3221-
if ((alwaysPrintPayload == true) || (ignoreThisPayload == false))
3225+
if (printPayload)
32223226
{
32233227
_debugSerial->print(F(" Payload:"));
32243228

@@ -3234,6 +3238,12 @@ void SFE_UBLOX_GNSS::printPacket(ubxPacket *packet, bool alwaysPrintPayload)
32343238
}
32353239
_debugSerial->println();
32363240
}
3241+
#else
3242+
if (_printDebug == true)
3243+
{
3244+
_debugSerial->print(F("Len: 0x"));
3245+
_debugSerial->print(packet->len, HEX);
3246+
}
32373247
#endif
32383248
}
32393249

@@ -4297,12 +4307,15 @@ void SFE_UBLOX_GNSS::setSerialRate(uint32_t baudrate, uint8_t uartPort, uint16_t
42974307
#endif
42984308

42994309
sfe_ublox_status_e retVal = sendCommand(&packetCfg, maxWait);
4310+
43004311
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
43014312
if (_printDebug == true)
43024313
{
43034314
_debugSerial->print(F("setSerialRate: sendCommand returned: "));
43044315
_debugSerial->println(statusString(retVal));
43054316
}
4317+
#else
4318+
(void)retVal; // Get rid of a pesky compiler warning!
43064319
#endif
43074320
}
43084321

@@ -10740,7 +10753,7 @@ uint16_t SFE_UBLOX_GNSS::getMagAcc(uint16_t maxWait)
1074010753
// getGeoidSeparation is currently redundant. The geoid separation seems to only be provided in NMEA GGA and GNS messages.
1074110754
int32_t SFE_UBLOX_GNSS::getGeoidSeparation(uint16_t maxWait)
1074210755
{
10743-
uint16_t ignoreMe = maxWait; // Do something with maxWait just to get rid of the pesky compiler warning
10756+
uint16_t ignoreMe = maxWait; ignoreMe += 0; // Do something with maxWait just to get rid of the pesky compiler warning
1074410757

1074510758
return (0);
1074610759
}

0 commit comments

Comments
 (0)