This repository has been archived on 2024-10-30. You can view files and clone it, but cannot push or open issues or pull requests.
esp-firewall/SourceCode/arduino/src/main.cpp
2022-04-20 11:06:17 +02:00

33 lines
No EOL
661 B
C++

#include "theSecrets.h"
#include "WiFi.h"
#include "esp32Firewall.hpp"
#include "esp32FirewallAPI.hpp"
esp32FirewallApi *firewall_api;
void setup_wifi()
{
uint8_t max_retries = 5;
uint8_t retries = 1;
log_i("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("Connected, IP Address: %s", WiFi.localIP().toString().c_str());
}
void setup()
{
setup_wifi();
firewall_api = new esp32FirewallApi;
}
void loop()
{
firewall_api->handle_clients();
}