6.2.0.1 - Fix StateText ambiguity

Fix possible ambiguity on command parameters if StateText contains numbers only (#3656)
This commit is contained in:
Theo Arends 2018-09-02 11:11:49 +02:00
parent d57dad2499
commit 48b5f9117a
3 changed files with 8 additions and 5 deletions

View File

@ -1,4 +1,7 @@
/* 6.2.0 20180901
/* 6.2.0.1 20180902
* Fix possible ambiguity on command parameters if StateText contains numbers only (#3656)
*
* 6.2.0 20180901
* Allow user override of define MAX_RULE_VARS and MAX_RULE_TIMERS (#3561)
* Disable wifi sleep for both Esp8266/Arduino core 2.4.1 and 2.4.2 to solve device freeze caused by Espressif SDK bug (#3554)
* Change DS18B20 driver to provide better instant results

View File

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

View File

@ -561,13 +561,13 @@ int GetStateNumber(char *state_text)
char command[CMDSZ];
int state_number = -1;
if ((GetCommandCode(command, sizeof(command), state_text, kOptionOff) >= 0) || !strcasecmp(state_text, Settings.state_text[0])) {
if (GetCommandCode(command, sizeof(command), state_text, kOptionOff) >= 0) {
state_number = 0;
}
else if ((GetCommandCode(command, sizeof(command), state_text, kOptionOn) >= 0) || !strcasecmp(state_text, Settings.state_text[1])) {
else if (GetCommandCode(command, sizeof(command), state_text, kOptionOn) >= 0) {
state_number = 1;
}
else if ((GetCommandCode(command, sizeof(command), state_text, kOptionToggle) >= 0) || !strcasecmp(state_text, Settings.state_text[2])) {
else if (GetCommandCode(command, sizeof(command), state_text, kOptionToggle) >= 0) {
state_number = 2;
}
else if (GetCommandCode(command, sizeof(command), state_text, kOptionBlink) >= 0) {