File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ extern "C"
1717#include " lwip/sockets.h"
1818#include " lwip/dhcp.h"
1919#include " lwip/netif.h"
20+ #include < lwip/apps/sntp.h>
2021}
2122
2223int errorCode;
@@ -188,6 +189,12 @@ void LWIP_SOCKETS_Driver::Status_callback(struct netif *netif)
188189 PostAddressChangedContinuation.Enqueue ();
189190 }
190191
192+ // need to restart SNTP client
193+ #if SNTP_SERVER_DNS
194+ sntp_stop ();
195+ sntp_init ();
196+ #endif
197+
191198#if !defined(BUILD_RTM)
192199 // lcd_printf("\f\n\n\n\n\n\nLink Update: %s\n", (netif_is_up(netif) ? "UP " : "DOWN"));
193200 // lcd_printf(" IP: %d.%d.%d.%d\n", (netif->ip_addr.addr >> 0) & 0xFF,
Original file line number Diff line number Diff line change @@ -256,7 +256,12 @@ void lwipDefaultLinkUpCB(void *p)
256256#endif
257257
258258#if SNTP_SERVER_DNS
259- sntp_init ();
259+ // if not using DHCP then start SNTP
260+ // otherwise SNTP will be started when DHCP request succeeds
261+ if (addressMode != NET_ADDRESS_DHCP )
262+ {
263+ sntp_init ();
264+ }
260265#endif
261266}
262267
You can’t perform that action at this time.
0 commit comments