forked from ppphilll/arduino_valves
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfiguration.h
48 lines (38 loc) · 1.66 KB
/
configuration.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef _CONFIGURATION_H
#define _CONFIGURATION_H
#include <Arduino.h>
struct wifi_config_t
{
//wifi
char ssid[20];
char password[20];
//host
char host[15]; //host for the includes
};
struct config_t
{
//valves
int dummy_valve = 255;
//valves
uint8_t valves[8] = {D6, D4, D3, D5, 255, 255, 255, 255};
char* valveLabels[8] = {"Garden Lights", "Gate", "Watering", "Unused", "Unused", "Unused", "Unused", "Unused"};
bool valveStatuses[8] = {false, false, false, false, false, false, false, false};
//getters
int getValveCount(){
return (sizeof(valves)/sizeof(*valves));
}
//ui config
char ON[8] = "#00D800"; //on color
char OFF[8] = "#FF0000"; //off color
char OFFL[8] = "gray"; //offline color
//html includes
String pagestart_noscript = "<html><head></head><body><div class='header'>Valve Control System</div>";
String pagestart = "<html><head><script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script><script src=\"http://HOST_$/valves/script.js\"></script><link rel=\"stylesheet\" href=\"http://HOST_$/valves/style.css\"></head><body><div class='header'>Valve Control System</div>";
String pageend = "</body></html>";
String wifisetup = "<form action=\"configuration.save\" method=\"POST\"><label for=\"_ssid\">SSID</label><input type=\"text\" name=\"_ssid\"/><label for=\"_password\">Password</label><input type=\"password\" name=\"_password\"/><label for=\"_host\">Host</label><input type=\"text\" name=\"_host\"/><input type=\"submit\" /></form>";
String getPageStart(char host[]){
pagestart.replace("HOST_$", String(host));
return pagestart;
}
};
#endif