diff --git a/sonoff/my_user_config.h b/sonoff/my_user_config.h index 262af85f4..e9fbedc9c 100644 --- a/sonoff/my_user_config.h +++ b/sonoff/my_user_config.h @@ -265,8 +265,8 @@ // -- MQTT - TLS - AWS IoT ------------------------ // Using TLS starting with version v6.5.0.16 compilation will only work using Core 2.4.2 and 2.5.2. No longer supported: 2.3.0 //#define USE_MQTT_TLS // Use TLS for MQTT connection (+34.5k code, +7.0k mem and +4.8k additional during connection handshake) - //#define USE_MQTT_TLS_CA_CERT // Force full CA validation instead of fingerprints, slower, but simpler to use (+2.2k code, +1.9k mem during connection handshake) - //#define USE_MQTT_AWS_IOT // Enable MQTT for AWS IoT - requires a private key (+11.4k code, +0.4k mem) +// #define USE_MQTT_TLS_CA_CERT // Force full CA validation instead of fingerprints, slower, but simpler to use (+2.2k code, +1.9k mem during connection handshake) +// #define USE_MQTT_AWS_IOT // Enable MQTT for AWS IoT - requires a private key (+11.4k code, +0.4k mem) // Note: you need to generate a private key + certificate per device and update 'sonoff/sonoff_aws_iot.cpp' // Full documentation here: https://github.com/arendst/Sonoff-Tasmota/wiki/AWS-IoT diff --git a/sonoff/support_button.ino b/sonoff/support_button.ino index f79d5d84e..dc653c8f8 100644 --- a/sonoff/support_button.ino +++ b/sonoff/support_button.ino @@ -96,6 +96,7 @@ uint8_t ButtonSerial(uint8_t serial_in_byte) * SetOption11 (0) - If set perform single press action on double press and reverse * SetOption13 (0) - If set act on single press only * SetOption32 (40) - Max button hold time in Seconds + * SetOption40 (0) - Number of 0.1 seconds until hold is discarded if SetOption1 1 and SetOption13 0 \*********************************************************************************************/ void ButtonHandler(void) @@ -198,6 +199,7 @@ void ButtonHandler(void) if (holdbutton[button_index] > loops_per_second * Settings.param[P_HOLD_IGNORE] / 10) { holdbutton[button_index] = 0; // Reset button hold counter to stay below hold trigger multipress[button_index] = 0; // Discard button press to disable functionality +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d cancel by " D_CMND_SETOPTION "40 %d"), button_index +1, Settings.param[P_HOLD_IGNORE]); } } if (holdbutton[button_index] == loops_per_second * Settings.param[P_HOLD_TIME] / 10) { // SetOption32 (40) - Button hold diff --git a/sonoff/xnrg_07_ade7953.ino b/sonoff/xnrg_07_ade7953.ino index a4a0b65c4..54ae7a110 100644 --- a/sonoff/xnrg_07_ade7953.ino +++ b/sonoff/xnrg_07_ade7953.ino @@ -126,6 +126,9 @@ void Ade7953GetData(void) ade7953_current_rms = ade7953_current_rms1 + ade7953_current_rms2; ade7953_active_power = ade7953_active_power1 + ade7953_active_power2; + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ADE: U %d, I %d + %d = %d, P %d + %d = %d"), + ade7953_voltage_rms, ade7953_current_rms1, ade7953_current_rms2, ade7953_current_rms, ade7953_active_power1, ade7953_active_power2, ade7953_active_power); + if (energy_power_on) { // Powered on energy_voltage = (float)ade7953_voltage_rms / Settings.energy_voltage_calibration; energy_active_power = (float)ade7953_active_power / (Settings.energy_power_calibration / 10); @@ -139,21 +142,21 @@ void Ade7953GetData(void) energy_active_power = 0; energy_current = 0; } -} -void Ade7953EnergyEverySecond() -{ if (ade7953_active_power) { energy_kWhtoday_delta += ((ade7953_active_power * (100000 / (Settings.energy_power_calibration / 10))) / 3600); EnergyUpdateToday(); } +} + +void Ade7953EnergyEverySecond() +{ if (ade7953_init) { if (1 == ade7953_init) { Ade7953Init(); } ade7953_init--; - } - else { + } else { Ade7953GetData(); } }