mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 02:39:57 +02:00
pre-commit fixes
This commit is contained in:
parent
ae475c3b24
commit
3a5e39171f
3 changed files with 43 additions and 50 deletions
|
@ -2,13 +2,13 @@
|
||||||
#include "../../include.h"
|
#include "../../include.h"
|
||||||
#include "../utils/events.h"
|
#include "../utils/events.h"
|
||||||
|
|
||||||
|
|
||||||
// Configuration Parameters
|
// Configuration Parameters
|
||||||
static const uint16_t WIFI_CHECK_INTERVAL = 5000; // 5 seconds
|
static const uint16_t WIFI_CHECK_INTERVAL = 5000; // 5 seconds
|
||||||
static const uint16_t INIT_WIFI_FULL_RECONNECT_INTERVAL = 10000; // 10 seconds
|
static const uint16_t INIT_WIFI_FULL_RECONNECT_INTERVAL = 10000; // 10 seconds
|
||||||
static const uint16_t MAX_WIFI_FULL_RECONNECT_INTERVAL = 60000; // 60 seconds
|
static const uint16_t MAX_WIFI_FULL_RECONNECT_INTERVAL = 60000; // 60 seconds
|
||||||
static const uint16_t STEP_WIFI_FULL_RECONNECT_INTERVAL = 5000; // 5 seconds
|
static const uint16_t STEP_WIFI_FULL_RECONNECT_INTERVAL = 5000; // 5 seconds
|
||||||
static const uint16_t MAX_RECONNECT_ATTEMPTS = 3; // Maximum number of reconnect attempts before forcing a full connection
|
static const uint16_t MAX_RECONNECT_ATTEMPTS =
|
||||||
|
3; // Maximum number of reconnect attempts before forcing a full connection
|
||||||
|
|
||||||
// State variables
|
// State variables
|
||||||
static unsigned long lastReconnectAttempt = 0;
|
static unsigned long lastReconnectAttempt = 0;
|
||||||
|
@ -46,7 +46,6 @@ void init_WiFi() {
|
||||||
|
|
||||||
// Start Wi-Fi connection
|
// Start Wi-Fi connection
|
||||||
connectToWiFi();
|
connectToWiFi();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Task to monitor Wi-Fi status and handle reconnections
|
// Task to monitor Wi-Fi status and handle reconnections
|
||||||
|
@ -82,7 +81,6 @@ void wifi_monitor() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to force a full reconnect to Wi-Fi
|
// Function to force a full reconnect to Wi-Fi
|
||||||
|
@ -118,7 +116,6 @@ static void onWifiConnect(WiFiEvent_t event, WiFiEventInfo_t info) {
|
||||||
reconnectAttempts = 0; // Reset the attempt counter
|
reconnectAttempts = 0; // Reset the attempt counter
|
||||||
current_full_reconnect_interval = INIT_WIFI_FULL_RECONNECT_INTERVAL; // Reset the full reconnect interval
|
current_full_reconnect_interval = INIT_WIFI_FULL_RECONNECT_INTERVAL; // Reset the full reconnect interval
|
||||||
clear_event(EVENT_WIFI_CONNECT);
|
clear_event(EVENT_WIFI_CONNECT);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Event handler for Wi-Fi Got IP
|
// Event handler for Wi-Fi Got IP
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
#define WIFI_H
|
#define WIFI_H
|
||||||
|
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include "../../include.h"
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "../../include.h"
|
||||||
|
|
||||||
extern std::string ssid;
|
extern std::string ssid;
|
||||||
extern std::string password;
|
extern std::string password;
|
||||||
|
@ -11,7 +11,6 @@ extern const uint8_t wifi_channel;
|
||||||
extern const char* ssidAP;
|
extern const char* ssidAP;
|
||||||
extern const char* passwordAP;
|
extern const char* passwordAP;
|
||||||
|
|
||||||
|
|
||||||
void init_WiFi();
|
void init_WiFi();
|
||||||
void wifi_monitor();
|
void wifi_monitor();
|
||||||
static void connectToWiFi();
|
static void connectToWiFi();
|
||||||
|
@ -20,8 +19,6 @@ static void onWifiConnect(WiFiEvent_t event, WiFiEventInfo_t info);
|
||||||
static void onWifiDisconnect(WiFiEvent_t event, WiFiEventInfo_t info);
|
static void onWifiDisconnect(WiFiEvent_t event, WiFiEventInfo_t info);
|
||||||
static void onWifiGotIP(WiFiEvent_t event, WiFiEventInfo_t info);
|
static void onWifiGotIP(WiFiEvent_t event, WiFiEventInfo_t info);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef WIFIAP
|
#ifdef WIFIAP
|
||||||
void init_WiFi_AP();
|
void init_WiFi_AP();
|
||||||
#endif // WIFIAP
|
#endif // WIFIAP
|
||||||
|
@ -31,5 +28,4 @@ void init_WiFi_AP();
|
||||||
void init_mDNS();
|
void init_mDNS();
|
||||||
#endif // MDNSRESPONDER
|
#endif // MDNSRESPONDER
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue