@@ -53,7 +53,7 @@ uint32_t t, s;
5353int tracked;
5454GPGGA_Info_t stored_positions[64 ];
5555int status = 0 ;
56- int stime = 0 ;
56+ uint32_t stime = 0 ;
5757int 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+
6772void 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)
907912int 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
0 commit comments