diff --git a/tasmota/tasmota_configurations.h b/tasmota/tasmota_configurations.h index f169a4cf1..b833b66ee 100644 --- a/tasmota/tasmota_configurations.h +++ b/tasmota/tasmota_configurations.h @@ -175,7 +175,7 @@ //#define USE_DYP // Add support for DYP ME-007 ultrasonic distance sensor, serial port version (+0k5 code) #define USE_SERIAL_BRIDGE // Add support for software Serial Bridge (+0k8 code) #define USE_MP3_PLAYER // Use of the DFPlayer Mini MP3 Player RB-DFR-562 commands: play, volume and stop - #define MP3_VOLUME 10 // Set the startup volume on init, the range can be 0..30(max) + #define MP3_VOLUME 30 // Set the startup volume on init, the range can be 0..100(max) //#define USE_AZ7798 // Add support for AZ-Instrument 7798 CO2 datalogger #define USE_PN532_HSU // Add support for PN532 using HSU (Serial) interface (+1k8 code, 140 bytes mem) //#define USE_ZIGBEE // Enable serial communication with Zigbee CC2530 flashed with ZNP diff --git a/tasmota/tasmota_configurations_ESP32.h b/tasmota/tasmota_configurations_ESP32.h index e99cc9fee..c61e03336 100644 --- a/tasmota/tasmota_configurations_ESP32.h +++ b/tasmota/tasmota_configurations_ESP32.h @@ -428,7 +428,7 @@ //#define USE_DYP // Add support for DYP ME-007 ultrasonic distance sensor, serial port version (+0k5 code) #define USE_SERIAL_BRIDGE // Add support for software Serial Bridge (+0k8 code) //#define USE_MP3_PLAYER // Use of the DFPlayer Mini MP3 Player RB-DFR-562 commands: play, volume and stop - #define MP3_VOLUME 10 // Set the startup volume on init, the range can be 0..30(max) + #define MP3_VOLUME 30 // Set the startup volume on init, the range can be 0..100(max) //#define USE_AZ7798 // Add support for AZ-Instrument 7798 CO2 datalogger //#define USE_PN532_HSU // Add support for PN532 using HSU (Serial) interface (+1k8 code, 140 bytes mem) //#define USE_ZIGBEE // Enable serial communication with Zigbee CC2530 flashed with ZNP @@ -570,7 +570,7 @@ //#define USE_DYP // Add support for DYP ME-007 ultrasonic distance sensor, serial port version (+0k5 code) #define USE_SERIAL_BRIDGE // Add support for software Serial Bridge (+0k8 code) #define USE_MP3_PLAYER // Use of the DFPlayer Mini MP3 Player RB-DFR-562 commands: play, volume and stop - #define MP3_VOLUME 10 // Set the startup volume on init, the range can be 0..30(max) + #define MP3_VOLUME 30 // Set the startup volume on init, the range can be 0..100(max) //#define USE_AZ7798 // Add support for AZ-Instrument 7798 CO2 datalogger #define USE_PN532_HSU // Add support for PN532 using HSU (Serial) interface (+1k8 code, 140 bytes mem) //#define USE_ZIGBEE // Enable serial communication with Zigbee CC2530 flashed with ZNP diff --git a/tasmota/xdrv_86_esp32_sonoff_spm.ino b/tasmota/xdrv_86_esp32_sonoff_spm.ino index 494e72422..ca25ba979 100644 --- a/tasmota/xdrv_86_esp32_sonoff_spm.ino +++ b/tasmota/xdrv_86_esp32_sonoff_spm.ino @@ -201,6 +201,8 @@ enum SspmMachineStates { SPM_NONE, // Do nothing SPM_UPDATE_CHANNELS // Update Energy for powered on channels }; +enum SspmDisplayModes { SPM_DISPLAY_ROTATE, SPM_DISPLAY_ROTATE_POWERED_ON, SPM_DISPLAY_TABS, SPM_DISPLAY_MAX_OPTION }; + const char kSSPMTriggers[] PROGMEM = "Tasmota|Device|Overload|Overtemp"; const char kSSPMOverload[] PROGMEM = "Tbd1|Voltage|Current|Power|Tbd2|Tbd3|Tbd4"; @@ -316,6 +318,7 @@ void SSPMSettingsDefault(void) { memset(&Sspm->Settings, 0x00, sizeof(tSspmSettings)); Sspm->Settings.version = SSPM_VERSION; + Sspm->Settings.flag.display = SPM_DISPLAY_TABS; // Init any other parameter in struct SSPMSettings } @@ -1981,7 +1984,7 @@ void SSPMEvery100ms(void) { } // If focused on one module increase focused relay polling - if ((2 == Sspm->Settings.flag.display) && (TasmotaGlobal.devices_present > 8) && (0 == Sspm->get_totals)) { + if ((SPM_DISPLAY_TABS == Sspm->Settings.flag.display) && (TasmotaGlobal.devices_present > 8) && (0 == Sspm->get_totals)) { if ((Sspm->get_energy_relay % 4) == 0) { // Every fourth relay uint32_t next = Sspm->rotate +4; if (next >= TasmotaGlobal.devices_present) { next = 0; } @@ -2129,9 +2132,9 @@ void SSPMEnergyShow(bool json) { uint32_t relay_show = 0; power_t power = TasmotaGlobal.power; for (uint32_t i = 0; i < TasmotaGlobal.devices_present; i++) { - if ((0 == Sspm->Settings.flag.display) || - ((1 == Sspm->Settings.flag.display) && (power >> i) &1) || - (2 == Sspm->Settings.flag.display)) { + if ((SPM_DISPLAY_ROTATE == Sspm->Settings.flag.display) || + ((SPM_DISPLAY_ROTATE_POWERED_ON == Sspm->Settings.flag.display) && (power >> i) &1) || + (SPM_DISPLAY_TABS == Sspm->Settings.flag.display)) { relays[relay_show] = i +1; indirect[relay_show] = i; relay_show++; @@ -2139,7 +2142,7 @@ void SSPMEnergyShow(bool json) { } if (relay_show) { - if (Sspm->Settings.flag.display != 2) { + if (Sspm->Settings.flag.display != SPM_DISPLAY_TABS) { if (relay_show > 4) { Sspm->rotate++; } else { @@ -2153,7 +2156,7 @@ void SSPMEnergyShow(bool json) { uint32_t count = relay_show - offset; if (count > 4) { count = 4; } WSContentSend_P(PSTR("
")); // Close current table as we will use different column count - if (2 == Sspm->Settings.flag.display) { + if (SPM_DISPLAY_TABS == Sspm->Settings.flag.display) { uint32_t modules = relay_show / 4; if (modules > 1) { WSContentSend_P(PSTR("{t}")); // {t} = @@ -2229,7 +2232,7 @@ void (* const SSPMCommand[])(void) PROGMEM = { void CmndSSPMDisplay(void) { // Select either all relays, only powered on relays or user selected relay module // SspmDisplay 0, SspmDisplay 1 or SspmDisplay 2 - if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 2)) { + if ((XdrvMailbox.payload >= SPM_DISPLAY_ROTATE) && (XdrvMailbox.payload < SPM_DISPLAY_MAX_OPTION)) { Sspm->Settings.flag.display = XdrvMailbox.payload; } ResponseCmndNumber(Sspm->Settings.flag.display);