Skip to content

Commit a73adf4

Browse files
committed
Use IP address for NTP lookup when using MKR NB 1500 since these is usually no DNS available when using NB-IoT
1 parent 18d2b93 commit a73adf4

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/utility/time/NTPUtils.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,12 @@ void NTPUtils::sendNTPpacket(UDP & udp)
7777
ntp_packet_buf[13] = 0x4E;
7878
ntp_packet_buf[14] = 49;
7979
ntp_packet_buf[15] = 52;
80-
80+
81+
#ifdef ARDUINO_SAMD_MKRNB1500
82+
udp.beginPacket(NTP_TIME_SERVER_IP_1, NTP_TIME_SERVER_PORT);
83+
#else
8184
udp.beginPacket(NTP_TIME_SERVER, NTP_TIME_SERVER_PORT);
85+
#endif
8286
udp.write(ntp_packet_buf, NTP_PACKET_SIZE);
8387
udp.endPacket();
8488
}

src/utility/time/NTPUtils.h

+7
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@
3232

3333
#include <Udp.h>
3434

35+
/**************************************************************************************
36+
* CONSTANTS
37+
**************************************************************************************/
38+
39+
static IPAddress const NTP_TIME_SERVER_IP_1(35,204,74,237);
40+
static IPAddress const NTP_TIME_SERVER_IP_2(34,73,181,129);
41+
3542
/**************************************************************************************
3643
* CLASS DECLARATION
3744
**************************************************************************************/

0 commit comments

Comments
 (0)