From 1d3a3ee4151c4044e1888fcb2281e2b246d8537e Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 4 Dec 2021 16:14:08 +0100 Subject: [PATCH] Make SspmDisplay persistent --- tasmota/settings.h | 2 +- tasmota/xdrv_86_esp32_sonoff_spm.ino | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tasmota/settings.h b/tasmota/settings.h index b488df2e6..eb8ca22bc 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -250,7 +250,7 @@ typedef union { uint32_t sonoff_l1_music_sync : 1; // bit 5 (v9.5.0.5) - CMND_L1MUSICSYNC - Enable sync to music uint32_t influxdb_default : 1; // bit 6 (v9.5.0.5) - Set influxdb initial defaults if 0 uint32_t influxdb_state : 1; // bit 7 (v9.5.0.5) - CMND_IFX - Enable influxdb support - uint32_t spare08 : 1; // bit 8 + uint32_t sspm_display : 1; // bit 8 (v10.0.0.4) - CMND_SSPMDISPLAY - Enable gui display of powered on relays only uint32_t spare09 : 1; // bit 9 uint32_t spare10 : 1; // bit 10 uint32_t spare11 : 1; // bit 11 diff --git a/tasmota/xdrv_86_esp32_sonoff_spm.ino b/tasmota/xdrv_86_esp32_sonoff_spm.ino index afe70b115..eaeb2d758 100644 --- a/tasmota/xdrv_86_esp32_sonoff_spm.ino +++ b/tasmota/xdrv_86_esp32_sonoff_spm.ino @@ -175,7 +175,6 @@ typedef struct { uint8_t command_sequence; uint8_t mstate; uint8_t last_button; - uint8_t gui_display; bool discovery_triggered; } TSspm; @@ -1160,8 +1159,8 @@ void SSPMEnergyShow(bool json) { uint32_t index = 0; power_t power = TasmotaGlobal.power; for (uint32_t i = 0; i < TasmotaGlobal.devices_present; i++) { - if ((0 == Sspm->gui_display) || - ((1 == Sspm->gui_display) && (power >> i) &1)) { + if ((0 == Settings->sbflag1.sspm_display) || + ((1 == Settings->sbflag1.sspm_display) && (power >> i) &1)) { relay[index] = i +1; indirect[index] = i; index++; @@ -1247,9 +1246,9 @@ void CmndSSPMIamHere(void) { void CmndSSPMDisplay(void) { // Select either all relays or only powered on relays if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 1)) { - Sspm->gui_display = XdrvMailbox.payload; + Settings->sbflag1.sspm_display = XdrvMailbox.payload; } - ResponseCmndNumber(Sspm->gui_display); + ResponseCmndNumber(Settings->sbflag1.sspm_display); } /*********************************************************************************************\