Add command SetOption52

Add command SetOption52 to control display of optional time offset from UTC in JSON messages (#3629, #3711)
This commit is contained in:
Theo Arends 2018-09-06 12:37:50 +02:00
parent 3ccf83d1a6
commit dd95bb393e
4 changed files with 19 additions and 21 deletions

View File

@ -1,5 +1,6 @@
/* 6.2.1.2 20180906
* Fix KNX PA exception. Regression from 6.2.1 buffer overflow (#3700, #3710)
* Add command SetOption52 to control display of optional time offset from UTC in JSON messages (#3629, #3711)
*
* 6.2.1.1 20180905
* Rewrite energy monitoring using energy sensor driver modules

View File

@ -65,7 +65,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
struct { // SetOption50 .. SetOption81
uint32_t timers_enable : 1; // bit 0 (v6.1.1b)
uint32_t user_esp8285_enable : 1; // bit 1 (v6.1.1.14)
uint32_t spare02 : 1;
uint32_t time_append_timezone : 1; // bit 2 (v6.2.1.2)
uint32_t spare03 : 1;
uint32_t spare04 : 1;
uint32_t spare05 : 1;

View File

@ -1804,13 +1804,13 @@ String GetBuildDateAndTime()
/*
* timestamps in https://en.wikipedia.org/wiki/ISO_8601 format
*
*
* DT_UTC - current data and time in Greenwich, England (aka GMT)
* DT_LOCAL - current date and time taking timezone into account
* DT_RESTART - the date and time this device last started, in local timezone
*
*
* Format:
* "2017-03-07T11:08:02-07:00" - if DT_LOCAL and TIME_APPEND_TIMEZONE=1
* "2017-03-07T11:08:02-07:00" - if DT_LOCAL and SetOption52 = 1
* "2017-03-07T11:08:02" - otherwise
*/
String GetDateAndTime(byte time_type)
@ -1838,8 +1838,8 @@ String GetDateAndTime(byte time_type)
snprintf_P(dt, sizeof(dt), PSTR("%04d-%02d-%02dT%02d:%02d:%02d"),
tmpTime.year, tmpTime.month, tmpTime.day_of_month, tmpTime.hour, tmpTime.minute, tmpTime.second);
if (TIME_APPEND_TIMEZONE && (time_type == DT_LOCAL)) {
snprintf_P(dt, sizeof(dt), PSTR("%s%+03d:00"), dt, Settings.timezone);
if (Settings.flag3.time_append_timezone && (time_type == DT_LOCAL)) {
snprintf_P(dt, sizeof(dt), PSTR("%s%+03d:%02d"), dt, time_timezone / 10, abs((time_timezone % 10) * 6)); // if timezone = +2:30 then time_timezone = 25
}
return String(dt);

View File

@ -137,23 +137,20 @@
#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 // [TimeDst] Hemisphere (0 or North, 1 or South)
#define TIME_DST_WEEK Last // Week of month (0 or Last, 1 or First, 2 or Second, 3 or Third, 4 or Fourth)
#define TIME_DST_DAY Sun // Day of week (1 or Sun, 2 or Mon, 3 or Tue, 4 or Wed, 5 or Thu, 6 or Fri, 7 or Sat)
#define TIME_DST_MONTH Mar // Month (1 or Jan, 2 or Feb, 3 or Mar, 4 or Apr, 5 or May, 6 or Jun, 7 or Jul, 8 or Aug, 9 or Sep, 10 or Oct, 11 or Nov, 12 or Dec)
#define TIME_DST_HOUR 2 // Hour (0 to 23)
#define TIME_DST_OFFSET +120 // Offset from UTC in minutes (-780 to +780)
#define TIME_DST_HEMISPHERE North // [TimeDst] Hemisphere (0 or North, 1 or South)
#define TIME_DST_WEEK Last // Week of month (0 or Last, 1 or First, 2 or Second, 3 or Third, 4 or Fourth)
#define TIME_DST_DAY Sun // Day of week (1 or Sun, 2 or Mon, 3 or Tue, 4 or Wed, 5 or Thu, 6 or Fri, 7 or Sat)
#define TIME_DST_MONTH Mar // Month (1 or Jan, 2 or Feb, 3 or Mar, 4 or Apr, 5 or May, 6 or Jun, 7 or Jul, 8 or Aug, 9 or Sep, 10 or Oct, 11 or Nov, 12 or Dec)
#define TIME_DST_HOUR 2 // Hour (0 to 23)
#define TIME_DST_OFFSET +120 // Offset from UTC in minutes (-780 to +780)
// -- Time - Start Standard Time and timezone offset from UTC in minutes
#define TIME_STD_HEMISPHERE North // [TimeStd] Hemisphere (0 or North, 1 or South)
#define TIME_STD_WEEK Last // Week of month (0 or Last, 1 or First, 2 or Second, 3 or Third, 4 or Fourth)
#define TIME_STD_DAY Sun // Day of week (1 or Sun, 2 or Mon, 3 or Tue, 4 or Wed, 5 or Thu, 6 or Fri, 7 or Sat)
#define TIME_STD_MONTH Oct // Month (1 or Jan, 2 or Feb, 3 or Mar, 4 or Apr, 5 or May, 6 or Jun, 7 or Jul, 8 or Aug, 9 or Sep, 10 or Oct, 11 or Nov, 12 or Dec)
#define TIME_STD_HOUR 3 // Hour (0 to 23)
#define TIME_STD_OFFSET +60 // Offset from UTC in minutes (-780 to +780)
// -- Time - formatting options
#define TIME_APPEND_TIMEZONE 0 // for local timestamps: 0 = no timezone in string, 1 = append numeric timezone (e.g. "+1:00" or "-7:00")
#define TIME_STD_HEMISPHERE North // [TimeStd] Hemisphere (0 or North, 1 or South)
#define TIME_STD_WEEK Last // Week of month (0 or Last, 1 or First, 2 or Second, 3 or Third, 4 or Fourth)
#define TIME_STD_DAY Sun // Day of week (1 or Sun, 2 or Mon, 3 or Tue, 4 or Wed, 5 or Thu, 6 or Fri, 7 or Sat)
#define TIME_STD_MONTH Oct // Month (1 or Jan, 2 or Feb, 3 or Mar, 4 or Apr, 5 or May, 6 or Jun, 7 or Jul, 8 or Aug, 9 or Sep, 10 or Oct, 11 or Nov, 12 or Dec)
#define TIME_STD_HOUR 3 // Hour (0 to 23)
#define TIME_STD_OFFSET +60 // Offset from UTC in minutes (-780 to +780)
// -- Location ------------------------------------
#define LATITUDE 48.858360 // [Latitude] Your location to be used with sunrise and sunset