From 2407d7e2876ee6393a07f2c78c076225ecfeea29 Mon Sep 17 00:00:00 2001 From: Francois <thiebolt@irit.fr> Date: Wed, 17 Aug 2022 12:34:43 +0200 Subject: [PATCH] corrected display of currently used NTP server(s) --- ChangeLog.txt | 4 +--- neosensor/neosensor.ino | 24 +++++++----------------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 2d348cf9..8af99644 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -2,16 +2,14 @@ # neOCampus operation # (c) neOCampus / F.Thiebolt Université Toulouse3, Laboratoire IRIT -=== upcoming feature-SDKupgrade +=== Release 220815 / upcoming feature-SDKupgrade Bumps to esp32 2.0.4 Bumps to esp8266 3.0.2 - we're still using the deprecated SPIFFS filesystem - updated boards.local.txt - _http_get now makes use of newer API involving a WIFIClient variable - uniformized sntp includes for all ESP :) - TBC that NTP servers sent by the DHCP server are in use - WIFImanager now used without mod - TBC that options appears valid when setting up the device - switched noise ISR from ICACHE_RAM_ATTR to newer IRAM_ATTR [esp32] - recompiled lwip for NTP server support from DHCP answer (IDF 4.4.2) diff --git a/neosensor/neosensor.ino b/neosensor/neosensor.ino index 0f45b83f..eccde383 100644 --- a/neosensor/neosensor.ino +++ b/neosensor/neosensor.ino @@ -394,25 +394,15 @@ void endLoop( void ) { // display NTP servers used for time sync if( _cbtime_call ) { _cbtime_call = false; - + + //log_debug(F("\n[NTP_sync] IP_ADDR_ANY = "));log_debug(ipaddr_ntoa(&ip_addr_any));log_flush(); + // list active ntp servers for( uint8_t i=0; i<SNTP_MAX_SERVERS; i++ ) { - IPAddress sntp = *(IPAddress *)sntp_getserver(i); - const char* sntp_name = sntp_getservername(i); - // check if address is valid -#ifdef ESP8266 - if( sntp.isSet() ) { -#elif defined(ESP32) - if( sntp != IPADDR_ANY ) { -#endif - log_debugF("\n[NTP][%d]: ", i); - if( sntp_name ) { - log_debugF("%s (%s) ", sntp_name, sntp.toString().c_str()); - } else { - log_debugF("%s ", sntp.toString().c_str()); - } - } - } + const ip_addr_t* p_cur = sntp_getserver(i); + if( ip_addr_cmp(p_cur, IP_ADDR_ANY) ) continue; + log_debug(F("\n[NTP_sync] IPaddr = "));log_debug(ipaddr_ntoa(p_cur));log_flush(); + } } // serial link activity marker ... -- GitLab