added wifi connection and menu showing connection details
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
enum class MenuAction
|
||||
{
|
||||
ShowInternetDetails,
|
||||
ShowHelloWorld,
|
||||
BackToCarousel
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user