From 74d17d32c62ce4792fa21aa51daa5c13ae691916 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sun, 20 Feb 2022 11:41:51 +0100 Subject: [PATCH] Fix SPM simulate possible duplicates --- tasmota/xdrv_86_esp32_sonoff_spm.ino | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tasmota/xdrv_86_esp32_sonoff_spm.ino b/tasmota/xdrv_86_esp32_sonoff_spm.ino index 555be32c6..7316bed10 100644 --- a/tasmota/xdrv_86_esp32_sonoff_spm.ino +++ b/tasmota/xdrv_86_esp32_sonoff_spm.ino @@ -1371,7 +1371,6 @@ void SSPMHandleReceivedData(void) { #endif power_t relay = (SspmBuffer[31] & 0x0F) << (module * 4); // Relays active power_t relay_state = (SspmBuffer[31] >> 4) << (module * 4); // Relays state - for (uint32_t i = 1; i <= TasmotaGlobal.devices_present; i++) { if (relay &1) { ExecuteCommandPower(i, relay_state &1, SRC_BUTTON); @@ -1453,11 +1452,14 @@ void SSPMHandleReceivedData(void) { SSPMAddModule(); #ifdef SSPM_SIMULATE if (0 == Sspm->simulate) { + uint8_t current_idh = SspmBuffer[19]; uint8_t current_idl = SspmBuffer[20]; for (Sspm->simulate = 0; Sspm->simulate < SSPM_SIMULATE; Sspm->simulate++) { + SspmBuffer[19] = Sspm->simulate +1; SspmBuffer[20] = Sspm->simulate +1; SSPMAddModule(); } + SspmBuffer[19] = current_idh; SspmBuffer[20] = current_idl; } #endif