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-18 22:56:30 +02:00

34 lines
No EOL
681 B
C++

#include "Arduino.h"
#include "theSecrets.h"
#include "WiFi.h"
#include "Firewall.h"
#include "esp32-hal-log.h"
const char *esp_ip_address;
ESPFirewall *firewall;
void setup_wifi()
{
uint8_t max_retries = 10;
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(1000);
log_i("Connecting... (%i/%i)", retries++, max_retries);
}
esp_ip_address = WiFi.localIP().toString().c_str();
log_i("Connected, IP Address: %s", esp_ip_address);
}
void setup()
{
setup_wifi();
firewall = new ESPFirewall;
}
void loop()
{
}