Make SspmDisplay persistent

This commit is contained in:
Theo Arends 2021-12-04 16:14:08 +01:00
parent d3a1883782
commit 1d3a3ee415
2 changed files with 5 additions and 6 deletions

View File

@ -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

View File

@ -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);
}
/*********************************************************************************************\