Skip to content

Commit 85e851b

Browse files
author
noah-jonathan rosa
committed
Fix warnings
1 parent 2769510 commit 85e851b

6 files changed

Lines changed: 61 additions & 55 deletions

File tree

examples/X_NUCLEO_GNSS1A1_HelloWorld_I2C/X_NUCLEO_GNSS1A1_HelloWorld_I2C.ino

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ uint32_t t, s;
5151
int tracked;
5252
GPGGA_Info_t stored_positions[64];
5353
int status = 0;
54-
int stime = 0;
54+
uint32_t stime = 0;
5555
int waitType = 0;
5656

5757
#define MSG_SZ 256
@@ -60,6 +60,7 @@ int waitType = 0;
6060

6161
#ifdef ARDUINO_SAM_DUE
6262
#define DEV_I2C Wire1
63+
#include <avr/dtostrf.h>
6364
#endif
6465

6566
#ifdef ARDUINO_ARCH_STM32
@@ -173,8 +174,8 @@ void waitResponse()
173174
Serial.print("Saving NMEA msg configuration...\t");
174175
Serial.print("\r\n>");
175176
//send the message to save the new parameters and start waiting
176-
gps->sendCommand("$PSTMSAVEPAR");
177-
gps->askMessage("$PSTMSAVEPAR");
177+
gps->sendCommand((char *)"$PSTMSAVEPAR");
178+
gps->askMessage((char *)"$PSTMSAVEPAR");
178179
waitType=3;
179180
stime = millis();
180181
}
@@ -280,7 +281,7 @@ void AppCmdProcess (char *cmd)
280281
{
281282
//send the version command and wait for response
282283
gps->sendCommand(cmd);
283-
gps->askMessage("$PSTMVER");
284+
gps->askMessage((char *)"$PSTMVER");
284285
status = waitForAnswer;
285286
waitType=1;
286287
stime = millis();
@@ -330,7 +331,7 @@ void AppCmdProcess (char *cmd)
330331

331332
gps->sendCommand(gnssCmd);
332333

333-
gps->askMessage("$PSTMCFGMSGL");
334+
gps->askMessage((char *)"$PSTMCFGMSGL");
334335
status = waitForAnswer;
335336
waitType=2;
336337
stime = millis();
@@ -526,7 +527,7 @@ void getGNSInfo()
526527
dtostrf (data.gns_data.hdop, 2, 1, hdop);
527528
dtostrf (data.gns_data.geo_sep, 2, 1, geoid);
528529

529-
snprintf(msg, MSG_SZ, "UTC:\t\t\t[ %02d:%02d:%02d ]\r\n",
530+
snprintf(msg, MSG_SZ, "UTC:\t\t\t[ %02ld:%02ld:%02ld ]\r\n",
530531
data.gns_data.utc.hh,
531532
data.gns_data.utc.mm,
532533
data.gns_data.utc.ss);
@@ -584,7 +585,7 @@ void getGPGSTInfo()
584585
dtostrf (data.gpgst_data.lon_err_dev, 2, 1, lonerr);
585586
dtostrf (data.gpgst_data.alt_err_dev, 2, 1, alterr);
586587

587-
snprintf(msg, MSG_SZ, "UTC:\t\t\t[ %02d:%02d:%02d ]\r\n",
588+
snprintf(msg, MSG_SZ, "UTC:\t\t\t[ %02ld:%02ld:%02ld ]\r\n",
588589
data.gpgst_data.utc.hh,
589590
data.gpgst_data.utc.mm,
590591
data.gpgst_data.utc.ss);
@@ -681,7 +682,7 @@ void getGPRMCInfo()
681682
trackgood);
682683
Serial.print(msg);
683684

684-
snprintf(msg, MSG_SZ, "Date (ddmmyy):\t\t\t[ %d ]\r\n",
685+
snprintf(msg, MSG_SZ, "Date (ddmmyy):\t\t\t[ %ld ]\r\n",
685686
data.gprmc_data.date);
686687
Serial.print(msg);
687688

@@ -757,7 +758,7 @@ void getGSAInfo()
757758
Serial.print("-- Unknown op mode\r\n");
758759
}
759760

760-
snprintf(msg, MSG_SZ, "Current Mode:\t\t[ %d ]\t\t",
761+
snprintf(msg, MSG_SZ, "Current Mode:\t\t[ %ld ]\t\t",
761762
data.gsa_data.current_mode);
762763
Serial.print(msg);
763764

@@ -781,7 +782,7 @@ void getGSAInfo()
781782
int32_t *sat_prn = data.gsa_data.sat_prn;
782783
for (uint8_t i=0; i<12U; i++)
783784
{
784-
snprintf(msg, MSG_SZ, "SatPRN%02d:\t\t[ %d ]\r\n", i+1U,
785+
snprintf(msg, MSG_SZ, "SatPRN%02d:\t\t[ %ld ]\r\n", i+1U,
785786
*(&sat_prn[i]));
786787
Serial.print(msg);
787788
}
@@ -856,29 +857,29 @@ void getGSVInfo()
856857
/* nothing to do */
857858
}
858859

859-
snprintf(msg, MSG_SZ, "GSV message:\t\t[ %d of %d ]\r\n", number, amount);
860+
snprintf(msg, MSG_SZ, "GSV message:\t\t[ %ld of %ld ]\r\n", number, amount);
860861
Serial.print(msg);
861862

862-
snprintf(msg, MSG_SZ, "Num of Satellites:\t[ %d of %d ]\r\n", data.gsv_data.current_sats, tot_sats);
863+
snprintf(msg, MSG_SZ, "Num of Satellites:\t[ %ld of %ld ]\r\n", data.gsv_data.current_sats, tot_sats);
863864
Serial.print(msg);
864865

865866
Serial.print("\r\n");
866867

867868
for (i=0; i<current_sats; i++)
868869
{
869-
snprintf(msg, MSG_SZ, "Sat%02ldPRN:\t\t[ %03d ]\r\n", i+1+((number-1)*GSV_MSG_SATS),
870+
snprintf(msg, MSG_SZ, "Sat%02ldPRN:\t\t[ %03ld ]\r\n", i+1+((number-1)*GSV_MSG_SATS),
870871
data.gsv_data.gsv_sat_i[i].prn);
871872
Serial.print(msg);
872873

873-
snprintf(msg, MSG_SZ, "Sat%02ldElev (%c):\t\t[ %03d ]\r\n", i+1+((number-1)*GSV_MSG_SATS), degree_ext_ASCII_char,
874+
snprintf(msg, MSG_SZ, "Sat%02ldElev (%c):\t\t[ %03ld ]\r\n", i+1+((number-1)*GSV_MSG_SATS), degree_ext_ASCII_char,
874875
data.gsv_data.gsv_sat_i[i].elev);
875876
Serial.print(msg);
876877

877-
snprintf(msg, MSG_SZ, "Sat%02ldAzim (%c):\t\t[ %03d ]\r\n", i+1+((number-1)*GSV_MSG_SATS), degree_ext_ASCII_char,
878+
snprintf(msg, MSG_SZ, "Sat%02ldAzim (%c):\t\t[ %03ld ]\r\n", i+1+((number-1)*GSV_MSG_SATS), degree_ext_ASCII_char,
878879
data.gsv_data.gsv_sat_i[i].azim);
879880
Serial.print(msg);
880881

881-
snprintf(msg, MSG_SZ, "Sat%02ldCN0 (dB):\t\t[ %03d ]\r\n", i+1+((number-1)*GSV_MSG_SATS),
882+
snprintf(msg, MSG_SZ, "Sat%02ldCN0 (dB):\t\t[ %03ld ]\r\n", i+1+((number-1)*GSV_MSG_SATS),
882883
data.gsv_data.gsv_sat_i[i].cn0);
883884
Serial.print(msg);
884885

@@ -910,7 +911,7 @@ void printHelp(void)
910911
int trackGotPos(uint32_t how_many, uint32_t time)
911912
{
912913
int tracked = 0;
913-
int i = 0;
914+
uint32_t i = 0;
914915
int startTime = millis();
915916
while (i<how_many)
916917
{
@@ -923,7 +924,7 @@ int trackGotPos(uint32_t how_many, uint32_t time)
923924
break;
924925
}
925926
tracked++;
926-
snprintf(msg, MSG_SZ, "Position %d just get.\r\n", i + 1U);
927+
snprintf(msg, MSG_SZ, "Position %ld just get.\r\n", i + 1U);
927928
Serial.print(msg);
928929
if(data.debug == DEBUG_ON)
929930
printValidInfo();
@@ -948,10 +949,10 @@ void printTrackedPositions (uint32_t how_many)
948949
dtostrf (stored_positions[i].xyz.alt, 3, 2, alt);
949950
dtostrf (stored_positions[i].acc, 4, 1, acc);
950951

951-
snprintf(msg, MSG_SZ, "Position n. %d:\r\n", i + 1U);
952+
snprintf(msg, MSG_SZ, "Position n. %ld:\r\n", i + 1U);
952953
Serial.print(msg);
953954

954-
snprintf(msg, MSG_SZ, "UTC:\t\t\t[ %02d:%02d:%02d ]\r\n",
955+
snprintf(msg, MSG_SZ, "UTC:\t\t\t[ %02ld:%02ld:%02ld ]\r\n",
955956
stored_positions[i].utc.hh, stored_positions[i].utc.mm, stored_positions[i].utc.ss);
956957
Serial.print(msg);
957958

@@ -967,7 +968,7 @@ void printTrackedPositions (uint32_t how_many)
967968
stored_positions[i].xyz.ew);
968969
Serial.print(msg);
969970

970-
snprintf(msg, MSG_SZ, "Satellites locked:\t[ %d ]\r\n",
971+
snprintf(msg, MSG_SZ, "Satellites locked:\t[ %ld ]\r\n",
971972
stored_positions[i].sats);
972973
Serial.print(msg);
973974

@@ -980,12 +981,12 @@ void printTrackedPositions (uint32_t how_many)
980981
(stored_positions[i].xyz.mis + 32U));
981982
Serial.print(msg);
982983

983-
snprintf(msg, MSG_SZ, "Geoid infos:\t\t[ %d%c ]\r\n",
984+
snprintf(msg, MSG_SZ, "Geoid infos:\t\t[ %ld%c ]\r\n",
984985
stored_positions[i].geoid.height,
985986
stored_positions[i].geoid.mis);
986987
Serial.print(msg);
987988

988-
snprintf(msg, MSG_SZ, "Diff update:\t\t[ %d ]\r\n",
989+
snprintf(msg, MSG_SZ, "Diff update:\t\t[ %ld ]\r\n",
989990
stored_positions[i].update);
990991
Serial.print(msg);
991992

examples/X_NUCLEO_GNSS1A1_HelloWorld_UART/X_NUCLEO_GNSS1A1_HelloWorld_UART.ino

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ uint32_t t, s;
5353
int tracked;
5454
GPGGA_Info_t stored_positions[64];
5555
int status = 0;
56-
int stime = 0;
56+
uint32_t stime = 0;
5757
int waitType = 0;
5858

5959
#ifdef ARDUINO_ARCH_STM32
@@ -64,6 +64,11 @@ HardwareSerial Serial1(PA10, PA9);
6464
#define waitForRequest 0
6565
#define waitForAnswer 1
6666

67+
#ifdef ARDUINO_SAM_DUE
68+
#include <avr/dtostrf.h>
69+
#endif
70+
71+
6772
void setup()
6873
{
6974
//Initialize serial port for user communication
@@ -170,8 +175,8 @@ void waitResponse ()
170175
Serial.print("Saving NMEA msg configuration...\t");
171176
Serial.print("\r\n>");
172177
//send the message to save the new parameters and start waiting
173-
gps->sendCommand("$PSTMSAVEPAR");
174-
gps->askMessage("$PSTMSAVEPAR");
178+
gps->sendCommand((char *)"$PSTMSAVEPAR");
179+
gps->askMessage((char *)"$PSTMSAVEPAR");
175180
waitType=3;
176181
stime = millis();
177182
}
@@ -277,7 +282,7 @@ void AppCmdProcess (char *cmd)
277282
{
278283
//send the version command and wait for response
279284
gps->sendCommand(cmd);
280-
gps->askMessage("$PSTMVER");
285+
gps->askMessage((char *)"$PSTMVER");
281286
status = waitForAnswer;
282287
waitType=1;
283288
stime = millis();
@@ -327,7 +332,7 @@ void AppCmdProcess (char *cmd)
327332

328333
gps->sendCommand(gnssCmd);
329334

330-
gps->askMessage("$PSTMCFGMSGL");
335+
gps->askMessage((char *)"$PSTMCFGMSGL");
331336
status = waitForAnswer;
332337
waitType=2;
333338
stime = millis();
@@ -523,7 +528,7 @@ void getGNSInfo()
523528
dtostrf (data.gns_data.hdop, 2, 1, hdop);
524529
dtostrf (data.gns_data.geo_sep, 2, 1, geoid);
525530

526-
snprintf(msg, MSG_SZ, "UTC:\t\t\t[ %02d:%02d:%02d ]\r\n",
531+
snprintf(msg, MSG_SZ, "UTC:\t\t\t[ %02ld:%02ld:%02ld ]\r\n",
527532
data.gns_data.utc.hh,
528533
data.gns_data.utc.mm,
529534
data.gns_data.utc.ss);
@@ -581,7 +586,7 @@ void getGPGSTInfo()
581586
dtostrf (data.gpgst_data.lon_err_dev, 2, 1, lonerr);
582587
dtostrf (data.gpgst_data.alt_err_dev, 2, 1, alterr);
583588

584-
snprintf(msg, MSG_SZ, "UTC:\t\t\t[ %02d:%02d:%02d ]\r\n",
589+
snprintf(msg, MSG_SZ, "UTC:\t\t\t[ %02ld:%02ld:%02ld ]\r\n",
585590
data.gpgst_data.utc.hh,
586591
data.gpgst_data.utc.mm,
587592
data.gpgst_data.utc.ss);
@@ -678,7 +683,7 @@ void getGPRMCInfo()
678683
trackgood);
679684
Serial.print(msg);
680685

681-
snprintf(msg, MSG_SZ, "Date (ddmmyy):\t\t\t[ %d ]\r\n",
686+
snprintf(msg, MSG_SZ, "Date (ddmmyy):\t\t\t[ %ld ]\r\n",
682687
data.gprmc_data.date);
683688
Serial.print(msg);
684689

@@ -754,7 +759,7 @@ void getGSAInfo()
754759
Serial.print("-- Unknown op mode\r\n");
755760
}
756761

757-
snprintf(msg, MSG_SZ, "Current Mode:\t\t[ %d ]\t\t",
762+
snprintf(msg, MSG_SZ, "Current Mode:\t\t[ %ld ]\t\t",
758763
data.gsa_data.current_mode);
759764
Serial.print(msg);
760765

@@ -778,7 +783,7 @@ void getGSAInfo()
778783
int32_t *sat_prn = data.gsa_data.sat_prn;
779784
for (uint8_t i=0; i<12U; i++)
780785
{
781-
snprintf(msg, MSG_SZ, "SatPRN%02d:\t\t[ %d ]\r\n", i+1U,
786+
snprintf(msg, MSG_SZ, "SatPRN%02d:\t\t[ %ld ]\r\n", i+1U,
782787
*(&sat_prn[i]));
783788
Serial.print(msg);
784789
}
@@ -853,29 +858,29 @@ void getGSVInfo()
853858
/* nothing to do */
854859
}
855860

856-
snprintf(msg, MSG_SZ, "GSV message:\t\t[ %d of %d ]\r\n", number, amount);
861+
snprintf(msg, MSG_SZ, "GSV message:\t\t[ %ld of %ld ]\r\n", number, amount);
857862
Serial.print(msg);
858863

859-
snprintf(msg, MSG_SZ, "Num of Satellites:\t[ %d of %d ]\r\n", data.gsv_data.current_sats, tot_sats);
864+
snprintf(msg, MSG_SZ, "Num of Satellites:\t[ %ld of %ld ]\r\n", data.gsv_data.current_sats, tot_sats);
860865
Serial.print(msg);
861866

862867
Serial.print("\r\n");
863868

864869
for (i=0; i<current_sats; i++)
865870
{
866-
snprintf(msg, MSG_SZ, "Sat%02ldPRN:\t\t[ %03d ]\r\n", i+1+((number-1)*GSV_MSG_SATS),
871+
snprintf(msg, MSG_SZ, "Sat%02ldPRN:\t\t[ %03ld ]\r\n", i+1+((number-1)*GSV_MSG_SATS),
867872
data.gsv_data.gsv_sat_i[i].prn);
868873
Serial.print(msg);
869874

870-
snprintf(msg, MSG_SZ, "Sat%02ldElev (%c):\t\t[ %03d ]\r\n", i+1+((number-1)*GSV_MSG_SATS), degree_ext_ASCII_char,
875+
snprintf(msg, MSG_SZ, "Sat%02ldElev (%c):\t\t[ %03ld ]\r\n", i+1+((number-1)*GSV_MSG_SATS), degree_ext_ASCII_char,
871876
data.gsv_data.gsv_sat_i[i].elev);
872877
Serial.print(msg);
873878

874-
snprintf(msg, MSG_SZ, "Sat%02ldAzim (%c):\t\t[ %03d ]\r\n", i+1+((number-1)*GSV_MSG_SATS), degree_ext_ASCII_char,
879+
snprintf(msg, MSG_SZ, "Sat%02ldAzim (%c):\t\t[ %03ld ]\r\n", i+1+((number-1)*GSV_MSG_SATS), degree_ext_ASCII_char,
875880
data.gsv_data.gsv_sat_i[i].azim);
876881
Serial.print(msg);
877882

878-
snprintf(msg, MSG_SZ, "Sat%02ldCN0 (dB):\t\t[ %03d ]\r\n", i+1+((number-1)*GSV_MSG_SATS),
883+
snprintf(msg, MSG_SZ, "Sat%02ldCN0 (dB):\t\t[ %03ld ]\r\n", i+1+((number-1)*GSV_MSG_SATS),
879884
data.gsv_data.gsv_sat_i[i].cn0);
880885
Serial.print(msg);
881886

@@ -907,7 +912,7 @@ void printHelp(void)
907912
int trackGotPos(uint32_t how_many, uint32_t time)
908913
{
909914
int tracked = 0;
910-
int i = 0;
915+
uint32_t i = 0;
911916
int startTime = millis();
912917
while (i<how_many)
913918
{
@@ -920,7 +925,7 @@ int trackGotPos(uint32_t how_many, uint32_t time)
920925
break;
921926
}
922927
tracked++;
923-
snprintf(msg, MSG_SZ, "Position %d just get.\r\n", i + 1U);
928+
snprintf(msg, MSG_SZ, "Position %ld just get.\r\n", i + 1U);
924929
Serial.print(msg);
925930
if(data.debug == DEBUG_ON)
926931
printValidInfo();
@@ -945,10 +950,10 @@ void printTrackedPositions (uint32_t how_many)
945950
dtostrf (stored_positions[i].xyz.alt, 3, 2, alt);
946951
dtostrf (stored_positions[i].acc, 4, 1, acc);
947952

948-
snprintf(msg, MSG_SZ, "Position n. %d:\r\n", i + 1U);
953+
snprintf(msg, MSG_SZ, "Position n. %ld:\r\n", i + 1U);
949954
Serial.print(msg);
950955

951-
snprintf(msg, MSG_SZ, "UTC:\t\t\t[ %02d:%02d:%02d ]\r\n",
956+
snprintf(msg, MSG_SZ, "UTC:\t\t\t[ %02ld:%02ld:%02ld ]\r\n",
952957
stored_positions[i].utc.hh, stored_positions[i].utc.mm, stored_positions[i].utc.ss);
953958
Serial.print(msg);
954959

@@ -964,7 +969,7 @@ void printTrackedPositions (uint32_t how_many)
964969
stored_positions[i].xyz.ew);
965970
Serial.print(msg);
966971

967-
snprintf(msg, MSG_SZ, "Satellites locked:\t[ %d ]\r\n",
972+
snprintf(msg, MSG_SZ, "Satellites locked:\t[ %ld ]\r\n",
968973
stored_positions[i].sats);
969974
Serial.print(msg);
970975

@@ -977,12 +982,12 @@ void printTrackedPositions (uint32_t how_many)
977982
(stored_positions[i].xyz.mis + 32U));
978983
Serial.print(msg);
979984

980-
snprintf(msg, MSG_SZ, "Geoid infos:\t\t[ %d%c ]\r\n",
985+
snprintf(msg, MSG_SZ, "Geoid infos:\t\t[ %ld%c ]\r\n",
981986
stored_positions[i].geoid.height,
982987
stored_positions[i].geoid.mis);
983988
Serial.print(msg);
984989

985-
snprintf(msg, MSG_SZ, "Diff update:\t\t[ %d ]\r\n",
990+
snprintf(msg, MSG_SZ, "Diff update:\t\t[ %ld ]\r\n",
986991
stored_positions[i].update);
987992
Serial.print(msg);
988993

examples/X_NUCLEO_GNSS1A1_MicroNMEA_I2C/X_NUCLEO_GNSS1A1_MicroNMEA_I2C.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ void setup(void)
140140
console.println("... done");
141141

142142
// Change the echoing messages to the ones recognized by the MicroNMEA library
143-
sendCommand("$PSTMSETPAR,1231,0x00000042");
144-
sendCommand("$PSTMSAVEPAR");
143+
sendCommand((char *)"$PSTMSETPAR,1231,0x00000042");
144+
sendCommand((char *)"$PSTMSAVEPAR");
145145

146146
//Reset the device so that the changes could take plaace
147-
sendCommand("$PSTMSRR");
147+
sendCommand((char *)"$PSTMSRR");
148148

149149
delay(4000);
150150

@@ -168,8 +168,8 @@ void setup(void)
168168
}
169169
while ((uint8_t) c != 0xFF);
170170

171-
pinMode(2, INPUT);
172-
attachInterrupt(digitalPinToInterrupt(2), ppsHandler, RISING);
171+
pinMode(6, INPUT);
172+
attachInterrupt(digitalPinToInterrupt(6), ppsHandler, RISING);
173173
}
174174

175175
void loop(void)

0 commit comments

Comments
 (0)