mirror of https://github.com/arendst/Tasmota.git
isTuya optionnal arg to validpin (#17835)
This commit is contained in:
parent
d9cbbaeb2a
commit
3d39efaf4a
|
@ -1646,7 +1646,7 @@ bool RedPin(uint32_t pin) // pin may be dangerous to change, display in RED in t
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ValidPin(uint32_t pin, uint32_t gpio) {
|
uint32_t ValidPin(uint32_t pin, uint32_t gpio, uint8_t isTuya = false) {
|
||||||
if (FlashPin(pin)) {
|
if (FlashPin(pin)) {
|
||||||
return GPIO_NONE; // Disable flash pins GPIO6, GPIO7, GPIO8 and GPIO11
|
return GPIO_NONE; // Disable flash pins GPIO6, GPIO7, GPIO8 and GPIO11
|
||||||
}
|
}
|
||||||
|
@ -1658,7 +1658,7 @@ uint32_t ValidPin(uint32_t pin, uint32_t gpio) {
|
||||||
#elif defined(CONFIG_IDF_TARGET_ESP32)
|
#elif defined(CONFIG_IDF_TARGET_ESP32)
|
||||||
// ignore
|
// ignore
|
||||||
#else // not ESP32C3 and not ESP32S2
|
#else // not ESP32C3 and not ESP32S2
|
||||||
if (((WEMOS == Settings->module) || (TUYA_DIMMER == Settings->module) || (USER_MODULE == Settings->module)) && !Settings->flag3.user_esp8285_enable) { // SetOption51 - Enable ESP8285 user GPIO's
|
if (((WEMOS == Settings->module) || isTuya) && !Settings->flag3.user_esp8285_enable) { // SetOption51 - Enable ESP8285 user GPIO's
|
||||||
if ((9 == pin) || (10 == pin)) {
|
if ((9 == pin) || (10 == pin)) {
|
||||||
return GPIO_NONE; // Disable possible flash GPIO9 and GPIO10
|
return GPIO_NONE; // Disable possible flash GPIO9 and GPIO10
|
||||||
}
|
}
|
||||||
|
|
|
@ -1111,7 +1111,7 @@ void TuyaNormalPowerModePacketProcess(void)
|
||||||
// If LED_1 not yet configured
|
// If LED_1 not yet configured
|
||||||
if (!led1_set) {
|
if (!led1_set) {
|
||||||
// Check is the GPIO is not already in use and if it is valid
|
// Check is the GPIO is not already in use and if it is valid
|
||||||
if (!Settings->my_gp.io[led1_gpio] && ValidPin(led1_gpio,GPIO_LED1)) {
|
if (!Settings->my_gp.io[led1_gpio] && ValidPin(led1_gpio,GPIO_LED1, true)) {
|
||||||
Settings->my_gp.io[led1_gpio] = AGPIO(GPIO_LED1);
|
Settings->my_gp.io[led1_gpio] = AGPIO(GPIO_LED1);
|
||||||
TasmotaGlobal.restart_flag = 2;
|
TasmotaGlobal.restart_flag = 2;
|
||||||
AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: Set LED1 on gpio%d, will restart"), led1_gpio);
|
AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: Set LED1 on gpio%d, will restart"), led1_gpio);
|
||||||
|
@ -1122,7 +1122,7 @@ void TuyaNormalPowerModePacketProcess(void)
|
||||||
// If KEY_1 not yet configured
|
// If KEY_1 not yet configured
|
||||||
if (!key1_set) {
|
if (!key1_set) {
|
||||||
// Check is the GPIO is not already in use and if it is valid
|
// Check is the GPIO is not already in use and if it is valid
|
||||||
if (!Settings->my_gp.io[key1_gpio] && ValidPin(key1_gpio,GPIO_KEY1)) {
|
if (!Settings->my_gp.io[key1_gpio] && ValidPin(key1_gpio,GPIO_KEY1, true)) {
|
||||||
Settings->my_gp.io[key1_gpio] = AGPIO(GPIO_KEY1);
|
Settings->my_gp.io[key1_gpio] = AGPIO(GPIO_KEY1);
|
||||||
TasmotaGlobal.restart_flag = 2;
|
TasmotaGlobal.restart_flag = 2;
|
||||||
AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: Set KEY1 on gpio%d, will restart"), key1_gpio);
|
AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: Set KEY1 on gpio%d, will restart"), key1_gpio);
|
||||||
|
|
Loading…
Reference in New Issue