diff --git a/tasmota/include/tasmota.h b/tasmota/include/tasmota.h index 5383ba276..3dee90dad 100644 --- a/tasmota/include/tasmota.h +++ b/tasmota/include/tasmota.h @@ -382,7 +382,7 @@ enum XsnsFunctions {FUNC_SETTINGS_OVERRIDE, FUNC_PIN_STATE, FUNC_I2C_INIT, FUNC_ FUNC_SAVE_SETTINGS, FUNC_SAVE_AT_MIDNIGHT, FUNC_SAVE_BEFORE_RESTART, FUNC_AFTER_TELEPERIOD, FUNC_JSON_APPEND, FUNC_WEB_SENSOR, FUNC_WEB_COL_SENSOR, FUNC_COMMAND, FUNC_COMMAND_SENSOR, FUNC_COMMAND_DRIVER, FUNC_MQTT_SUBSCRIBE, FUNC_MQTT_INIT, FUNC_MQTT_DATA, - FUNC_SET_POWER, FUNC_SET_DEVICE_POWER, FUNC_SHOW_SENSOR, FUNC_ANY_KEY, + FUNC_SET_POWER, FUNC_SET_DEVICE_POWER, FUNC_SHOW_SENSOR, FUNC_ANY_KEY, FUNC_LED_LINK, FUNC_ENERGY_EVERY_SECOND, FUNC_ENERGY_RESET, FUNC_RULES_PROCESS, FUNC_TELEPERIOD_RULES_PROCESS, FUNC_SERIAL, FUNC_FREE_MEM, FUNC_BUTTON_PRESSED, FUNC_BUTTON_MULTI_PRESSED, FUNC_WEB_ADD_BUTTON, FUNC_WEB_ADD_CONSOLE_BUTTON, FUNC_WEB_ADD_MANAGEMENT_BUTTON, FUNC_WEB_ADD_MAIN_BUTTON, diff --git a/tasmota/tasmota_support/support_button_v3.ino b/tasmota/tasmota_support/support_button_v3.ino index bdfad5330..b12ef5714 100644 --- a/tasmota/tasmota_support/support_button_v3.ino +++ b/tasmota/tasmota_support/support_button_v3.ino @@ -473,6 +473,11 @@ void ButtonHandler(void) { valid_relay = (Button.press_counter[button_index] <= TasmotaGlobal.devices_present); } #endif // ESP8266 +#ifdef USE_SHELLY_PRO + if (TasmotaGlobal.gpio_optiona.shelly_pro) { + valid_relay = (Button.press_counter[button_index] <= TasmotaGlobal.devices_present); + } +#endif // USE_SHELLY_PRO if ((Button.press_counter[button_index] > 1) && valid_relay && (Button.press_counter[button_index] <= MAX_RELAY_BUTTON1)) { ExecuteCommandPower(button_index + Button.press_counter[button_index], POWER_TOGGLE, SRC_BUTTON); // Execute Toggle command internally // AddLog(LOG_LEVEL_DEBUG, PSTR("BTN: Relay%d found on GPIO%d"), Button.press_counter[button_index], Pin(GPIO_REL1, Button.press_counter[button_index]-1)); diff --git a/tasmota/tasmota_support/support_tasmota.ino b/tasmota/tasmota_support/support_tasmota.ino index 0b390be00..b51856b4b 100644 --- a/tasmota/tasmota_support/support_tasmota.ino +++ b/tasmota/tasmota_support/support_tasmota.ino @@ -518,9 +518,12 @@ void SetLedPowerAll(uint32_t state) } void SetLedLink(uint32_t state) { -#ifdef USE_SHELLY_PRO - if (ShellyProLedLink(state)) { return; } -#endif // USE_SHELLY_PRO +#ifdef ESP32 + uint32_t index = XdrvMailbox.index; + XdrvMailbox.index = state; + XdrvCall(FUNC_LED_LINK); + XdrvMailbox.index = index; +#endif // ESP32 int led_pin = Pin(GPIO_LEDLNK); uint32_t led_inv = TasmotaGlobal.ledlnk_inverted; if (-1 == led_pin) { // Legacy - LED1 is status diff --git a/tasmota/tasmota_xdrv_driver/xdrv_88_esp32_shelly_pro.ino b/tasmota/tasmota_xdrv_driver/xdrv_88_esp32_shelly_pro.ino index 9392dab40..d7ffd8caa 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_88_esp32_shelly_pro.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_88_esp32_shelly_pro.ino @@ -27,6 +27,9 @@ * {"NAME":"Shelly Pro 2","GPIO":[0,0,0,0,768,0,0,0,672,704,736,0,0,0,5600,6214,0,0,0,5568,0,0,0,0,0,0,0,0,0,0,0,32,0,0,160,161],"FLAG":0,"BASE":1} * * Shelly Pro uses SPI to control one 74HC595 for relays/leds and one ADE7953 (1PM) or two ADE7953 (2PM) for energy monitoring + * + * Testset + * {"NAME":"Shelly Pro 2PM (POC)","GPIO":[1,0,1,0,768,1,0,0,672,704,736,1,0,0,5600,6214,0,0,0,5568,0,0,0,0,0,0,0,0,1,1,1,32,1,1,160,161],"FLAG":0,"BASE":1} \*********************************************************************************************/ #define XDRV_88 88 @@ -87,18 +90,10 @@ void ShellyProPower(void) { ShellyProUpdate(); } -/*********************************************************************************************\ - * External called functions -\*********************************************************************************************/ - -bool ShellyProLedLink(uint32_t state) { - if (SPro.detected) { - // bit 2 = blue, 3 = green, 4 = red - SPro.ledlink = (state) ? 0x18 : 0x1C; // Blue on (wifi link) or all off - ShellyProUpdate(); - return true; - } - return false; +void ShellyProLedLink(void) { + // bit 2 = blue, 3 = green, 4 = red + SPro.ledlink = (XdrvMailbox.index) ? 0x18 : 0x1C; // Blue on (wifi link) or all off + ShellyProUpdate(); } /*********************************************************************************************\ @@ -115,6 +110,9 @@ bool Xdrv88(uint8_t function) { case FUNC_SET_POWER: ShellyProPower(); break; + case FUNC_LED_LINK: + ShellyProLedLink(); + break; } } return result;