From d8ed99830cf88413d91f0d5b2f04401c76a769e2 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 4 Jan 2022 22:30:08 +0100 Subject: [PATCH] Fix SPM energy display rotation in GUI Fix SPM energy display rotation in GUI (#14281) --- tasmota/xdrv_86_esp32_sonoff_spm.ino | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tasmota/xdrv_86_esp32_sonoff_spm.ino b/tasmota/xdrv_86_esp32_sonoff_spm.ino index a2143a1b8..576dc1006 100644 --- a/tasmota/xdrv_86_esp32_sonoff_spm.ino +++ b/tasmota/xdrv_86_esp32_sonoff_spm.ino @@ -1203,14 +1203,15 @@ void SSPMEnergyShow(bool json) { } if (index) { - uint32_t offset = 0; if (index > 4) { Sspm->rotate++; - if (Sspm->rotate >= (index | 0x3)) { - Sspm->rotate = 0; - } - offset = (Sspm->rotate >> 2) * 4; + } else { + Sspm->rotate = 0; } + if (Sspm->rotate > ((index -1) | 0x3)) { // Always test in case index has changed due to use of SspmDisplay command + Sspm->rotate = 0; + } + uint32_t offset = (Sspm->rotate >> 2) * 4; uint32_t count = index - offset; if (count > 4) { count = 4; } WSContentSend_P(PSTR("{t}{s}")); // First column is empty ({t} = , {s} =
)