mirror of https://github.com/arendst/Tasmota.git
parent
5e1cbcf94f
commit
c673ea1728
|
@ -978,9 +978,12 @@ 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)) {
|
||||||
ModuleDefault(payload -1); // Copy template module
|
payload--;
|
||||||
|
if (ValidModule(payload)) {
|
||||||
|
ModuleDefault(payload); // Copy template module
|
||||||
if (USER_MODULE == Settings.module) { restart_flag = 2; }
|
if (USER_MODULE == Settings.module) { restart_flag = 2; }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (0 == payload) { // Copy current template to user template
|
else if (0 == payload) { // Copy current template to user template
|
||||||
if (Settings.module != USER_MODULE) {
|
if (Settings.module != USER_MODULE) {
|
||||||
ModuleDefault(Settings.module);
|
ModuleDefault(Settings.module);
|
||||||
|
|
|
@ -1023,8 +1023,8 @@ 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) || (base >= MAXMODULE)) { base = 17; } else { base--; }
|
if ((0 == base) || !ValidModule(base -1)) { base = 18; }
|
||||||
Settings.user_template_base = base; // Default WEMOS
|
Settings.user_template_base = base -1; // Default WEMOS
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue