mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 02:39:57 +02:00
Refactor Wi-Fi management / separated from webserver logic and add support for fixed IP configuration
This commit is contained in:
parent
1a3ee00a4b
commit
be9d993b44
9 changed files with 266 additions and 168 deletions
|
@ -6,27 +6,18 @@
|
|||
#include "../../include.h"
|
||||
#include "../../lib/YiannisBourkelis-Uptime-Library/src/uptime_formatter.h"
|
||||
#include "../../lib/ayushsharma82-ElegantOTA/src/ElegantOTA.h"
|
||||
#ifdef MQTT
|
||||
#include "../../lib/knolleary-pubsubclient/PubSubClient.h"
|
||||
#endif
|
||||
#include "../../lib/me-no-dev-AsyncTCP/src/AsyncTCP.h"
|
||||
#include "../../lib/me-no-dev-ESPAsyncWebServer/src/ESPAsyncWebServer.h"
|
||||
#include "../../lib/miwagner-ESP32-Arduino-CAN/ESP32CAN.h"
|
||||
#ifdef MQTT
|
||||
#include "../mqtt/mqtt.h"
|
||||
#endif
|
||||
|
||||
extern const char* version_number; // The current software version, shown on webserver
|
||||
|
||||
#include <string>
|
||||
extern std::string ssid;
|
||||
extern std::string password;
|
||||
extern const uint8_t wifi_channel;
|
||||
extern const char* ssidAP;
|
||||
extern const char* passwordAP;
|
||||
extern const char* http_username;
|
||||
extern const char* http_password;
|
||||
|
||||
extern const char* ssidAP;
|
||||
|
||||
// Common charger parameters
|
||||
extern float charger_stat_HVcur;
|
||||
extern float charger_stat_HVvol;
|
||||
|
@ -47,36 +38,6 @@ extern uint16_t OBC_Charge_Power;
|
|||
*/
|
||||
void init_webserver();
|
||||
|
||||
/**
|
||||
* @brief Monitoring loop for WiFi. Will attempt to reconnect to access point if the connection goes down.
|
||||
*
|
||||
* @param[in] void
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
void wifi_monitor();
|
||||
|
||||
#ifdef WIFIAP
|
||||
/**
|
||||
* @brief Initialization function that creates a WiFi Access Point.
|
||||
*
|
||||
* @param[in] void
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
void init_WiFi_AP();
|
||||
#endif // WIFIAP
|
||||
|
||||
/**
|
||||
* @brief Initialization function that connects to an existing network.
|
||||
*
|
||||
* @param[in] ssid WiFi network name
|
||||
* @param[in] password WiFi network password
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
void init_WiFi_STA(const char* ssid, const char* password, const uint8_t channel);
|
||||
|
||||
// /**
|
||||
// * @brief Function to handle WiFi reconnection.
|
||||
// *
|
||||
|
@ -145,4 +106,6 @@ String formatPowerValue(String label, T value, String unit, int precision);
|
|||
|
||||
extern void storeSettings();
|
||||
|
||||
void ota_monitor();
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue