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 /* 6.2.1.2 20180906
* Fix KNX PA exception. Regression from 6.2.1 buffer overflow (#3700, #3710) * 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 * 6.2.1.1 20180905
* Rewrite energy monitoring using energy sensor driver modules * 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 struct { // SetOption50 .. SetOption81
uint32_t timers_enable : 1; // bit 0 (v6.1.1b) uint32_t timers_enable : 1; // bit 0 (v6.1.1b)
uint32_t user_esp8285_enable : 1; // bit 1 (v6.1.1.14) 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 spare03 : 1;
uint32_t spare04 : 1; uint32_t spare04 : 1;
uint32_t spare05 : 1; uint32_t spare05 : 1;

View File

@ -1810,7 +1810,7 @@ String GetBuildDateAndTime()
* DT_RESTART - the date and time this device last started, in local timezone * DT_RESTART - the date and time this device last started, in local timezone
* *
* Format: * 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 * "2017-03-07T11:08:02" - otherwise
*/ */
String GetDateAndTime(byte time_type) 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"), 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); tmpTime.year, tmpTime.month, tmpTime.day_of_month, tmpTime.hour, tmpTime.minute, tmpTime.second);
if (TIME_APPEND_TIMEZONE && (time_type == DT_LOCAL)) { if (Settings.flag3.time_append_timezone && (time_type == DT_LOCAL)) {
snprintf_P(dt, sizeof(dt), PSTR("%s%+03d:00"), dt, Settings.timezone); 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); return String(dt);

View File

@ -152,9 +152,6 @@
#define TIME_STD_HOUR 3 // Hour (0 to 23) #define TIME_STD_HOUR 3 // Hour (0 to 23)
#define TIME_STD_OFFSET +60 // Offset from UTC in minutes (-780 to +780) #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")
// -- Location ------------------------------------ // -- Location ------------------------------------
#define LATITUDE 48.858360 // [Latitude] Your location to be used with sunrise and sunset #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 #define LONGITUDE 2.294442 // [Longitude] Your location to be used with sunrise and sunset