diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index cf71d6a44..423e10cea 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -1,6 +1,13 @@ /* 6.5.0.5 20190406 * Add compile time GUI hexadecimal only color options in my_user_config.h (#5586) * Fix template activation and/or module selection regression from 6.5.0.4 (#5598) + * Add rule Http#Initialized + * Add command WebColor to change non-persistent GUI colors on the fly + Use a rule like: + rule3 on http#initialized do webcolor {"webcolor":["#eeeeee","#181818","#4f4f4f","#000000","#dddddd","#008000","#222222","#ff0000","#008000","#ffffff","#1fa3ec","#0e70a4","#d43535","#931f1f","#47c266","#5aaf6f","#ffffff","#999999","#000000"]} endon + or + rule3 on http#initialized do webcolor {"webcolor":["#eee","#181818","#4f4f4f","#000","#ddd","#008000","#222"]} endon + to make color changes persistent) * * 6.5.0.4 20190402 * Fix Configure Timer Web GUI (#5568) diff --git a/sonoff/i18n.h b/sonoff/i18n.h index 58e1ba63d..cd6893489 100644 --- a/sonoff/i18n.h +++ b/sonoff/i18n.h @@ -311,6 +311,7 @@ #define D_CMND_WEBLOG "WebLog" #define D_CMND_WEBREFRESH "WebRefresh" #define D_CMND_WEBSEND "WebSend" +#define D_CMND_WEBCOLOR "WebColor" #define D_CMND_EMULATION "Emulation" // Commands xdrv_03_energy.ino diff --git a/sonoff/settings.h b/sonoff/settings.h index 329b152f4..bb1007450 100644 --- a/sonoff/settings.h +++ b/sonoff/settings.h @@ -397,7 +397,7 @@ struct XDRVMAILBOX { char *data; } XdrvMailbox; -const uint8_t MAX_RULES_FLAG = 7; // Number of bits used in RulesBitfield (tricky I know...) +const uint8_t MAX_RULES_FLAG = 8; // Number of bits used in RulesBitfield (tricky I know...) typedef union { // Restricted by MISRA-C Rule 18.4 but so useful... uint16_t data; // Allow bit manipulation struct { @@ -408,7 +408,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint16_t mqtt_disconnected : 1; uint16_t wifi_connected : 1; uint16_t wifi_disconnected : 1; - uint16_t spare07 : 1; + uint16_t http_init : 1; uint16_t spare08 : 1; uint16_t spare09 : 1; uint16_t spare10 : 1; diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 0c1822dc5..7dd24f2c2 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -1005,7 +1005,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) } } } - else if (data_len > 9) { // Workaround exception if empty JSON like {} - Needs checks + else { if (JsonTemplate(dataBuf)) { // Free 336 bytes StaticJsonBuffer stack space by moving code to function if (USER_MODULE == Settings.module) { restart_flag = 2; } } else { diff --git a/sonoff/support.ino b/sonoff/support.ino index 594ca342e..348e5829b 100644 --- a/sonoff/support.ino +++ b/sonoff/support.ino @@ -1009,6 +1009,10 @@ bool GetUsedInModule(uint8_t val, uint8_t *arr) bool JsonTemplate(const char* dataBuf) { + // {"NAME":"Generic","GPIO":[17,254,29,254,7,254,254,254,138,254,139,254,254],"FLAG":1,"BASE":255} + + if (strlen(dataBuf) < 9) { return false; } // Workaround exception if empty JSON like {} - Needs checks + StaticJsonBuffer<350> jb; // 331 from https://arduinojson.org/v5/assistant/ JsonObject& obj = jb.parseObject(dataBuf); if (!obj.success()) { return false; } diff --git a/sonoff/xdrv_01_webserver.ino b/sonoff/xdrv_01_webserver.ino index 35e10fd63..d8caf794f 100644 --- a/sonoff/xdrv_01_webserver.ino +++ b/sonoff/xdrv_01_webserver.ino @@ -79,6 +79,15 @@ #ifndef COLOR_BUTTON_SAVE_HOVER #define COLOR_BUTTON_SAVE_HOVER "#5aaf6f" // Save button color when hovered over - Darker greenish #endif +#ifndef COLOR_TIMER_TAB_TEXT +#define COLOR_TIMER_TAB_TEXT "#fff" // Config timer tab text color - White +#endif +#ifndef COLOR_TIMER_TAB_BACKGROUND +#define COLOR_TIMER_TAB_BACKGROUND "#999" // Config timer tab background color - Light grey +#endif +#ifndef COLOR_TIMER_ACTIVE_TAB_TEXT +#define COLOR_TIMER_ACTIVE_TAB_TEXT "#000" // Config timer active tab text color - Black +#endif const uint16_t CHUNKED_BUFFER_SIZE = 400; // Chunk buffer size (should be smaller than half mqtt_date size) @@ -288,21 +297,21 @@ const char HTTP_HEAD_STYLE1[] PROGMEM = "