6.4.1.17 Change template stability

6.4.1.17 20190214
 * Change template update by removing possibility to add user module config keeping template as defined (#5222)
This commit is contained in:
Theo Arends 2019-02-14 16:48:28 +01:00
parent 166a625eb8
commit 77db7ba0ff
4 changed files with 25 additions and 3 deletions

View File

@ -1,4 +1,7 @@
/* 6.4.1.16 20190211
/* 6.4.1.17 20190214
* Change template update by removing possibility to add user module config keeping template as defined (#5222)
*
* 6.4.1.16 20190211
* Initial support for online template change using command Template or GUI Configure Other (#5177)
* Add parameter CFG_HOLDER to status 1 message (#5206)
* Update GUI

View File

@ -954,7 +954,10 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
else if (CMND_TEMPLATE == command_code) {
// {"NAME":"Generic","GPIO":[17,254,29,254,7,254,254,254,138,254,139,254,254],"FLAG":1,"BASE":255}
bool error = false;
if (!strstr(dataBuf, "{")) { // If no JSON it must be parameter
/*
// Version 6.4.1.16 - Add user module config data to template
bool update = false;
if ((payload > 0) && (payload <= MAXMODULE)) {
ModuleDefault(payload -1); // Copy template module
@ -983,6 +986,17 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
src++;
}
}
*/
// Version 6.4.1.17 use template as defined
if ((payload > 0) && (payload <= MAXMODULE)) {
ModuleDefault(payload -1); // Copy template module
if (USER_MODULE == Settings.module) { restart_flag = 2; }
}
else if (0 == payload) { // Copy current module with user configured GPIO
if (Settings.module != USER_MODULE) {
ModuleDefault(Settings.module);
}
}
}
else if (data_len > 9) { // Workaround exception if empty JSON like {} - Needs checks
StaticJsonBuffer<350> jb; // 331 from https://arduinojson.org/v5/assistant/

View File

@ -20,7 +20,7 @@
#ifndef _SONOFF_VERSION_H_
#define _SONOFF_VERSION_H_
#define VERSION 0x06040110
#define VERSION 0x06040111
#define D_PROGRAMNAME "Sonoff-Tasmota"
#define D_AUTHOR "Theo Arends"

View File

@ -783,12 +783,17 @@ uint8_t ValidPin(uint8_t pin, uint8_t gpio)
bool ValidGPIO(uint8_t pin, uint8_t gpio)
{
bool result = false;
/*
// Version 6.4.1.16 - Use user module config in template
if (USER_MODULE == Settings.module) {
result = (ValidPin(pin, gpio) > GPIO_NONE); // Allow any pin
} else {
result = (GPIO_USER == ValidPin(pin, gpio)); // Only allow GPIO_USER pins
}
*/
// Version 6.4.1.17 - Use template as defined
result = (GPIO_USER == ValidPin(pin, gpio)); // Only allow GPIO_USER pins
return result;
}