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

35 lines
738 B
C++
Raw Normal View History

2022-04-10 20:46:54 +02:00
#include "theSecrets.h"
2022-04-18 22:56:30 +02:00
#include "WiFi.h"
2022-04-20 07:58:06 +02:00
#include "esp32FirewallAPI.hpp"
2022-04-20 13:08:12 +02:00
#include "esp32Eeprom.hpp"
2022-04-10 20:46:54 +02:00
2022-04-20 13:08:12 +02:00
firewall::esp32FirewallApi *firewall_api;
firewall::Storage *storage;
2022-04-10 20:46:54 +02:00
void setup_wifi()
{
uint8_t max_retries = 5;
2022-04-18 13:11:02 +02:00
uint8_t retries = 1;
2022-04-10 20:46:54 +02:00
log_i("Attempting to connect to WPA SSID: %s", ssid);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, psk);
2022-04-18 13:11:02 +02:00
while (WiFi.status() != WL_CONNECTED && retries <= max_retries)
2022-04-10 20:46:54 +02:00
{
delay(2000);
log_d("Connecting... (%i/%i)", retries++, max_retries);
2022-04-10 20:46:54 +02:00
}
2022-04-20 11:06:17 +02:00
log_i("Connected, IP Address: %s", WiFi.localIP().toString().c_str());
2022-04-10 20:46:54 +02:00
}
2022-04-10 14:38:03 +02:00
void setup()
{
2022-04-10 15:55:42 +02:00
setup_wifi();
2022-04-20 13:08:12 +02:00
// firewall_api = new esp32FirewallApi;
storage = new firewall::Storage;
2022-04-10 14:38:03 +02:00
}
void loop()
{
2022-04-20 13:08:12 +02:00
// firewall_api->handle_clients();
2022-04-10 14:38:03 +02:00
}