gmag11 / ESPNtpClient

High accuracy NTP library for ESP32 and ESP8266
MIT License
118 stars 25 forks source link

Compilation errors on Debug Level 5 #39

Closed Addictek closed 2 years ago

Addictek commented 2 years ago

This is a minor problem with the library.

I've tried enabling debug level 5 setting:

#define DEBUG_NTPCLIENT 5

but I get compilation errors:

.pio\libdeps\esp12e\ESPNtpClient\src\ESPNtpClient.cpp: In member function 'boolean NTPClient::sendNTPpacket()':
.pio\libdeps\esp12e\ESPNtpClient\src\ESPNtpClient.cpp:743:49: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'char*' [-fpermissive]
  743 |     DEBUGLOGV ("NTP Packet\n%s", dumpNTPPacket ((uint8_t*)&packet, sizeof (NTPUndecodedPacket_t), strPacketBuffer, sizeStr));
      |                                                 ^~~~~~~~~~~~~~~~~
      |                                                 |
      |                                                 uint8_t* {aka unsigned char*}
.pio\libdeps\esp12e\ESPNtpClient\src\ESPNtpClient.cpp:12:87: note: in definition of macro 'DEBUGLOG'
   12 | #define DEBUGLOG(tag, text,...) DEBUG_LINE_PREFIX(tag);DBG_PORT.printf_P(PSTR(text),##__VA_ARGS__);DBG_PORT.println()
      |                                                                                       ^~~~~~~~~~~
.pio\libdeps\esp12e\ESPNtpClient\src\ESPNtpClient.cpp:743:5: note: in expansion of macro 'DEBUGLOGV'
  743 |     DEBUGLOGV ("NTP Packet\n%s", dumpNTPPacket ((uint8_t*)&packet, sizeof (NTPUndecodedPacket_t), strPacketBuffer, sizeStr));
      |     ^~~~~~~~~
.pio\libdeps\esp12e\ESPNtpClient\src\ESPNtpClient.cpp:133:28: note:   initializing argument 1 of 'char* dumpNTPPacket(char*, size_t, char*, int)'
  133 | char* dumpNTPPacket (char* data, size_t length, char* buffer, int len) {
      |                      ~~~~~~^~~~
.pio\libdeps\esp12e\ESPNtpClient\src\ESPNtpClient.cpp: In member function 'NTPPacket_t* NTPClient::decodeNtpMessage(uint8_t*, size_t, NTPPacket_t*)':
.pio\libdeps\esp12e\ESPNtpClient\src\ESPNtpClient.cpp:906:39: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'char*' [-fpermissive]
  906 |     DEBUGLOGV ("\n%s", dumpNTPPacket (messageBuffer, length, buffer, 250));
      |                                       ^~~~~~~~~~~~~
      |                                       |
      |                                       uint8_t* {aka unsigned char*}
.pio\libdeps\esp12e\ESPNtpClient\src\ESPNtpClient.cpp:12:87: note: in definition of macro 'DEBUGLOG'
   12 | #define DEBUGLOG(tag, text,...) DEBUG_LINE_PREFIX(tag);DBG_PORT.printf_P(PSTR(text),##__VA_ARGS__);DBG_PORT.println()
      |                                                                                       ^~~~~~~~~~~
.pio\libdeps\esp12e\ESPNtpClient\src\ESPNtpClient.cpp:906:5: note: in expansion of macro 'DEBUGLOGV'
  906 |     DEBUGLOGV ("\n%s", dumpNTPPacket (messageBuffer, length, buffer, 250));
      |     ^~~~~~~~~
.pio\libdeps\esp12e\ESPNtpClient\src\ESPNtpClient.cpp:133:28: note:   initializing argument 1 of 'char* dumpNTPPacket(char*, size_t, char*, int)'
  133 | char* dumpNTPPacket (char* data, size_t length, char* buffer, int len) {
      |                      ~~~~~~^~~~
*** [.pio\build\esp12e\liba8d\ESPNtpClient\ESPNtpClient.cpp.o] Error 1

Thanks.

gmag11 commented 2 years ago

This should be fixed in latest commit. Thank you