Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9ddf016c9 | ||
|
|
45c40e002c | ||
|
|
caa6f3a833 | ||
|
|
a3959376e3 |
@@ -1,9 +1,10 @@
|
||||
//Test if Alarm was triggerd and start Alarm, test if Alarm Time should be changed (Summer/Winter Time)
|
||||
void run_alarm(long currentMillis){
|
||||
if (test_alarm())
|
||||
{
|
||||
write_log("Start Alarm");
|
||||
start_wake_light(currentMillis);
|
||||
setAlarmTimer(15);
|
||||
setAlarmTimer(wakeup_time + 5);
|
||||
}
|
||||
else{
|
||||
if (run_wake_up(currentMillis)){
|
||||
@@ -22,6 +23,7 @@ void run_alarm(long currentMillis){
|
||||
}
|
||||
}
|
||||
|
||||
//Stop Alarm if timeout reached
|
||||
void stop_alarm(){
|
||||
write_log("Stop Alarm");
|
||||
stop_wake_light();
|
||||
@@ -29,7 +31,7 @@ void stop_alarm(){
|
||||
setAlarmTimer(0);
|
||||
}
|
||||
|
||||
|
||||
//Set Alarm Timeout to stop alarm if nobody is at home
|
||||
void setAlarmTimer(int Minutes){
|
||||
if (Minutes == 0)
|
||||
{
|
||||
@@ -42,6 +44,7 @@ void setAlarmTimer(int Minutes){
|
||||
}
|
||||
}
|
||||
|
||||
//Test if timeout reached
|
||||
void handleSleep(long intervall, long currentMillis){
|
||||
if(time_on < 0){
|
||||
return;
|
||||
@@ -53,7 +56,7 @@ void handleSleep(long intervall, long currentMillis){
|
||||
}
|
||||
|
||||
//####################################################################################################
|
||||
|
||||
//Turn Alarm on/off
|
||||
void switch_alarm_mode(){
|
||||
bool A1 = Clock.checkAlarmEnabled(1);
|
||||
bool A2 = Clock.checkAlarmEnabled(2);
|
||||
@@ -93,7 +96,7 @@ void switch_alarm_mode(){
|
||||
}
|
||||
delay_gui(1000);
|
||||
}
|
||||
|
||||
//Enter Alarm Menu
|
||||
void set_alarm_item(){
|
||||
if (setItem == 0)
|
||||
{
|
||||
@@ -110,7 +113,7 @@ void set_alarm_item(){
|
||||
setItem = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//Get Alarm Info for Display
|
||||
String get_alarm_string(){
|
||||
String alarm_string_1 = "";
|
||||
String alarm_string_2 = "";
|
||||
@@ -132,7 +135,7 @@ String get_alarm_string(){
|
||||
}
|
||||
|
||||
//####################################################################################################
|
||||
|
||||
//Test if Alarm is triggerd
|
||||
bool test_alarm(){
|
||||
bool A1 = Clock.checkIfAlarm(1);
|
||||
bool A2 = Clock.checkIfAlarm(2);
|
||||
@@ -173,7 +176,7 @@ void add_al2_minute(int i){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Save Alarm 1
|
||||
void set_alarm1(){
|
||||
int al1h_utc = al1h;
|
||||
if (summertime_EU(y,M,d,h,1))
|
||||
@@ -193,7 +196,7 @@ void set_alarm1(){
|
||||
//delay_gui(1000);
|
||||
}
|
||||
|
||||
|
||||
//Save Alarm 2
|
||||
void set_alarm2(){
|
||||
int al2h_utc = al2h;
|
||||
if (summertime_EU(y,M,d,h,1))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Including the ESP8266 WiFi library
|
||||
// Including the ESP8266 WiFi library and other dependencies
|
||||
#include <ESP8266HTTPClient.h>
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <WiFiClient.h>
|
||||
@@ -15,14 +15,27 @@
|
||||
#include <NTPtimeESP.h> //https://github.com/SensorsIot/NTPtimeESP
|
||||
#include <EEPROM.h>
|
||||
|
||||
String Hardware = "0.10";
|
||||
String Software = "0.07";
|
||||
//Default Settings
|
||||
String Hardware = "0.12";
|
||||
String Software = "0.10";
|
||||
|
||||
String ntp_server = "ntp2.uni-augsburg.de";
|
||||
bool ntp_update = true;
|
||||
int wakeup_time = 10;
|
||||
//ConfigData (WiFi Name and Pin-Numbers)
|
||||
const String NodeName = "LichtWecker";
|
||||
|
||||
//Pin Taster
|
||||
const int pinTime = 3; //Pin fuer Toggle_Power und Einstellen der Uhrzeit (Lang)
|
||||
const int pinSet = 0; //Pin fuer Sleep und Zeit_Einstellung im Alarm/Time Set Mode
|
||||
const int pinAlarm = 2; //Pin fuer Alarm An/Aus und setzen der Alarmzeiten (Lang)
|
||||
//Pin Relay
|
||||
const int outBeep = 9;
|
||||
|
||||
|
||||
// Set web server port number to 80
|
||||
ESP8266WebServer server(80);
|
||||
ESP8266HTTPUpdateServer httpUpdater;
|
||||
|
||||
//LED Band Setup
|
||||
#define FASTLED_ESP8266_RAW_PIN_ORDER
|
||||
#include "FastLED.h"
|
||||
@@ -33,34 +46,19 @@ ESP8266HTTPUpdateServer httpUpdater;
|
||||
#define CLOCK_PIN 13
|
||||
// This is an array of leds. One item for each led in your strip.
|
||||
CRGB leds[NUM_LEDS];
|
||||
|
||||
//RealTimeClock
|
||||
RTClib RTC;
|
||||
DS3231 Clock;
|
||||
//NTP Setup
|
||||
NTPtime NTPch(ntp_server); // Choose server pool as required
|
||||
|
||||
//Display
|
||||
LiquidCrystal_I2C lcd(0x3f, 16, 2);
|
||||
|
||||
//ConfigData (WiFi Name and Pin-Numbers)
|
||||
const String NodeName = "LichtWecker";
|
||||
//Pin Taster
|
||||
const int pinTime = 3; //Pin fuer Toggle_Power und Einstellen der Uhrzeit (Lang)
|
||||
const int pinSet = 0; //Pin fuer Sleep und Zeit_Einstellung im Alarm/Time Set Mode
|
||||
const int pinAlarm = 2; //Pin fuer Alarm An/Aus und setzen der Alarmzeiten (Lang)
|
||||
|
||||
//Pin Relay
|
||||
const int outBeep = 9;
|
||||
|
||||
//Helpers
|
||||
//To know if connected to wifi or not:
|
||||
bool wifi_connected = false;
|
||||
|
||||
bool ntp_update = true;
|
||||
|
||||
//For Summertime change notification (change alarmtime) this should be saved in the EEPROM!
|
||||
bool summer = false;
|
||||
|
||||
//Alarm Started?
|
||||
bool alarm_started = false;
|
||||
long startTime = 0;
|
||||
@@ -74,7 +72,6 @@ int al2m = 0;
|
||||
//Alarm run Counter
|
||||
long time_on = -1;
|
||||
int minutes_sleep = -1;
|
||||
|
||||
//Current Date and Time from RTC
|
||||
int h = 0;
|
||||
int m = 0;
|
||||
@@ -84,24 +81,24 @@ int M = 0;
|
||||
int y = 0;
|
||||
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
|
||||
String dow = "-";
|
||||
|
||||
|
||||
//Current Menu Item
|
||||
int setItem = 0;
|
||||
|
||||
//Display is not updated (for block_gui Secondes)
|
||||
long block_gui = -1;
|
||||
|
||||
//Counting Mills
|
||||
long previousMillis = 0;
|
||||
|
||||
//If not Connected to Wifi
|
||||
void configModeCallback (WiFiManager *myWiFiManager) {
|
||||
//if you used auto generated SSID, print it
|
||||
//write_log(myWiFiManager->getConfigPortalSSID());
|
||||
display_text("Wifi: Licht","PW: Wecker");
|
||||
}
|
||||
|
||||
//Initial Code
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
delay(10);
|
||||
|
||||
//Setup Display
|
||||
// Initialise the LCD
|
||||
lcd.begin(4,5); // sda=0, scl=2
|
||||
@@ -230,29 +227,47 @@ void setup() {
|
||||
|
||||
|
||||
void loop() {
|
||||
//Handle web requests
|
||||
handle_webserver();
|
||||
unsigned long currentMillis = millis();
|
||||
unsigned long intervall = currentMillis - previousMillis;
|
||||
|
||||
update_display(currentMillis,intervall);
|
||||
|
||||
//Test Input-Pin pressed
|
||||
test_pin();
|
||||
//Handle Sleep Timer timeout
|
||||
handleSleep(intervall, currentMillis);
|
||||
//Test time every hour
|
||||
if(m == 1 && s == 30)
|
||||
{
|
||||
update_time_from_web();
|
||||
}
|
||||
//Delay for Wifi Tasks
|
||||
delay(100);
|
||||
}
|
||||
|
||||
void update_display(){
|
||||
unsigned long currentMillis = millis();
|
||||
unsigned long intervall = currentMillis - previousMillis;
|
||||
update_display(currentMillis,intervall);
|
||||
}
|
||||
|
||||
void update_display(unsigned long currentMillis, unsigned long intervall){
|
||||
//Unblock Display (if block_gui was set)
|
||||
release_gui(currentMillis);
|
||||
|
||||
// put your main code here, to run repeatedly:
|
||||
if(setItem == 0){
|
||||
//Run normal
|
||||
update_Time();
|
||||
run_alarm(currentMillis);
|
||||
if (block_gui < 0)
|
||||
show_current_time(intervall,currentMillis);
|
||||
}
|
||||
else{
|
||||
//Show Menu
|
||||
show_time_infos(intervall,currentMillis);
|
||||
previousMillis = currentMillis;
|
||||
}
|
||||
test_pin();
|
||||
handleSleep(intervall, currentMillis);
|
||||
if(m == 1 && s == 30)
|
||||
{
|
||||
update_time_from_web();
|
||||
}
|
||||
delay(100);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//Show current Time and Date on display
|
||||
void show_current_time(long intervall, long currentMillis){
|
||||
if(intervall > 16000){
|
||||
previousMillis = currentMillis;
|
||||
@@ -45,7 +46,7 @@ void show_time_infos(long intervall, long currentMillis){
|
||||
|
||||
|
||||
//####################################################################################################
|
||||
//Setup
|
||||
//Enter Time Menu
|
||||
void switch_set_item(){
|
||||
setItem = setItem + 1;
|
||||
if(setItem > 6)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//Start Wakeup sound
|
||||
void run_wake_up_beep(long currentMillis){
|
||||
if (alarm_started == true)
|
||||
{
|
||||
@@ -10,10 +11,12 @@ void run_wake_up_beep(long currentMillis){
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
//Stop Sound
|
||||
void stop_alarm_beep(){
|
||||
beepOff();
|
||||
}
|
||||
//############################################################################################
|
||||
//Helpers
|
||||
|
||||
void toggle_alarm_beep(){
|
||||
int currentState = digitalRead(outBeep);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
//Helpers
|
||||
String current_string = "";
|
||||
|
||||
//Display Text
|
||||
void display_text(String text1, String text2){
|
||||
if (current_string != text1 + text2){
|
||||
//write_log("Display:");
|
||||
@@ -18,7 +19,7 @@ void display_text(String text1, String text2){
|
||||
current_string = text1 + text2;
|
||||
}
|
||||
}
|
||||
|
||||
//Calculate space
|
||||
int freespace(String text){
|
||||
if (text.length() > 14)
|
||||
{
|
||||
|
||||
@@ -5,15 +5,21 @@ uint addr = 0;
|
||||
struct {
|
||||
bool summertime = false;
|
||||
bool ntp_update = true;
|
||||
int wakeup_time = 10;
|
||||
char ntp_server[22] = "ntp2.uni-augsburg.de";
|
||||
} data;
|
||||
|
||||
void write_eeprom(){
|
||||
EEPROM.begin(512);
|
||||
EEPROM.begin(1024);
|
||||
// load EEPROM data into RAM, see it
|
||||
data.summertime = summer;
|
||||
data.ntp_update = ntp_update;
|
||||
data.wakeup_time = wakeup_time;
|
||||
ntp_server.toCharArray(data.ntp_server,22);
|
||||
write_log("Writing to EEPROM: "+String(data.summertime));
|
||||
write_log("Writing to EEPROM: "+String(data.ntp_update));
|
||||
write_log("Writing to EEPROM: "+String(data.wakeup_time));
|
||||
write_log("Writing to EEPROM: "+String(data.ntp_server));
|
||||
// replace values in EEPROM
|
||||
EEPROM.put(addr,data);
|
||||
EEPROM.commit();
|
||||
@@ -21,12 +27,25 @@ void write_eeprom(){
|
||||
}
|
||||
|
||||
bool get_eeprom(){
|
||||
EEPROM.begin(512);
|
||||
EEPROM.begin(1024);
|
||||
EEPROM.get(addr,data);
|
||||
write_log("Found: "+String(data.summertime));
|
||||
write_log("Found: "+String(data.ntp_update));
|
||||
write_log("Read: "+String(data.summertime));
|
||||
write_log("Read: "+String(data.ntp_update));
|
||||
write_log("Read: "+String(data.wakeup_time));
|
||||
write_log("Read: "+String(data.ntp_update));
|
||||
EEPROM.end();
|
||||
summer = data.summertime;
|
||||
ntp_update = data.ntp_update;
|
||||
wakeup_time = data.wakeup_time;
|
||||
ntp_server = data.ntp_server;
|
||||
}
|
||||
|
||||
|
||||
void reset_eeprom(){
|
||||
summer = false;
|
||||
ntp_update = true;
|
||||
wakeup_time = 10;
|
||||
ntp_server = "ntp2.uni-augsburg.de";
|
||||
write_eeprom();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ void show_white(){
|
||||
leds[i] = CRGB::White;
|
||||
}
|
||||
FastLED.show();
|
||||
write_log("Light: WHITE");
|
||||
//write_log("Light: WHITE");
|
||||
}
|
||||
|
||||
//Show LED Colors
|
||||
@@ -33,7 +33,7 @@ void show_green(){
|
||||
FastLED.show();
|
||||
write_log("Light: GREEN");
|
||||
}
|
||||
|
||||
//Set LED Color to RGB Value
|
||||
void set_color(int r, int g, int b){
|
||||
FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RBG>(leds, NUM_LEDS);
|
||||
for(int i=0; i < NUM_LEDS; i = i+1 )
|
||||
@@ -46,19 +46,25 @@ void set_color(int r, int g, int b){
|
||||
//write_log(String(b));
|
||||
//write_log(String(g));
|
||||
}
|
||||
|
||||
//Run Color movement for Alarm
|
||||
bool run_wake_up(long currentMillis){
|
||||
if (alarm_started == true)
|
||||
{
|
||||
long delta = (currentMillis - startTime)/1000;
|
||||
if (delta < 220){
|
||||
set_color(30 + int(delta), int(delta)/4, 0);
|
||||
long max_wake_time = wakeup_time *60; //Calculate Wakeuptime in Seconds
|
||||
int maxvalue = int(220/(max_wake_time/3));
|
||||
|
||||
if (delta < (max_wake_time/3)){
|
||||
int color_time = delta * maxvalue;
|
||||
set_color(30 + int(color_time), int(color_time)/4, 0);
|
||||
}
|
||||
else if(delta < 405){
|
||||
set_color(255, int(delta - 220)+55, int((delta - 220)/4));
|
||||
else if((delta < ((max_wake_time/3)*2))){
|
||||
int color_time = (delta - (max_wake_time/3)) * maxvalue;
|
||||
set_color(255, int(color_time)+30, int((color_time)/4));
|
||||
}
|
||||
else if(delta < 605){
|
||||
set_color(255, 255, int((delta - 405))+55);
|
||||
else if(delta < max_wake_time){
|
||||
int color_time = (delta - ((max_wake_time/3)*2)) * maxvalue;
|
||||
set_color(255, 255, int((color_time))+30);
|
||||
}
|
||||
else{
|
||||
if (delta % 2 == 0){
|
||||
@@ -78,7 +84,7 @@ bool run_wake_up(long currentMillis){
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//Toggle Light Full/Off
|
||||
void switch_lamp(){
|
||||
if(lamp_on == false){
|
||||
lamp_on = true;
|
||||
@@ -89,7 +95,7 @@ void switch_lamp(){
|
||||
show_black();
|
||||
}
|
||||
}
|
||||
|
||||
//Start Alarm Light
|
||||
void start_wake_light(long currentMillis){
|
||||
if (alarm_started == false)
|
||||
{
|
||||
@@ -98,7 +104,7 @@ void start_wake_light(long currentMillis){
|
||||
set_color(30, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//Turn of Alarm Light
|
||||
void stop_wake_light(){
|
||||
if (alarm_started == true)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ void update_time_from_web(){
|
||||
byte actualMonth = dateTime.month;
|
||||
byte actualday =dateTime.day;
|
||||
byte actualdayofWeek = dateTime.dayofWeek;
|
||||
if (actualMinute != m && actualday != 7 && actualMonth != 2 && actualyear != 2036){
|
||||
if (actualMinute != m && actualday != 7 && actualMonth != 2 && actualyear != 2036 && actualHour != 0){
|
||||
h = actualHour;
|
||||
m = actualMinute;
|
||||
s = actualsecond;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
//Test if button pressed
|
||||
void test_pin(){
|
||||
handle_Time_switch();
|
||||
handle_Set_switch();
|
||||
handle_Alarm_switch();
|
||||
}
|
||||
|
||||
|
||||
//If Alarm switch pressed
|
||||
void handle_Alarm_switch(){
|
||||
int state = digitalRead(pinAlarm);
|
||||
if(state == LOW && setItem == 0) {
|
||||
@@ -31,7 +32,7 @@ void handle_Alarm_switch(){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//If Set switch pressed
|
||||
void handle_Set_switch(){
|
||||
int state = digitalRead(pinSet);
|
||||
if (state == LOW && setItem > 0){
|
||||
@@ -39,11 +40,21 @@ void handle_Set_switch(){
|
||||
delay(200);
|
||||
}
|
||||
else if(state == LOW && setItem == 0) {
|
||||
int presstime = get_pin_delay(pinSet);
|
||||
if (presstime > 10){
|
||||
//Do some Stuff here
|
||||
|
||||
delay(200);
|
||||
wait_to_release(pinSet);
|
||||
}
|
||||
else{
|
||||
switch_lamp();
|
||||
delay(200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//If Time switch pressed
|
||||
void handle_Time_switch(){
|
||||
int state = digitalRead(pinTime);
|
||||
if(state == LOW && setItem == 0) {
|
||||
@@ -64,24 +75,27 @@ void handle_Time_switch(){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Helper for long-press
|
||||
int get_pin_delay(int pin){
|
||||
int state = digitalRead(pin);
|
||||
int delay_count = 0;
|
||||
while(state == LOW && delay_count < 11)
|
||||
{
|
||||
state = digitalRead(pin);
|
||||
update_display();
|
||||
delay(100);
|
||||
delay_count = delay_count +1;
|
||||
}
|
||||
return delay_count;
|
||||
}
|
||||
|
||||
//Helper for long-press
|
||||
void wait_to_release(int pin){
|
||||
int state = digitalRead(pin);
|
||||
while(state == LOW)
|
||||
{
|
||||
state = digitalRead(pin);
|
||||
update_display();
|
||||
delay(100);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//Helpers
|
||||
String logfile = "";
|
||||
//Webserver
|
||||
//###################################################################################
|
||||
@@ -52,6 +53,23 @@ void handleArgs(){
|
||||
write_eeprom();
|
||||
}
|
||||
}
|
||||
redirect();
|
||||
break;
|
||||
}
|
||||
else if (server.argName(i) == "ntp_server"){
|
||||
if (server.arg(i) != ""){
|
||||
ntp_server = server.arg(i);
|
||||
write_eeprom();
|
||||
}
|
||||
redirect();
|
||||
break;
|
||||
}
|
||||
else if(server.argName(i) == "wakeup_time"){
|
||||
if (server.arg(i) != ""){
|
||||
wakeup_time = server.arg(i).toInt();
|
||||
write_eeprom();
|
||||
}
|
||||
redirect();
|
||||
break;
|
||||
}
|
||||
else if(server.argName(i) == "a1"){
|
||||
@@ -61,6 +79,7 @@ void handleArgs(){
|
||||
else if (server.arg(i) == "false"){
|
||||
Clock.turnOffAlarm(1);
|
||||
}
|
||||
redirect();
|
||||
break;
|
||||
}
|
||||
else if(server.argName(i) == "a2"){
|
||||
@@ -70,18 +89,21 @@ void handleArgs(){
|
||||
else if (server.arg(i) == "false"){
|
||||
Clock.turnOffAlarm(2);
|
||||
}
|
||||
redirect();
|
||||
break;
|
||||
}
|
||||
else if(server.argName(i) == "al1h" && server.argName(i +1) == "al1m"){
|
||||
al1h = server.arg(i).toInt();
|
||||
al1m = server.arg(i+1).toInt();
|
||||
set_alarm1();
|
||||
redirect();
|
||||
break;
|
||||
}
|
||||
else if(server.argName(i) == "al2h" && server.argName(i +1) == "al2m"){
|
||||
al2h = server.arg(i).toInt();
|
||||
al2m = server.arg(i+1).toInt();
|
||||
set_alarm2();
|
||||
redirect();
|
||||
break;
|
||||
}
|
||||
else if(server.argName(i) == "reset" && server.arg(i) == "true"){
|
||||
@@ -89,6 +111,13 @@ void handleArgs(){
|
||||
ESP.restart();
|
||||
break;
|
||||
}
|
||||
else if(server.argName(i) == "factory_reset" && server.arg(i) == "true"){
|
||||
reset_eeprom();
|
||||
print_reset();
|
||||
delay(1000);
|
||||
ESP.restart();
|
||||
break;
|
||||
}
|
||||
}
|
||||
print_website();
|
||||
}
|
||||
@@ -102,11 +131,12 @@ void print_website(){
|
||||
bool A2 = Clock.checkAlarmEnabled(2);
|
||||
String Alarm1 = "<b>Alarm 1:</b> <form action=\"/\" methode=\"get\"><input type=\"number\" name=\"al1h\" value=\"" + String(al1h) + "\">:<input type=\"number\" name=\"al1m\" value=\"" + String(al1m) + "\"><input type=\"submit\" value=\"Speichern\"></form> Sommerzeit: " + getBoolString(summer) + "<br>Aktiv: " + getBoolString(A1) + "<br><a href=\"?a1=true\">Aktivieren</a> " + " <a href=\"?a1=false\">Deaktivieren</a>";
|
||||
String Alarm2 = "<b>Alarm 2:</b> <form action=\"/\" methode=\"get\"><input type=\"number\" name=\"al2h\" value=\"" + String(al2h) + "\">:<input type=\"number\" name=\"al2m\" value=\"" + String(al2m) + "\"><input type=\"submit\" value=\"Speichern\"></form> Sommerzeit: " + getBoolString(summer) + "<br>Aktiv: " + getBoolString(A2) + "<br><a href=\"?a2=true\">Aktivieren</a> " + " <a href=\"?a2=false\">Deaktivieren</a>";
|
||||
String Alarm = "<h3>Alarm</h3>" + Alarm1 + "<br><br>" + Alarm2;
|
||||
String Weckzeit = "<b>Weckdauer (Minuten):</b> <form action=\"/\" methode=\"get\"><input type=\"number\" name=\"wakeup_time\" value=\"" + String(wakeup_time) + "\"><input type=\"submit\" value=\"Speichern\"></form>";
|
||||
String Alarm = "<h3>Alarm</h3>" + Alarm1 + "<br><br>" + Alarm2 + "<br><br>" + Weckzeit;
|
||||
String Zeit = "<br><h3>Zeit</h3>" + String(h) + ":" + String(m) + ":" + String(s) + " - " + String(d) + "." + String(M) + "." + String(y) + " | DST: " + String(summertime_EU(y,M,d,h,1));
|
||||
String NTP = "<br><h3>NTP</h3>" + String("stündliches Zeit Update über " + ntp_server + ": ") + getBoolString(ntp_update) + "<br><a href=\"?ntp=true\">Aktivieren</a> " + " <a href=\"?ntp=false\">Deaktivieren</a>";
|
||||
String Reboot = "<br><h3>System:</h3><a href=\"?reset=true\">Neustart</a><br><br><a href=\"update\">Software Update Modus</a>";
|
||||
String Body = card_start + Alarm + card_end + card_start + Zeit + card_end + card_start + NTP + card_end + card_start + Reboot + card_end;
|
||||
String NTP = "<br><h3>NTP</h3><b>Server:</b> <form action=\"/\" methode=\"get\"><input type=\"text\" name=\"ntp_server\" value=\"" + String(ntp_server) + "\"><input type=\"submit\" value=\"Speichern\"></form><br>stündliches Zeit Update: " + getBoolString(ntp_update) + "<br><a href=\"?ntp=true\">Aktivieren</a> " + " <a href=\"?ntp=false\">Deaktivieren</a>";
|
||||
String Reboot = "<br><h3>System:</h3><a href=\"?reset=true\">Neustart</a><br><br><a href=\"update\">Software Update Modus</a><br><br><a href=\"?factory_reset=true\">Werkseinstellungen</a><br><br><a href=\"log\">Log</a>";
|
||||
String Body = card_start + Alarm + card_end + card_start + NTP + card_end + card_start + Reboot + card_end;
|
||||
server.send(200, "text/html", Header + Body + Footer);
|
||||
}
|
||||
|
||||
@@ -116,6 +146,11 @@ void print_reset(){
|
||||
delay(500);
|
||||
}
|
||||
|
||||
void redirect(){
|
||||
String redirect = "<head><meta http-equiv=\"refresh\" content=\"0; URL=/\" /></head>";
|
||||
server.send(200, "text/html", redirect);
|
||||
delay(50);
|
||||
}
|
||||
//Helpers
|
||||
//####################################################################################
|
||||
String getBoolString(bool value){
|
||||
|
||||
Reference in New Issue
Block a user