Skip to content

Commit

Permalink
Merge branch 'v2.0' into mega
Browse files Browse the repository at this point in the history
  • Loading branch information
psy0rz committed Jan 15, 2018
2 parents 0833029 + 744f221 commit 9d3dd49
Show file tree
Hide file tree
Showing 10 changed files with 983 additions and 599 deletions.
5 changes: 3 additions & 2 deletions .atom-build.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# cmd: "cd {PROJECT_PATH}; platformio"
cmd: "platformio"
name: "Build with error highlighting (dev_ESP8266_4096)"
args:
- run --environment dev_ESP8266_4096
sh: true,
cwd: .
sh: true
cwd: "{PROJECT_PATH}"
# env:
# VARIABLE1: "VALUE1"
# VARIABLE2: "VALUE2"
Expand Down
3 changes: 2 additions & 1 deletion src/ESPEasy.ino
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@
// #include <lwip/priv/tcp_priv.h>
#else
#include <lwip/tcp_impl.h>
#endif
#endif
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
ESP8266WebServer WebServer(80);
Expand All @@ -338,6 +338,7 @@
#include "lwip/igmp.h"
#include "include/UdpContext.h"
#include "limits.h"
#include "ESPEasyTimeTypes.h"
extern "C" {
#include "user_interface.h"
}
Expand Down
39 changes: 39 additions & 0 deletions src/ESPEasyTimeTypes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <stdint.h>

struct timeStruct {
timeStruct() : Second(0), Minute(0), Hour(0), Wday(0), Day(0), Month(0), Year(0) {}
uint8_t Second;
uint8_t Minute;
uint8_t Hour;
uint8_t Wday; // day of week, sunday is day 1
uint8_t Day;
uint8_t Month;
uint8_t Year; // offset from 1970;
};

// convenient constants for TimeChangeRules
enum week_t {Last, First, Second, Third, Fourth};
enum dow_t {Sun=1, Mon, Tue, Wed, Thu, Fri, Sat};
enum month_t {Jan=1, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec};

// structure to describe rules for when daylight/summer time begins,
// or when standard time begins.
// For Daylight Saving Time Around the World, see:
// - https://www.timeanddate.com/time/dst/2018.html
// - https://en.wikipedia.org/wiki/Daylight_saving_time_by_country
struct TimeChangeRule {
TimeChangeRule() : week(0), dow(0), month(0), hour(0), offset(0) {}
TimeChangeRule(uint8_t weeknr, uint8_t downr, uint8_t m, uint8_t h, int minutesoffset) :
week(weeknr), dow(downr), month(m), hour(h), offset(minutesoffset) {}

uint8_t week; // First, Second, Third, Fourth, or Last week of the month
uint8_t dow; // day of week, 1=Sun, 2=Mon, ... 7=Sat
uint8_t month; // 1=Jan, 2=Feb, ... 12=Dec
uint8_t hour; // 0-23
int offset; // offset from UTC in minutes
};

// Forward declartions
void applyTimeZone(uint32_t curTime = 0);
void setTimeZone(const TimeChangeRule& dstStart, const TimeChangeRule& stdStart, uint32_t curTime = 0);
uint32_t calcTimeChangeForRule(const TimeChangeRule& r, int yr);
Loading

0 comments on commit 9d3dd49

Please sign in to comment.