WiFi + NTP
This commit is contained in:
parent
14fefed0d3
commit
ac676e4dcb
@ -30,4 +30,4 @@ add_custom_target(
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
add_executable(Z_DUMMY_TARGET ${SRC_LIST} src/mode/Test/Border.h)
|
||||
add_executable(Z_DUMMY_TARGET ${SRC_LIST} src/mode/Test/Border.h src/mode/Clock/Clock.h)
|
||||
|
||||
18
src/main.cpp
18
src/main.cpp
@ -1,3 +1,4 @@
|
||||
#include <WiFi.h>
|
||||
#include "mode/Mode.h"
|
||||
#include "mode/GameOfLife/GameOfLife.h"
|
||||
#include "display/Display.h"
|
||||
@ -38,6 +39,7 @@ void setup() {
|
||||
delay(500);
|
||||
Serial.begin(115200);
|
||||
Serial.println("\n\n\nStartup!");
|
||||
WiFi.begin("HappyNet", "1Grausame!Sackratte7");
|
||||
display.setup();
|
||||
}
|
||||
|
||||
@ -45,7 +47,23 @@ void setSpeed(double value);
|
||||
|
||||
double speed = 1.0;
|
||||
|
||||
bool connected = false;
|
||||
|
||||
void loop() {
|
||||
bool hasIp = (uint32_t) WiFi.localIP() != 0;
|
||||
if (!connected) {
|
||||
if (hasIp) {
|
||||
connected = true;
|
||||
Serial.println("WiFi connected!");
|
||||
configTime(3600, 3600, WiFi.gatewayIP().toString().c_str());
|
||||
}
|
||||
} else {
|
||||
if (!hasIp) {
|
||||
connected = false;
|
||||
Serial.println("WiFi disconnected!");
|
||||
}
|
||||
}
|
||||
|
||||
if (Serial.available()) {
|
||||
int input = Serial.read();
|
||||
switch (input) {
|
||||
|
||||
10
src/mode/Clock/Clock.h
Normal file
10
src/mode/Clock/Clock.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef CLOCK_H
|
||||
#define CLOCK_H
|
||||
|
||||
#include "mode/Mode.h"
|
||||
|
||||
class Clock : public Mode {
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue
Block a user