mirror of https://github.com/arendst/Tasmota.git
Add command ``WebCanvas``
Add command ``WebCanvas linear-gradient(#FF0018 7%,#FFA52C,#FFFF41,#008018,#0000F9,#86007D 93%)`` to set GUI canvas
This commit is contained in:
parent
70a082c8e5
commit
7a6cca6d20
|
@ -6,7 +6,7 @@ All notable changes to this project will be documented in this file.
|
||||||
## [13.2.0.3]
|
## [13.2.0.3]
|
||||||
### Added
|
### Added
|
||||||
- DeepSleep support through TIMERS (#20117)
|
- DeepSleep support through TIMERS (#20117)
|
||||||
- ESP32 show colorful background if ``WebColor2`` bit0 is not set. Bit0 is default set using #252525
|
- Command ``WebCanvas linear-gradient(#FF0018 7%,#FFA52C,#FFFF41,#008018,#0000F9,#86007D 93%)`` to set GUI canvas
|
||||||
|
|
||||||
### Breaking Changed
|
### Breaking Changed
|
||||||
|
|
||||||
|
|
|
@ -119,6 +119,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
|
||||||
## Changelog v13.2.0.3
|
## Changelog v13.2.0.3
|
||||||
### Added
|
### Added
|
||||||
- Command ``GpioRead`` to show input state [#19810](https://github.com/arendst/Tasmota/issues/19810)
|
- Command ``GpioRead`` to show input state [#19810](https://github.com/arendst/Tasmota/issues/19810)
|
||||||
|
- Command ``WebCanvas linear-gradient(#FF0018 7%,#FFA52C,#FFFF41,#008018,#0000F9,#86007D 93%)`` to set GUI canvas
|
||||||
- I2C bus2 support to iAQ core sensor [#19799](https://github.com/arendst/Tasmota/issues/19799)
|
- I2C bus2 support to iAQ core sensor [#19799](https://github.com/arendst/Tasmota/issues/19799)
|
||||||
- I2C bus2 support to HTU temperature and humidity sensor
|
- I2C bus2 support to HTU temperature and humidity sensor
|
||||||
- I2C bus2 support to BH1750 ambient light sensor
|
- I2C bus2 support to BH1750 ambient light sensor
|
||||||
|
@ -140,7 +141,6 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
|
||||||
- DeepSleep support through TIMERS [#20117](https://github.com/arendst/Tasmota/issues/20117)
|
- DeepSleep support through TIMERS [#20117](https://github.com/arendst/Tasmota/issues/20117)
|
||||||
- Support for ESP32-C2 and ESP32-C6 using Arduino core v3
|
- Support for ESP32-C2 and ESP32-C6 using Arduino core v3
|
||||||
- ESP32 core v3 auto TasConsole USB or Serial connection by @staars
|
- ESP32 core v3 auto TasConsole USB or Serial connection by @staars
|
||||||
- ESP32 show colorful background if ``WebColor2`` bit0 is not set. Bit0 is default set using #252525
|
|
||||||
- ESP32 Partition Wizard can be loaded dynamically [#19980](https://github.com/arendst/Tasmota/issues/19980)
|
- ESP32 Partition Wizard can be loaded dynamically [#19980](https://github.com/arendst/Tasmota/issues/19980)
|
||||||
- ESP32 support for Avago Tech Bluetooth Buttons [#20088](https://github.com/arendst/Tasmota/issues/20088)
|
- ESP32 support for Avago Tech Bluetooth Buttons [#20088](https://github.com/arendst/Tasmota/issues/20088)
|
||||||
- Berry ``debug.gcdebug()`` to enable GC debugging [#19936](https://github.com/arendst/Tasmota/issues/19936)
|
- Berry ``debug.gcdebug()`` to enable GC debugging [#19936](https://github.com/arendst/Tasmota/issues/19936)
|
||||||
|
|
|
@ -445,6 +445,7 @@
|
||||||
#define D_CMND_WEBQUERY "WebQuery"
|
#define D_CMND_WEBQUERY "WebQuery"
|
||||||
#define D_CMND_WEBCOLOR "WebColor"
|
#define D_CMND_WEBCOLOR "WebColor"
|
||||||
#define D_CMND_WEBBUTTON "WebButton"
|
#define D_CMND_WEBBUTTON "WebButton"
|
||||||
|
#define D_CMND_WEBCANVAS "WebCanvas"
|
||||||
#define D_CMND_WEBTIME "WebTime"
|
#define D_CMND_WEBTIME "WebTime"
|
||||||
#define D_CMND_WEBSENSOR "WebSensor"
|
#define D_CMND_WEBSENSOR "WebSensor"
|
||||||
#define D_CMND_WEBGETCONFIG "WebGetConfig"
|
#define D_CMND_WEBGETCONFIG "WebGetConfig"
|
||||||
|
|
|
@ -484,6 +484,7 @@ enum SettingsTextIndex { SET_OTAURL,
|
||||||
SET_SHD_PARAM,
|
SET_SHD_PARAM,
|
||||||
SET_RGX_SSID, SET_RGX_PASSWORD,
|
SET_RGX_SSID, SET_RGX_PASSWORD,
|
||||||
SET_INFLUXDB_HOST, SET_INFLUXDB_PORT, SET_INFLUXDB_ORG, SET_INFLUXDB_TOKEN, SET_INFLUXDB_BUCKET, SET_INFLUXDB_RP,
|
SET_INFLUXDB_HOST, SET_INFLUXDB_PORT, SET_INFLUXDB_ORG, SET_INFLUXDB_TOKEN, SET_INFLUXDB_BUCKET, SET_INFLUXDB_RP,
|
||||||
|
SET_CANVAS,
|
||||||
SET_MAX, // limit of texts stored in Settings
|
SET_MAX, // limit of texts stored in Settings
|
||||||
// Index above are not stored in Settings and should be handled specifically in SettingText()
|
// Index above are not stored in Settings and should be handled specifically in SettingText()
|
||||||
SET_BUTTON17, SET_BUTTON18, SET_BUTTON19, SET_BUTTON20, SET_BUTTON21, SET_BUTTON22, SET_BUTTON23, SET_BUTTON24,
|
SET_BUTTON17, SET_BUTTON18, SET_BUTTON19, SET_BUTTON20, SET_BUTTON21, SET_BUTTON22, SET_BUTTON23, SET_BUTTON24,
|
||||||
|
|
|
@ -1764,7 +1764,7 @@ void SettingsDelta(void) {
|
||||||
}
|
}
|
||||||
#if (LANGUAGE_LCID == 1049)
|
#if (LANGUAGE_LCID == 1049)
|
||||||
if (Settings->version < 0x0D020003) { // 13.2.0.3
|
if (Settings->version < 0x0D020003) { // 13.2.0.3
|
||||||
Settings->web_color[1][2] &= 0xFE; // Reset WebColor2 bit0 once. Fix by user setting WebColor2 bit0 (like #252525)
|
SettingsUpdateText(SET_CANVAS, PSTR("linear-gradient(#FF0018 7%,#FFA52C,#FFFF41,#008018,#0000F9,#86007D 93%)"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -900,13 +900,10 @@ void WSContentSendStyle_P(const char* formatP, ...) {
|
||||||
_WSContentSendBuffer(false, formatP, arg);
|
_WSContentSendBuffer(false, formatP, arg);
|
||||||
va_end(arg);
|
va_end(arg);
|
||||||
}
|
}
|
||||||
|
if (strlen(SettingsText(SET_CANVAS))) {
|
||||||
#if defined(ESP32) || (LANGUAGE_LCID == 1049)
|
// WSContentSend_P(PSTR("body{background:%s;background-repeat:no-repeat;background-attachment:fixed;background-size:cover;}"), SettingsText(SET_CANVAS));
|
||||||
if (0 == (WebColor(COL_BACKGROUND) & 1)) { // Show colorful background if WebColor2 bit0 is not set
|
WSContentSend_P(PSTR("body{background:%s 0 0 / cover no-repeat fixed;}"), SettingsText(SET_CANVAS));
|
||||||
WSContentSend_P(PSTR("body{background:linear-gradient(#FF0018 7%%,#FFA52C,#FFFF41,#008018,#0000F9,#86007D 93%%);background-repeat:no-repeat;background-attachment:fixed;background-size:cover;}"));
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
WSContentSend_P(HTTP_HEAD_STYLE3, WebColor(COL_BACKGROUND), WebColor(COL_TEXT),
|
WSContentSend_P(HTTP_HEAD_STYLE3, WebColor(COL_BACKGROUND), WebColor(COL_TEXT),
|
||||||
#ifdef FIRMWARE_MINIMAL
|
#ifdef FIRMWARE_MINIMAL
|
||||||
WebColor(COL_TEXT_WARNING),
|
WebColor(COL_TEXT_WARNING),
|
||||||
|
@ -3514,6 +3511,10 @@ bool JsonWebColor(const char* dataBuf)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*********************************************************************************************\
|
||||||
|
* Commands
|
||||||
|
\*********************************************************************************************/
|
||||||
|
|
||||||
const char kWebCmndStatus[] PROGMEM = D_JSON_DONE "|" D_JSON_WRONG_PARAMETERS "|" D_JSON_CONNECT_FAILED "|" D_JSON_HOST_NOT_FOUND "|" D_JSON_MEMORY_ERROR "|"
|
const char kWebCmndStatus[] PROGMEM = D_JSON_DONE "|" D_JSON_WRONG_PARAMETERS "|" D_JSON_CONNECT_FAILED "|" D_JSON_HOST_NOT_FOUND "|" D_JSON_MEMORY_ERROR "|"
|
||||||
#ifdef USE_WEBGETCONFIG
|
#ifdef USE_WEBGETCONFIG
|
||||||
"|" D_JSON_FILE_NOT_FOUND "|" D_JSON_OTHER_HTTP_ERROR "|" D_JSON_CONNECTION_LOST "|" D_JSON_INVALID_FILE_TYPE
|
"|" D_JSON_FILE_NOT_FOUND "|" D_JSON_OTHER_HTTP_ERROR "|" D_JSON_CONNECTION_LOST "|" D_JSON_INVALID_FILE_TYPE
|
||||||
|
@ -3531,7 +3532,7 @@ const char kWebCommands[] PROGMEM = "|" // No prefix
|
||||||
D_CMND_SENDMAIL "|"
|
D_CMND_SENDMAIL "|"
|
||||||
#endif
|
#endif
|
||||||
D_CMND_WEBSERVER "|" D_CMND_WEBPASSWORD "|" D_CMND_WEBREFRESH "|" D_CMND_WEBSEND "|" D_CMND_WEBQUERY "|"
|
D_CMND_WEBSERVER "|" D_CMND_WEBPASSWORD "|" D_CMND_WEBREFRESH "|" D_CMND_WEBSEND "|" D_CMND_WEBQUERY "|"
|
||||||
D_CMND_WEBCOLOR "|" D_CMND_WEBSENSOR "|" D_CMND_WEBBUTTON
|
D_CMND_WEBCOLOR "|" D_CMND_WEBSENSOR "|" D_CMND_WEBBUTTON "|" D_CMND_WEBCANVAS
|
||||||
#ifdef USE_WEBGETCONFIG
|
#ifdef USE_WEBGETCONFIG
|
||||||
"|" D_CMND_WEBGETCONFIG
|
"|" D_CMND_WEBGETCONFIG
|
||||||
#endif
|
#endif
|
||||||
|
@ -3552,7 +3553,7 @@ void (* const WebCommand[])(void) PROGMEM = {
|
||||||
&CmndSendmail,
|
&CmndSendmail,
|
||||||
#endif
|
#endif
|
||||||
&CmndWebServer, &CmndWebPassword, &CmndWebRefresh, &CmndWebSend, &CmndWebQuery,
|
&CmndWebServer, &CmndWebPassword, &CmndWebRefresh, &CmndWebSend, &CmndWebQuery,
|
||||||
&CmndWebColor, &CmndWebSensor, &CmndWebButton
|
&CmndWebColor, &CmndWebSensor, &CmndWebButton, &CmndWebCanvas
|
||||||
#ifdef USE_WEBGETCONFIG
|
#ifdef USE_WEBGETCONFIG
|
||||||
, &CmndWebGetConfig
|
, &CmndWebGetConfig
|
||||||
#endif
|
#endif
|
||||||
|
@ -3562,9 +3563,7 @@ void (* const WebCommand[])(void) PROGMEM = {
|
||||||
#endif // FIRMWARE_MINIMAL_ONLY
|
#endif // FIRMWARE_MINIMAL_ONLY
|
||||||
};
|
};
|
||||||
|
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************/
|
||||||
* Commands
|
|
||||||
\*********************************************************************************************/
|
|
||||||
|
|
||||||
void CmndWebTime(void) {
|
void CmndWebTime(void) {
|
||||||
// 2017-03-07T11:08:02-07:00
|
// 2017-03-07T11:08:02-07:00
|
||||||
|
@ -3771,6 +3770,23 @@ void CmndWebButton(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CmndWebCanvas(void) {
|
||||||
|
/*
|
||||||
|
WebCanvas allows GUI body canvas configuration using either "url" or "gradient".
|
||||||
|
The provided text overrules the body CSS background property "body{background:<WebCanvas> 0 0 / cover no-repeat fixed;}"
|
||||||
|
- WebCanvas " // Reset canvas
|
||||||
|
- WebCanvas 0 // Reset canvas
|
||||||
|
- WebCanvas linear-gradient(#FF0018 7%,#FFA52C,#FFFF41,#008018,#0000F9,#86007D 93%) // Gradient pride flag
|
||||||
|
- WebCanvas linear-gradient(#FF0018 16%,#FFA52C 16% 33%,#FFFF41 33% 50%,#008018 50% 67%,#0000F9 67% 84%,#86007D 84%) // Pride flag
|
||||||
|
- WebCanvas url(http://ota.tasmota.com/tasmota/images/prf.png) // Pride flag
|
||||||
|
- WebCanvas url(http://ota.tasmota.com/tasmota/images/tasmota_logo.png) // Tasmota logo
|
||||||
|
*/
|
||||||
|
if (XdrvMailbox.data_len > 0) {
|
||||||
|
SettingsUpdateText(SET_CANVAS, (SC_CLEAR == Shortcut()) ? "" : XdrvMailbox.data);
|
||||||
|
}
|
||||||
|
ResponseCmndChar(SettingsText(SET_CANVAS));
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef USE_CORS
|
#ifdef USE_CORS
|
||||||
void CmndCors(void)
|
void CmndCors(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue