summaryrefslogtreecommitdiff
path: root/HouseControl.ino
diff options
context:
space:
mode:
Diffstat (limited to 'HouseControl.ino')
-rw-r--r--HouseControl.ino29
1 files changed, 15 insertions, 14 deletions
diff --git a/HouseControl.ino b/HouseControl.ino
index af05379..e18fbfc 100644
--- a/HouseControl.ino
+++ b/HouseControl.ino
@@ -49,15 +49,15 @@ struct st_config {
byte def_gateway[4];
byte def_dnsserver[4];
- byte ntpServer[4];
- int UTC_offset;
+ byte ntpserver[4];
+ int utcoffset;
- byte notifyHost[4];
- unsigned int notifyPort;
+ byte notifyhost[4];
+ unsigned int notifyport;
- byte frontdoor_holdtime;
+ byte frontdoor_unlocktime;
- byte garagedoor_nightgracetime;
+ byte garagedoor_gracetime;
byte dawn;
byte dusk;
};
@@ -208,7 +208,7 @@ void sendNTPpacket() {
// all NTP fields have been given values, now
// we send a packet requesting a timestamp:
- NTPSocket.beginPacket(config.ntpServer, 123);
+ NTPSocket.beginPacket(config.ntpserver, 123);
NTPSocket.write(pb, sizeof(pb));
NTPSocket.endPacket();
}
@@ -238,7 +238,7 @@ void parseNTPresponse() {
ntp_time -= 2208988800UL;
// Adjust timezone and DST...
- ntp_time += (config.UTC_offset * 3600L) / 100L; // Notice the L for long calculations!!
+ ntp_time += (config.utcoffset * 3600L) / 100L; // Notice the L for long calculations!!
if (ntp_time_frac > 0.4) ntp_time++; // adjust fractional part, see above
setTime(ntp_time);
@@ -351,14 +351,15 @@ void configGetHandler(WebServer &server, WebServer::ConnectionType type, char *u
server.print(ip_to_str(buf2, config.def_dnsserver));
server.print(F("\",\"ntpserver\":\""));
- server.print(ip_to_str(buf2, config.ntpServer));
+ server.print(ip_to_str(buf2, config.ntpserver));
- sprintf((char*)buf1, "\",\"utcoffset\":\"%+05d\",\"stathost\":\"", config.UTC_offset);
+ sprintf_P((char*)buf1, PSTR("\",\"utcoffset\":\"%+05d\",\"stathost\":\""), config.utcoffset);
server.print((char*)buf1);
- server.print(ip_to_str(buf2, config.notifyHost));
+ server.print(ip_to_str(buf2, config.notifyhost));
- sprintf((char*)buf1, "\",\"statport\":%u,\"fd_utime\":%u,\"gd_gtime\":%u,", config.notifyPort, config.frontdoor_holdtime, config.garagedoor_nightgracetime);
+ sprintf_P((char*)buf1, PSTR("\",\"statport\":%u,\"fd_utime\":%u,\"gd_gtime\":%u,"),
+ config.notifyport, config.frontdoor_unlocktime, config.garagedoor_gracetime);
server.print((char*)buf1);
sprintf_P((char*)buf1, PSTR("\"dawn\":%u,\"dusk\":%u}}"), config.dawn, config.dusk);
@@ -482,7 +483,7 @@ void garageDoorNightCheck(struct st_door *door) {
if ( lastNTPtime > 0
&& !door->controlActive && door->open
&& ((hour(time) >= config.dusk) || (hour(time) < config.dawn))
- && ((time - door->openTime) >= (config.garagedoor_nightgracetime * 60))
+ && ((time - door->openTime) >= (config.garagedoor_gracetime * 60))
)
toggleDoorControl(door);
}
@@ -549,7 +550,7 @@ void loop() {
readDoorState(&garageDoor1);
readDoorState(&garageDoor2);
- deToggleDoorCheck(&frontDoor, config.frontdoor_holdtime);
+ deToggleDoorCheck(&frontDoor, config.frontdoor_unlocktime);
deToggleDoorCheck(&garageDoor1, 1);
deToggleDoorCheck(&garageDoor2, 1);