Skip to content

Commit

Permalink
added option to disable favicon handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tobozo committed Dec 31, 2023
1 parent 7bece2c commit 79f7790
Show file tree
Hide file tree
Showing 10 changed files with 354 additions and 230 deletions.
4 changes: 3 additions & 1 deletion ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ void setup()
WiFiManager wifiManager;

WiFiManagerNS::init( &wifiManager );
// WiFiManagerNS::init( &wifiManager, nullptr ); // using nullptr to prevent WiFiManagerTz from overwriting WiFiManager favicon
// WiFiManagerNS::init( &wifiManager, myFaviconCallback ); // using a custom callback to emit favicon

// /!\ make sure "custom" is listed there as it's required to pull the "Setup Clock" button
std::vector<const char *> menu = {"wifi", "info", "custom", "param", "sep", "restart", "exit"};
Expand All @@ -40,7 +42,7 @@ I made this library in order to learn how to properly use the WiFiManager, and I
- Add more examples
- Implement minimal logic for external RTC modules coupling
- Make the Time Setup page skinnable
- ESP8266 support
~~- ESP8266 support~~


## Dependencies
Expand Down
2 changes: 1 addition & 1 deletion examples/tzupdate/tzupdate.ino
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void setup()
WiFiManagerNS::NTP::onTimeAvailable( &on_time_available );

// attach NTP/TZ/Clock-setup page to the WiFi Manager
WiFiManagerNS::init( &wifiManager );
WiFiManagerNS::init( &wifiManager, nullptr );

// /!\ make sure "custom" is listed there as it's required to pull the "Setup Clock" button
std::vector<const char *> menu = {"wifi", "info", "custom", "param", "sep", "restart", "exit"};
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=WiFiManagerTz
version=1.3.2
version=1.3.3
author=tobozo <tobozo@noreply.github.com>
maintainer=tobozo <tobozo@noreply.github.com>
sentence=A NTP/Timezone extension to @tzapu's WiFiManager
Expand Down
14 changes: 9 additions & 5 deletions src/NTP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@

#include "prefs.hpp"
#include "NTP.hpp"
#include "sntp.h"
#if __has_include("esp_sntp.h")
#include "esp_sntp.h"
#elif __has_include("sntp.h")
#include "sntp.h"
#else
#error "This library needs either esp_sntp.h or ntp.h from esp core"
#endif


namespace WiFiManagerNS
Expand All @@ -35,9 +41,7 @@ namespace WiFiManagerNS
namespace NTP
{

const char* NVS_DST_KEY = "DST";
const char* NVS_NTPZONE_KEY = "NTPZONE";
const char* NVS_NTP_DELAYMIN = "NTPDELAY";
using namespace WiFiManagerNS::prefs;

const char* defaultServer = "pool.ntp.org";
uint8_t currentServer = 0;
Expand Down Expand Up @@ -68,7 +72,7 @@ namespace WiFiManagerNS
}


onTimeAvailable_fn timeavailable = &timeavailable_default;
static onTimeAvailable_fn timeavailable = &timeavailable_default;

void onTimeAvailable( onTimeAvailable_fn fn )
{
Expand Down
2 changes: 1 addition & 1 deletion src/NTP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace WiFiManagerNS


void setSyncDelay( unsigned int minutes );
unsigned int getSyncDelay();
unsigned int getSyncDelay(); // minutes

void loadPrefServer();
void loadPrefs();
Expand Down
6 changes: 4 additions & 2 deletions src/TZ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
\*/

#include "prefs.hpp"

#include <TZ.hpp>


Expand All @@ -34,9 +34,11 @@ namespace WiFiManagerNS
namespace TZ
{

constexpr const char* prefName = "TZNAME";
using namespace WiFiManagerNS::prefs;

const char* defaultTzName = "UTC0";
char tzName[255];
int tzId;


size_t zones()
Expand Down
1 change: 1 addition & 0 deletions src/TZ.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
\*/

#include <Arduino.h>
#include "prefs.hpp"

namespace WiFiManagerNS
{
Expand Down
Loading

0 comments on commit 79f7790

Please sign in to comment.