added wifi connection and menu showing connection details

This commit is contained in:
2026-06-24 17:08:45 +03:00
parent 76606c00e3
commit 6f6ea0e0fd
9 changed files with 171 additions and 1 deletions
+1
View File
@@ -6,6 +6,7 @@
enum class MenuAction
{
ShowInternetDetails,
ShowHelloWorld,
BackToCarousel
};
+2
View File
@@ -4,9 +4,11 @@
#include <U8g2lib.h>
#include "am2302_sensor.h"
#include "wifi_connection.h"
void drawScreen1(U8G2 &u8g2);
void drawHelloWorldScreen(U8G2 &u8g2);
void drawInternetConnectionScreen(U8G2 &u8g2, WifiConnectionInfo wifiInfo);
void setEnvironmentReading(Am2302Reading reading);
void drawEnvironmentScreen(U8G2 &u8g2);
void drawWeatherIconScreen(U8G2 &u8g2);
+34
View File
@@ -0,0 +1,34 @@
#ifndef WIFI_CONNECTION_H
#define WIFI_CONNECTION_H
#include <Arduino.h>
#include <IPAddress.h>
struct WifiConnectionInfo
{
bool shieldAvailable;
bool connected;
IPAddress ipAddress;
};
class WifiConnection
{
public:
WifiConnection();
void begin(unsigned long now);
void update(unsigned long now);
WifiConnectionInfo info() const;
bool consumeDirty();
private:
void connect(unsigned long now);
void recordStatus();
unsigned long nextAttempt_;
bool shieldAvailable_;
bool connected_;
IPAddress ipAddress_;
bool dirty_;
};
#endif
+7
View File
@@ -0,0 +1,7 @@
#ifndef WIFI_CREDENTIALS_H
#define WIFI_CREDENTIALS_H
const char WIFI_SSID[] = "your-wifi-name";
const char WIFI_PASSWORD[] = "your-wifi-password";
#endif