mirror of https://github.com/arendst/Tasmota.git
commit
32a218ddf5
|
@ -171,7 +171,7 @@ If you like **Sonoff-Tasmota**, give it a star, or fork it and contribute!
|
|||
### Development
|
||||
[![Build Status](https://img.shields.io/travis/arendst/Sonoff-Tasmota.svg)](https://travis-ci.org/arendst/Sonoff-Tasmota)
|
||||
|
||||
Current version is **5.13.1a** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
|
||||
Current version is **5.13.1b** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
|
||||
|
||||
### Quick install
|
||||
Download one of the released binaries from https://github.com/arendst/Sonoff-Tasmota/releases and flash it to your hardware as documented in the wiki.
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
/* 5.13.1a
|
||||
/* 5.13.1b
|
||||
* Prep for user entry DST/STD (#2721)
|
||||
*
|
||||
* 5.13.1a
|
||||
* Change user_config.h otaurl to http://sonoff.maddox.co.uk/tasmota/sonoff.bin (#2588, #2602)
|
||||
* Fix configuration restore regression from 5.13.1
|
||||
* Fix compile error when ADC is enabled and Rules are disabled (#2608)
|
||||
|
|
|
@ -89,6 +89,17 @@ typedef union {
|
|||
};
|
||||
} SysBitfield2;
|
||||
|
||||
typedef union {
|
||||
uint16_t data;
|
||||
struct {
|
||||
uint16_t hemis : 1; // bit 0 = 0=Northern, 1=Southern Hemisphere (=Opposite DST/STD)
|
||||
uint16_t week : 3; // bits 1 - 3 = 0=Last week of the month, 1=First, 2=Second, 3=Third, 4=Fourth
|
||||
uint16_t month : 4; // bits 4 - 7 = 1=Jan, 2=Feb, ... 12=Dec
|
||||
uint16_t dow : 3; // bits 8 - 10 = day of week, 1=Sun, 2=Mon, ... 7=Sat
|
||||
uint16_t hour : 5; // bits 11 - 15 = 0-23
|
||||
};
|
||||
} TimeRule;
|
||||
|
||||
typedef union {
|
||||
uint32_t data;
|
||||
struct {
|
||||
|
@ -148,9 +159,8 @@ struct SYSCFG {
|
|||
uint8_t display_address[8]; // 2D8
|
||||
uint8_t display_dimmer; // 2E0
|
||||
uint8_t display_size; // 2E1
|
||||
|
||||
uint8_t free_2E2[4]; // 2E2
|
||||
|
||||
TimeRule std_flags; // 2E2
|
||||
int16_t std_offset; // 2E4 offset from UTC in minutes
|
||||
uint16_t pwm_frequency; // 2E6
|
||||
power_t power; // 2E8
|
||||
uint16_t pwm_value[MAX_PWMS]; // 2EC
|
||||
|
@ -234,9 +244,7 @@ struct SYSCFG {
|
|||
char ntp_server[3][33]; // 4CE
|
||||
byte ina219_mode; // 531
|
||||
uint16_t pulse_timer[MAX_PULSETIMERS]; // 532
|
||||
|
||||
byte free_542[2]; // 542
|
||||
|
||||
TimeRule dst_flags; // 542
|
||||
uint32_t ip_address[4]; // 544
|
||||
unsigned long energy_kWhtotal; // 554
|
||||
char mqtt_fulltopic[100]; // 558
|
||||
|
@ -246,8 +254,9 @@ struct SYSCFG {
|
|||
uint16_t pulse_counter_debounce; // 5D2
|
||||
uint8_t rf_code[17][9]; // 5D4
|
||||
|
||||
byte free_66d[3]; // 66D
|
||||
byte free_66d[1]; // 66D
|
||||
|
||||
int16_t dst_offset; // 66E
|
||||
Timer timer[MAX_TIMERS]; // 670
|
||||
int latitude; // 6B0
|
||||
int longitude; // 6B4
|
||||
|
@ -289,19 +298,6 @@ struct TIME_T {
|
|||
unsigned long valid;
|
||||
} RtcTime;
|
||||
|
||||
struct TimeChangeRule
|
||||
{
|
||||
uint8_t hemis; // 0-Northern, 1=Southern Hemisphere (=Opposite DST/STD)
|
||||
uint8_t week; // 1=First, 2=Second, 3=Third, 4=Fourth, or 0=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
|
||||
};
|
||||
|
||||
TimeChangeRule DaylightSavingTime = { TIME_DST }; // Daylight Saving Time
|
||||
TimeChangeRule StandardTime = { TIME_STD }; // Standard Time
|
||||
|
||||
struct XDRVMAILBOX {
|
||||
uint16_t valid;
|
||||
uint16_t index;
|
||||
|
|
|
@ -521,6 +521,8 @@ void SettingsDefaultSet2()
|
|||
|
||||
Settings.latitude = (int)((double)LATITUDE * 1000000);
|
||||
Settings.longitude = (int)((double)LONGITUDE * 1000000);
|
||||
|
||||
SettingsDefaultSet_5_13_1a();
|
||||
}
|
||||
|
||||
/********************************************************************************************/
|
||||
|
@ -652,6 +654,22 @@ void SettingsDefaultSet_5_10_1()
|
|||
Settings.display_size = 1;
|
||||
}
|
||||
|
||||
void SettingsDefaultSet_5_13_1a()
|
||||
{
|
||||
Settings.dst_flags.hemis = TIME_DST_HEMISPHERE;
|
||||
Settings.dst_flags.week = TIME_DST_WEEK;
|
||||
Settings.dst_flags.dow = TIME_DST_DAY;
|
||||
Settings.dst_flags.month = TIME_DST_MONTH;
|
||||
Settings.dst_flags.hour = TIME_DST_HOUR;
|
||||
Settings.dst_offset = TIME_DST_OFFSET;
|
||||
Settings.std_flags.hemis = TIME_STD_HEMISPHERE;
|
||||
Settings.std_flags.week = TIME_STD_WEEK;
|
||||
Settings.std_flags.dow = TIME_STD_DAY;
|
||||
Settings.std_flags.month = TIME_STD_MONTH;
|
||||
Settings.std_flags.hour = TIME_STD_HOUR;
|
||||
Settings.std_offset = TIME_STD_OFFSET;
|
||||
}
|
||||
|
||||
/********************************************************************************************/
|
||||
|
||||
void SettingsDelta()
|
||||
|
@ -852,10 +870,14 @@ void SettingsDelta()
|
|||
memset(&Settings.knx_physsical_addr, 0x00, 0x800 - 0x6b8); // Reset until 0x800 for future use
|
||||
}
|
||||
if (Settings.version < 0x050C000F) {
|
||||
Settings.energy_kWhtoday /= 1000;
|
||||
Settings.energy_kWhyesterday /= 1000;
|
||||
RtcSettings.energy_kWhtoday /= 1000;
|
||||
Settings.energy_kWhtoday /= 1000;
|
||||
Settings.energy_kWhyesterday /= 1000;
|
||||
RtcSettings.energy_kWhtoday /= 1000;
|
||||
}
|
||||
if (Settings.version < 0x050D0102) {
|
||||
SettingsDefaultSet_5_13_1a();
|
||||
}
|
||||
|
||||
Settings.version = VERSION;
|
||||
SettingsSave(1);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
- Select IDE Tools - Flash Size: "1M (no SPIFFS)"
|
||||
====================================================*/
|
||||
|
||||
#define VERSION 0x050D0101 // 5.13.1a
|
||||
#define VERSION 0x050D0102 // 5.13.1b
|
||||
|
||||
// Location specific includes
|
||||
#include <core_version.h> // Arduino_Esp8266 version information (ARDUINO_ESP8266_RELEASE and ARDUINO_ESP8266_RELEASE_2_3_0)
|
||||
|
|
|
@ -1288,7 +1288,7 @@ uint32_t MakeTime(TIME_T &tm)
|
|||
return seconds;
|
||||
}
|
||||
|
||||
uint32_t RuleToTime(TimeChangeRule r, int yr)
|
||||
uint32_t RuleToTime(TimeRule r, int yr)
|
||||
{
|
||||
TIME_T tm;
|
||||
uint32_t t;
|
||||
|
@ -1367,8 +1367,8 @@ void RtcSecond()
|
|||
}
|
||||
BreakTime(utc_time, tmpTime);
|
||||
RtcTime.year = tmpTime.year + 1970;
|
||||
daylight_saving_time = RuleToTime(DaylightSavingTime, RtcTime.year);
|
||||
standard_time = RuleToTime(StandardTime, RtcTime.year);
|
||||
daylight_saving_time = RuleToTime(Settings.dst_flags, RtcTime.year);
|
||||
standard_time = RuleToTime(Settings.std_flags, RtcTime.year);
|
||||
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION "(" D_UTC_TIME ") %s, (" D_DST_TIME ") %s, (" D_STD_TIME ") %s"),
|
||||
GetTime(0).c_str(), GetTime(2).c_str(), GetTime(3).c_str());
|
||||
AddLog(LOG_LEVEL_DEBUG);
|
||||
|
@ -1389,22 +1389,22 @@ void RtcSecond()
|
|||
if (local_time > 1451602800) { // 2016-01-01
|
||||
int32_t time_offset = Settings.timezone * SECS_PER_HOUR;
|
||||
if (99 == Settings.timezone) {
|
||||
dstoffset = DaylightSavingTime.offset * SECS_PER_MIN;
|
||||
stdoffset = StandardTime.offset * SECS_PER_MIN;
|
||||
if (DaylightSavingTime.hemis) {
|
||||
dstoffset = Settings.dst_offset * SECS_PER_MIN;
|
||||
stdoffset = Settings.std_offset * SECS_PER_MIN;
|
||||
if (Settings.dst_flags.hemis) {
|
||||
// Southern hemisphere
|
||||
if ((utc_time >= (standard_time - dstoffset)) && (utc_time < (daylight_saving_time - stdoffset))) {
|
||||
time_offset = stdoffset; // Standard Time
|
||||
} else {
|
||||
time_offset = dstoffset; // Daylight Saving Time
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Northern hemisphere
|
||||
if ((utc_time >= (daylight_saving_time - stdoffset)) && (utc_time < (standard_time - dstoffset))) {
|
||||
time_offset = dstoffset; // Daylight Saving Time
|
||||
} else {
|
||||
time_offset = stdoffset; // Standard Time
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
local_time += time_offset;
|
||||
|
|
|
@ -130,6 +130,22 @@
|
|||
#define NTP_SERVER2 "nl.pool.ntp.org" // [NtpServer2] Select second NTP server by name or IP address (5.39.184.5)
|
||||
#define NTP_SERVER3 "0.nl.pool.ntp.org" // [NtpServer3] Select third NTP server by name or IP address (93.94.224.67)
|
||||
|
||||
// -- Time - Start Daylight Saving Time and timezone offset from UTC in minutes
|
||||
#define TIME_DST_HEMISPHERE North // Northern Hemisphere
|
||||
#define TIME_DST_WEEK Last
|
||||
#define TIME_DST_DAY Sun
|
||||
#define TIME_DST_MONTH Mar // Last sunday in march
|
||||
#define TIME_DST_HOUR 2 // at 02:00
|
||||
#define TIME_DST_OFFSET +120 // +120 minutes
|
||||
|
||||
// -- Time - Start Standard Time and timezone offset from UTC in minutes
|
||||
#define TIME_STD_HEMISPHERE North // Northern Hemisphere
|
||||
#define TIME_STD_WEEK Last
|
||||
#define TIME_STD_DAY Sun
|
||||
#define TIME_STD_MONTH Oct // Last sunday in october
|
||||
#define TIME_STD_HOUR 3 // at 03:00
|
||||
#define TIME_STD_OFFSET +60 // +60 minutes
|
||||
|
||||
// -- Location ------------------------------------
|
||||
#define LATITUDE 48.858360 // [Latitude] Your location to be used with sunrise and sunset
|
||||
#define LONGITUDE 2.294442 // [Longitude] Your location to be used with sunrise and sunset
|
||||
|
@ -224,12 +240,6 @@
|
|||
#define WEBSERVER_ADVERTISE // Provide access to webserver by name <Hostname>.local/
|
||||
#define MQTT_HOST_DISCOVERY // Find MQTT host server (overrides MQTT_HOST if found)
|
||||
|
||||
// -- Time - Start Daylight Saving Time and timezone offset from UTC in minutes
|
||||
#define TIME_DST North, Last, Sun, Mar, 2, +120 // Northern Hemisphere, Last sunday in march at 02:00 +120 minutes
|
||||
|
||||
// -- Time - Start Standard Time and timezone offset from UTC in minutes
|
||||
#define TIME_STD North, Last, Sun, Oct, 3, +60 // Northern Hemisphere, Last sunday in october 02:00 +60 minutes
|
||||
|
||||
// -- Time ----------------------------------------
|
||||
#define USE_TIMERS // Add support for up to 16 timers (+2k2 code)
|
||||
#define USE_TIMERS_WEB // Add timer webpage support (+4k5 code)
|
||||
|
|
Loading…
Reference in New Issue