@ -31,7 +31,7 @@ Main::Main(void) { 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					    mEep  =  new  eep ( ) ;  
					 
					 
					    mEep  =  new  eep ( ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    Serial . begin ( 115200 ) ;  
					 
					 
					    Serial . begin ( 115200 ) ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    DPRINTL N ( F ( " Main::Main " ) ) ;  
					 
					 
					    DBGMAI N ( F ( " Main::Main " ) ) ;  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					    mUptimeSecs      =  0 ;  
					 
					 
					    mUptimeSecs      =  0 ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    mUptimeTicker    =  0xffffffff ;  
					 
					 
					    mUptimeTicker    =  0xffffffff ;  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -45,7 +45,7 @@ Main::Main(void) { 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					//-----------------------------------------------------------------------------
  
					 
					 
					//-----------------------------------------------------------------------------
  
				
			 
			
		
	
		
		
			
				
					 
					 
					void  Main : : setup ( uint32_t  timeout )  {  
					 
					 
					void  Main : : setup ( uint32_t  timeout )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    DPRINTL N ( F ( " Main::setup " ) ) ;  
					 
					 
					    DBGMAI N ( F ( " Main::setup " ) ) ;  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					    bool  startAp  =  mApActive ;  
					 
					 
					    bool  startAp  =  mApActive ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    mLimit  =  timeout ;  
					 
					 
					    mLimit  =  timeout ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					@ -74,7 +74,7 @@ void Main::setup(uint32_t timeout) { 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					//-----------------------------------------------------------------------------
  
					 
					 
					//-----------------------------------------------------------------------------
  
				
			 
			
		
	
		
		
			
				
					 
					 
					void  Main : : loop ( void )  {  
					 
					 
					void  Main : : loop ( void )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    //DPRINT (F("M"));
  
					 
					 
					    //DBGMAIN (F("M"));
  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					    if ( mApActive )  {  
					 
					 
					    if ( mApActive )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					        mDns - > processNextRequest ( ) ;  
					 
					 
					        mDns - > processNextRequest ( ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					# ifndef AP_ONLY  
					 
					 
					# ifndef AP_ONLY  
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					@ -123,7 +123,7 @@ void Main::loop(void) { 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					//-----------------------------------------------------------------------------
  
					 
					 
					//-----------------------------------------------------------------------------
  
				
			 
			
		
	
		
		
			
				
					 
					 
					bool  Main : : getConfig ( void )  {  
					 
					 
					bool  Main : : getConfig ( void )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    DPRINTL N ( F ( " Main::getConfig " ) ) ;  
					 
					 
					    DBGMAI N ( F ( " Main::getConfig " ) ) ;  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					    bool  mApActive  =  false ;  
					 
					 
					    bool  mApActive  =  false ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					    mWifiSettingsValid  =  checkEEpCrc ( ADDR_START ,  ADDR_WIFI_CRC ,  ADDR_WIFI_CRC ) ;  
					 
					 
					    mWifiSettingsValid  =  checkEEpCrc ( ADDR_START ,  ADDR_WIFI_CRC ,  ADDR_WIFI_CRC ) ;  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -146,7 +146,7 @@ bool Main::getConfig(void) { 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					//-----------------------------------------------------------------------------
  
					 
					 
					//-----------------------------------------------------------------------------
  
				
			 
			
		
	
		
		
			
				
					 
					 
					void  Main : : setupAp ( const  char  * ssid ,  const  char  * pwd )  {  
					 
					 
					void  Main : : setupAp ( const  char  * ssid ,  const  char  * pwd )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    DPRINTL N ( F ( " Main::setupAp " ) ) ;  
					 
					 
					    DBGMAI N ( F ( " Main::setupAp " ) ) ;  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					    IPAddress  apIp ( 192 ,  168 ,  1 ,  1 ) ;  
					 
					 
					    IPAddress  apIp ( 192 ,  168 ,  1 ,  1 ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					    DPRINTLN ( F ( " \n --------- \n AP MODE \n SSDI:  " )  
					 
					 
					    DPRINTLN ( F ( " \n --------- \n AP MODE \n SSDI:  " )  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -154,7 +154,7 @@ void Main::setupAp(const char *ssid, const char *pwd) { 
				
			 
			
		
	
		
		
			
				
					 
					 
					        +  String ( pwd )  +  F ( " \n Active for:  " )  
					 
					 
					        +  String ( pwd )  +  F ( " \n Active for:  " )  
				
			 
			
		
	
		
		
			
				
					 
					 
					        +  String ( WIFI_AP_ACTIVE_TIME )  +  F ( "  seconds " )  
					 
					 
					        +  String ( WIFI_AP_ACTIVE_TIME )  +  F ( "  seconds " )  
				
			 
			
		
	
		
		
			
				
					 
					 
					        +  F ( " \n --------- \n " ) ) ;  
					 
					 
					        +  F ( " \n --------- \n " ) ) ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    DPRINTL N ( " DBG:  "  +  String ( mNextTryTs ) ) ;  
					 
					 
					    DBGMAI N ( " DBG:  "  +  String ( mNextTryTs ) ) ;  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					    WiFi . mode ( WIFI_AP ) ;  
					 
					 
					    WiFi . mode ( WIFI_AP ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    WiFi . softAPConfig ( apIp ,  apIp ,  IPAddress ( 255 ,  255 ,  255 ,  0 ) ) ;  
					 
					 
					    WiFi . softAPConfig ( apIp ,  apIp ,  IPAddress ( 255 ,  255 ,  255 ,  0 ) ) ;  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -173,7 +173,7 @@ void Main::setupAp(const char *ssid, const char *pwd) { 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					//-----------------------------------------------------------------------------
  
					 
					 
					//-----------------------------------------------------------------------------
  
				
			 
			
		
	
		
		
			
				
					 
					 
					bool  Main : : setupStation ( uint32_t  timeout )  {  
					 
					 
					bool  Main : : setupStation ( uint32_t  timeout )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    DPRINTL N ( F ( " Main::setupStation " ) ) ;  
					 
					 
					    DBGMAI N ( F ( " Main::setupStation " ) ) ;  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					    int32_t  cnt ;  
					 
					 
					    int32_t  cnt ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    bool  startAp  =  false ;  
					 
					 
					    bool  startAp  =  false ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					@ -223,7 +223,7 @@ bool Main::setupStation(uint32_t timeout) { 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					//-----------------------------------------------------------------------------
  
					 
					 
					//-----------------------------------------------------------------------------
  
				
			 
			
		
	
		
		
			
				
					 
					 
					void  Main : : showSetup ( void )  {  
					 
					 
					void  Main : : showSetup ( void )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    DPRINTL N ( F ( " Main::showSetup " ) ) ;  
					 
					 
					    DBGMAI N ( F ( " Main::showSetup " ) ) ;  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					    String  html  =  FPSTR ( setup_html ) ;  
					 
					 
					    String  html  =  FPSTR ( setup_html ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    html . replace ( F ( " {SSID} " ) ,  mStationSsid ) ;  
					 
					 
					    html . replace ( F ( " {SSID} " ) ,  mStationSsid ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    // PWD will be left at the default value (for protection)
  
					 
					 
					    // PWD will be left at the default value (for protection)
  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -241,21 +241,23 @@ void Main::showSetup(void) { 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					//-----------------------------------------------------------------------------
  
					 
					 
					//-----------------------------------------------------------------------------
  
				
			 
			
		
	
		
		
			
				
					 
					 
					void  Main : : showCss ( void )  {  
					 
					 
					void  Main : : showCss ( void )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    DPRINTL N ( F ( " Main::showCss " ) ) ;  
					 
					 
					    DBGMAI N ( F ( " Main::showCss " ) ) ;  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					    mWeb - > send ( 200 ,  " text/css " ,  FPSTR ( style_css ) ) ;  
					 
					 
					    mWeb - > send ( 200 ,  " text/css " ,  FPSTR ( style_css ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					}  
					 
					 
					}  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					//-----------------------------------------------------------------------------
  
					 
					 
					//-----------------------------------------------------------------------------
  
				
			 
			
		
	
		
		
			
				
					 
					 
					void  Main : : showSave ( void )  {  
					 
					 
					void  Main : : showSave ( void )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					# ifdef DEBUG_HMMAIN  
				
			 
			
		
	
		
		
			
				
					 
					 
					    DPRINTLN ( F ( " Main::showSave " ) ) ;  
					 
					 
					    DPRINTLN ( F ( " Main::showSave " ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					# endif  
				
			 
			
		
	
		
		
			
				
					 
					 
					    saveValues ( true ) ;  
					 
					 
					    saveValues ( true ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					}  
					 
					 
					}  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					//-----------------------------------------------------------------------------
  
					 
					 
					//-----------------------------------------------------------------------------
  
				
			 
			
		
	
		
		
			
				
					 
					 
					void  Main : : saveValues ( bool  webSend  =  true )  {  
					 
					 
					void  Main : : saveValues ( bool  webSend  =  true )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    DPRINTL N ( F ( " Main::saveValues " ) ) ;  
					 
					 
					    DBGMAI N ( F ( " Main::saveValues " ) ) ;  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					    if ( mWeb - > args ( )  >  0 )  {  
					 
					 
					    if ( mWeb - > args ( )  >  0 )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					        if ( mWeb - > arg ( " ssid " )  ! =  " " )  {  
					 
					 
					        if ( mWeb - > arg ( " ssid " )  ! =  " " )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					            memset ( mStationSsid ,  0 ,  SSID_LEN ) ;  
					 
					 
					            memset ( mStationSsid ,  0 ,  SSID_LEN ) ;  
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					@ -289,7 +291,7 @@ void Main::saveValues(bool webSend = true) { 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					//-----------------------------------------------------------------------------
  
					 
					 
					//-----------------------------------------------------------------------------
  
				
			 
			
		
	
		
		
			
				
					 
					 
					void  Main : : updateCrc ( void )  {  
					 
					 
					void  Main : : updateCrc ( void )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    DPRINTL N ( F ( " Main::updateCrc " ) ) ;  
					 
					 
					    DBGMAI N ( F ( " Main::updateCrc " ) ) ;  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					    uint16_t  crc ;  
					 
					 
					    uint16_t  crc ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    crc  =  buildEEpCrc ( ADDR_START ,  ADDR_WIFI_CRC ) ;  
					 
					 
					    crc  =  buildEEpCrc ( ADDR_START ,  ADDR_WIFI_CRC ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    //Serial.println("new CRC: " + String(crc, HEX));
  
					 
					 
					    //Serial.println("new CRC: " + String(crc, HEX));
  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -300,7 +302,7 @@ void Main::updateCrc(void) { 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					//-----------------------------------------------------------------------------
  
					 
					 
					//-----------------------------------------------------------------------------
  
				
			 
			
		
	
		
		
			
				
					 
					 
					void  Main : : showUptime ( void )  {  
					 
					 
					void  Main : : showUptime ( void )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    //DPRINTL N(F("Main::showUptime"));
  
					 
					 
					    //DBGMAI N(F("Main::showUptime"));
  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					    char  time [ 20 ]  =  { 0 } ;  
					 
					 
					    char  time [ 20 ]  =  { 0 } ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					    int  upTimeSc  =  uint32_t ( ( mUptimeSecs )  %  60 ) ;  
					 
					 
					    int  upTimeSc  =  uint32_t ( ( mUptimeSecs )  %  60 ) ;  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -316,14 +318,14 @@ void Main::showUptime(void) { 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					//-----------------------------------------------------------------------------
  
					 
					 
					//-----------------------------------------------------------------------------
  
				
			 
			
		
	
		
		
			
				
					 
					 
					void  Main : : showTime ( void )  {  
					 
					 
					void  Main : : showTime ( void )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    //DPRINTL N(F("Main::showTime"));
  
					 
					 
					    //DBGMAI N(F("Main::showTime"));
  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					    mWeb - > send ( 200 ,  " text/plain " ,  getDateTimeStr ( mTimestamp ) ) ;  
					 
					 
					    mWeb - > send ( 200 ,  " text/plain " ,  getDateTimeStr ( mTimestamp ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					}  
					 
					 
					}  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					//-----------------------------------------------------------------------------
  
					 
					 
					//-----------------------------------------------------------------------------
  
				
			 
			
		
	
		
		
			
				
					 
					 
					void  Main : : showNotFound ( void )  {  
					 
					 
					void  Main : : showNotFound ( void )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    DPRINTL N ( F ( " Main::showNotFound -  " )  +  mWeb - > uri ( ) ) ;  
					 
					 
					    DBGMAI N ( F ( " Main::showNotFound -  " )  +  mWeb - > uri ( ) ) ;  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					    String  msg  =  F ( " File Not Found \n \n URI:  " ) ;  
					 
					 
					    String  msg  =  F ( " File Not Found \n \n URI:  " ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    msg  + =  mWeb - > uri ( ) ;  
					 
					 
					    msg  + =  mWeb - > uri ( ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    msg  + =  F ( " \n Method:  " ) ;  
					 
					 
					    msg  + =  F ( " \n Method:  " ) ;  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -342,7 +344,7 @@ void Main::showNotFound(void) { 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					//-----------------------------------------------------------------------------
  
					 
					 
					//-----------------------------------------------------------------------------
  
				
			 
			
		
	
		
		
			
				
					 
					 
					void  Main : : showReboot ( void )  {  
					 
					 
					void  Main : : showReboot ( void )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    DPRINTL N ( F ( " Main::showReboot " ) ) ;  
					 
					 
					    DBGMAI N ( F ( " Main::showReboot " ) ) ;  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					    mWeb - > send ( 200 ,  F ( " text/html " ) ,  F ( " <!doctype html><html><head><title>Rebooting ...</title><meta http-equiv= \" refresh \"  content= \" 10; URL=/ \" ></head><body>rebooting ... auto reload after 10s</body></html> " ) ) ;  
					 
					 
					    mWeb - > send ( 200 ,  F ( " text/html " ) ,  F ( " <!doctype html><html><head><title>Rebooting ...</title><meta http-equiv= \" refresh \"  content= \" 10; URL=/ \" ></head><body>rebooting ... auto reload after 10s</body></html> " ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    delay ( 1000 ) ;  
					 
					 
					    delay ( 1000 ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    ESP . restart ( ) ;  
					 
					 
					    ESP . restart ( ) ;  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -352,7 +354,7 @@ void Main::showReboot(void) { 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					//-----------------------------------------------------------------------------
  
					 
					 
					//-----------------------------------------------------------------------------
  
				
			 
			
		
	
		
		
			
				
					 
					 
					void  Main : : showFactoryRst ( void )  {  
					 
					 
					void  Main : : showFactoryRst ( void )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    DPRINTL N ( F ( " Main::showFactoryRst " ) ) ;  
					 
					 
					    DBGMAI N ( F ( " Main::showFactoryRst " ) ) ;  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					    String  content  =  " " ;  
					 
					 
					    String  content  =  " " ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    int  refresh  =  3 ;  
					 
					 
					    int  refresh  =  3 ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    if ( mWeb - > args ( )  >  0 )  {  
					 
					 
					    if ( mWeb - > args ( )  >  0 )  {  
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					@ -381,7 +383,7 @@ void Main::showFactoryRst(void) { 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					//-----------------------------------------------------------------------------
  
					 
					 
					//-----------------------------------------------------------------------------
  
				
			 
			
		
	
		
		
			
				
					 
					 
					time_t  Main : : getNtpTime ( void )  {  
					 
					 
					time_t  Main : : getNtpTime ( void )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    //DPRINTL N(F("Main::getNtpTime"));
  
					 
					 
					    //DBGMAI N(F("Main::getNtpTime"));
  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					    time_t  date  =  0 ;  
					 
					 
					    time_t  date  =  0 ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    IPAddress  timeServer ;  
					 
					 
					    IPAddress  timeServer ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    uint8_t  buf [ NTP_PACKET_SIZE ] ;  
					 
					 
					    uint8_t  buf [ NTP_PACKET_SIZE ] ;  
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					@ -419,7 +421,7 @@ time_t Main::getNtpTime(void) { 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					//-----------------------------------------------------------------------------
  
					 
					 
					//-----------------------------------------------------------------------------
  
				
			 
			
		
	
		
		
			
				
					 
					 
					void  Main : : sendNTPpacket ( IPAddress &  address )  {  
					 
					 
					void  Main : : sendNTPpacket ( IPAddress &  address )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    //DPRINTL N(F("Main::sendNTPpacket"));
  
					 
					 
					    //DBGMAI N(F("Main::sendNTPpacket"));
  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					    uint8_t  buf [ NTP_PACKET_SIZE ]  =  { 0 } ;  
					 
					 
					    uint8_t  buf [ NTP_PACKET_SIZE ]  =  { 0 } ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					    buf [ 0 ]  =  B11100011 ;  // LI, Version, Mode
  
					 
					 
					    buf [ 0 ]  =  B11100011 ;  // LI, Version, Mode
  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -440,7 +442,7 @@ void Main::sendNTPpacket(IPAddress& address) { 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					//-----------------------------------------------------------------------------
  
					 
					 
					//-----------------------------------------------------------------------------
  
				
			 
			
		
	
		
		
			
				
					 
					 
					String  Main : : getDateTimeStr ( time_t  t )  {  
					 
					 
					String  Main : : getDateTimeStr ( time_t  t )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    //DPRINTL N(F("Main::getDateTimeStr"));
  
					 
					 
					    //DBGMAI N(F("Main::getDateTimeStr"));
  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					    char  str [ 20 ]  =  { 0 } ;  
					 
					 
					    char  str [ 20 ]  =  { 0 } ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    if ( 0  = =  t )  
					 
					 
					    if ( 0  = =  t )  
				
			 
			
		
	
		
		
			
				
					 
					 
					        sprintf ( str ,  " n/a " ) ;  
					 
					 
					        sprintf ( str ,  " n/a " ) ;  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -454,7 +456,7 @@ String Main::getDateTimeStr(time_t t) { 
				
			 
			
		
	
		
		
			
				
					 
					 
					// calculates the daylight saving time for middle Europe. Input: Unixtime in UTC
  
					 
					 
					// calculates the daylight saving time for middle Europe. Input: Unixtime in UTC
  
				
			 
			
		
	
		
		
			
				
					 
					 
					// from: https://forum.arduino.cc/index.php?topic=172044.msg1278536#msg1278536
  
					 
					 
					// from: https://forum.arduino.cc/index.php?topic=172044.msg1278536#msg1278536
  
				
			 
			
		
	
		
		
			
				
					 
					 
					time_t  Main : : offsetDayLightSaving  ( uint32_t  local_t )  {  
					 
					 
					time_t  Main : : offsetDayLightSaving  ( uint32_t  local_t )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    //DPRINTL N(F("Main::offsetDayLightSaving"));
  
					 
					 
					    //DBGMAI N(F("Main::offsetDayLightSaving"));
  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					    int  m  =  month  ( local_t ) ;  
					 
					 
					    int  m  =  month  ( local_t ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    if ( m  <  3  | |  m  >  10 )  return  0 ;  // no DSL in Jan, Feb, Nov, Dez
  
					 
					 
					    if ( m  <  3  | |  m  >  10 )  return  0 ;  // no DSL in Jan, Feb, Nov, Dez
  
				
			 
			
		
	
		
		
			
				
					 
					 
					    if ( m  >  3  & &  m  <  10 )  return  1 ;  // DSL in Apr, May, Jun, Jul, Aug, Sep
  
					 
					 
					    if ( m  >  3  & &  m  <  10 )  return  1 ;  // DSL in Apr, May, Jun, Jul, Aug, Sep