31 lines
No EOL
640 B
C++
31 lines
No EOL
640 B
C++
#include "theSecrets.h"
|
|
#include "WiFi.h"
|
|
#include "esp32API.hpp"
|
|
|
|
firewall::API *firewall_api;
|
|
|
|
void setup_wifi()
|
|
{
|
|
uint8_t max_retries = 5;
|
|
uint8_t retries = 1;
|
|
log_d("Attempting to connect to WPA SSID: %s", ssid);
|
|
WiFi.mode(WIFI_STA);
|
|
WiFi.begin(ssid, psk);
|
|
while (WiFi.status() != WL_CONNECTED && retries <= max_retries)
|
|
{
|
|
delay(2000);
|
|
log_d("Connecting... (%i/%i)", retries++, max_retries);
|
|
}
|
|
log_i("IP Address: %s", WiFi.localIP().toString().c_str());
|
|
}
|
|
|
|
void setup()
|
|
{
|
|
setup_wifi();
|
|
firewall_api = new firewall::API(api_username, api_password, 8080);
|
|
}
|
|
|
|
void loop()
|
|
{
|
|
firewall_api->handle_clients();
|
|
} |