isTuya optionnal arg to validpin (#17835)

This commit is contained in:
Barbudor 2023-01-30 22:35:38 +01:00 committed by GitHub
parent d9cbbaeb2a
commit 3d39efaf4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -1646,7 +1646,7 @@ bool RedPin(uint32_t pin) // pin may be dangerous to change, display in RED in t
#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)) {
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)
// ignore
#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)) {
return GPIO_NONE; // Disable possible flash GPIO9 and GPIO10
}

View File

@ -1111,7 +1111,7 @@ void TuyaNormalPowerModePacketProcess(void)
// If LED_1 not yet configured
if (!led1_set) {
// 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);
TasmotaGlobal.restart_flag = 2;
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 (!key1_set) {
// 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);
TasmotaGlobal.restart_flag = 2;
AddLog(LOG_LEVEL_DEBUG, PSTR("TYA: Set KEY1 on gpio%d, will restart"), key1_gpio);