mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-24 14:26:11 +02:00
added interface class for app
refactored web and webApi -> now RestApi.h fix calcSunrise fixed calcSunrise trigger calculation display zero values on /live added changes from #483
This commit is contained in:
parent
a8d7e430f7
commit
49b530a743
19 changed files with 1366 additions and 1511 deletions
|
@ -17,7 +17,7 @@
|
|||
ahoywifi::ahoywifi() {
|
||||
mCnt = 0;
|
||||
mConnected = false;
|
||||
mInitNtp = true;
|
||||
mReconnect = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ void ahoywifi::setup(settings_t *config, uint32_t *utcTimestamp) {
|
|||
//-----------------------------------------------------------------------------
|
||||
void ahoywifi::loop() {
|
||||
#if !defined(AP_ONLY)
|
||||
if(!mConnected) {
|
||||
if(mReconnect) {
|
||||
delay(100);
|
||||
mCnt++;
|
||||
if((mCnt % 50) == 0)
|
||||
|
@ -56,11 +56,7 @@ void ahoywifi::loop() {
|
|||
WiFi.reconnect();
|
||||
mCnt = 0;
|
||||
}
|
||||
} else if(mInitNtp) {
|
||||
getNtpTime();
|
||||
mInitNtp = false;
|
||||
}
|
||||
mCnt = 0;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -209,6 +205,7 @@ void ahoywifi::sendNTPpacket(IPAddress& address) {
|
|||
void ahoywifi::onConnect(const WiFiEventStationModeGotIP& event) {
|
||||
if(!mConnected) {
|
||||
mConnected = true;
|
||||
mReconnect = false;
|
||||
DBGPRINTLN(F("\n[WiFi] Connected"));
|
||||
WiFi.mode(WIFI_STA);
|
||||
DBGPRINTLN(F("[WiFi] AP disabled"));
|
||||
|
@ -223,6 +220,7 @@ void ahoywifi::sendNTPpacket(IPAddress& address) {
|
|||
void ahoywifi::onDisconnect(const WiFiEventStationModeDisconnected& event) {
|
||||
if(mConnected) {
|
||||
mConnected = false;
|
||||
mReconnect = true;
|
||||
DPRINTLN(DBG_INFO, "[WiFi] Connection Lost");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue