mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-28 13:16:32 +00:00
Fix template activation and/or module selection regression from 6.5.0.4 (#5598)
Fix template activation and/or module selection regression from 6.5.0.4 (#5598)
This commit is contained in:
parent
3fc9db9079
commit
ce53ee07e7
@ -1,5 +1,6 @@
|
|||||||
/* 6.5.0.5 20190406
|
/* 6.5.0.5 20190406
|
||||||
* Add compile time GUI hexadecimal only color options in my_user_config.h (#5586)
|
* 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)
|
||||||
*
|
*
|
||||||
* 6.5.0.4 20190402
|
* 6.5.0.4 20190402
|
||||||
* Fix Configure Timer Web GUI (#5568)
|
* Fix Configure Timer Web GUI (#5568)
|
||||||
|
@ -876,11 +876,11 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
|
|||||||
if ((payload >= 0) && (payload <= MAXMODULE)) {
|
if ((payload >= 0) && (payload <= MAXMODULE)) {
|
||||||
bool present = false;
|
bool present = false;
|
||||||
if (0 == payload) {
|
if (0 == payload) {
|
||||||
payload = 255;
|
payload = USER_MODULE;
|
||||||
present = true;
|
present = true;
|
||||||
} else {
|
} else {
|
||||||
payload--;
|
payload--;
|
||||||
present = ValidModule(payload);
|
present = ValidTemplateModule(payload);
|
||||||
}
|
}
|
||||||
if (present) {
|
if (present) {
|
||||||
Settings.last_module = Settings.module;
|
Settings.last_module = Settings.module;
|
||||||
@ -979,7 +979,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
|
|||||||
if (strstr(dataBuf, "{") == nullptr) { // If no JSON it must be parameter
|
if (strstr(dataBuf, "{") == nullptr) { // If no JSON it must be parameter
|
||||||
if ((payload > 0) && (payload <= MAXMODULE)) {
|
if ((payload > 0) && (payload <= MAXMODULE)) {
|
||||||
payload--;
|
payload--;
|
||||||
if (ValidModule(payload)) {
|
if (ValidTemplateModule(payload)) {
|
||||||
ModuleDefault(payload); // Copy template module
|
ModuleDefault(payload); // Copy template module
|
||||||
if (USER_MODULE == Settings.module) { restart_flag = 2; }
|
if (USER_MODULE == Settings.module) { restart_flag = 2; }
|
||||||
}
|
}
|
||||||
|
@ -846,7 +846,7 @@ uint8_t ModuleNr()
|
|||||||
return (USER_MODULE == Settings.module) ? 0 : Settings.module +1;
|
return (USER_MODULE == Settings.module) ? 0 : Settings.module +1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ValidModule(uint8_t index)
|
bool ValidTemplateModule(uint8_t index)
|
||||||
{
|
{
|
||||||
for (uint8_t i = 0; i < sizeof(kModuleNiceList); i++) {
|
for (uint8_t i = 0; i < sizeof(kModuleNiceList); i++) {
|
||||||
if (index == pgm_read_byte(kModuleNiceList + i)) {
|
if (index == pgm_read_byte(kModuleNiceList + i)) {
|
||||||
@ -856,6 +856,12 @@ bool ValidModule(uint8_t index)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ValidModule(uint8_t index)
|
||||||
|
{
|
||||||
|
if (index == USER_MODULE) { return true; }
|
||||||
|
return ValidTemplateModule(index);
|
||||||
|
}
|
||||||
|
|
||||||
String AnyModuleName(uint8_t index)
|
String AnyModuleName(uint8_t index)
|
||||||
{
|
{
|
||||||
if (USER_MODULE == index) {
|
if (USER_MODULE == index) {
|
||||||
@ -1023,7 +1029,7 @@ bool JsonTemplate(const char* dataBuf)
|
|||||||
}
|
}
|
||||||
if (obj[D_JSON_BASE].success()) {
|
if (obj[D_JSON_BASE].success()) {
|
||||||
uint8_t base = obj[D_JSON_BASE];
|
uint8_t base = obj[D_JSON_BASE];
|
||||||
if ((0 == base) || !ValidModule(base -1)) { base = 18; }
|
if ((0 == base) || !ValidTemplateModule(base -1)) { base = 18; }
|
||||||
Settings.user_template_base = base -1; // Default WEMOS
|
Settings.user_template_base = base -1; // Default WEMOS
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user