mirror of https://github.com/arendst/Tasmota.git
Add HLW debug info
This commit is contained in:
parent
5b7371d98f
commit
28c343f3c8
|
@ -103,7 +103,7 @@ void ButtonProbe(void) {
|
|||
uint32_t debounce_flags = Settings->button_debounce % 10;
|
||||
bool force_high = (debounce_flags &1); // 51, 101, 151 etc
|
||||
bool force_low = (debounce_flags &2); // 52, 102, 152 etc
|
||||
bool ac_detect = (debounce_flags == 9);
|
||||
bool ac_detect = (debounce_flags == 9); // 39, 49, 59 etc
|
||||
|
||||
if (ac_detect) {
|
||||
if (Settings->button_debounce < 2 * BUTTON_AC_PERIOD * BUTTON_FAST_PROBE_INTERVAL + 9) {
|
||||
|
@ -121,7 +121,6 @@ void ButtonProbe(void) {
|
|||
if (!PinUsed(GPIO_KEY1, i)) { continue; }
|
||||
|
||||
// Olimex user_switch2.c code to fix 50Hz induced pulses
|
||||
// if (1 == digitalRead(Pin(GPIO_KEY1, i))) {
|
||||
if (digitalRead(Pin(GPIO_KEY1, i)) != bitRead(Button.inverted_mask, i)) {
|
||||
|
||||
if (ac_detect) { // Enabled with ButtonDebounce x9
|
||||
|
@ -221,7 +220,7 @@ void ButtonInit(void) {
|
|||
Button.state[i] = 0x80 + 2 * BUTTON_AC_PERIOD;
|
||||
Button.last_state[i] = 0; // Will set later in the debouncing code
|
||||
} else {
|
||||
// Button.last_state[i] = digitalRead(Pin(GPIO_KEY1, i)); // Set global now so doesn't change the saved power state on first button check
|
||||
// Set global now so doesn't change the saved power state on first button check
|
||||
Button.last_state[i] = (digitalRead(Pin(GPIO_KEY1, i)) != bitRead(Button.inverted_mask, i));
|
||||
}
|
||||
}
|
||||
|
@ -266,6 +265,8 @@ uint8_t ButtonSerial(uint8_t serial_in_byte) {
|
|||
* SetOption1 (0) - If set do not execute commands WifiConfig and Reset
|
||||
* SetOption11 (0) - If set perform single press action on double press and reverse (on two relay devices only)
|
||||
* SetOption13 (0) - If set act on single press only
|
||||
* SetOption32 (40) - Button held for factor times longer
|
||||
* SetOption40 (0) - Do not ignore button hold
|
||||
* SetOption73 (0) - Decouple button from relay and send just mqtt topic
|
||||
\*********************************************************************************************/
|
||||
|
||||
|
|
|
@ -211,6 +211,9 @@ void HlwEverySecond(void) {
|
|||
uint32_t hlw_len;
|
||||
|
||||
if (Hlw.energy_period_counter) {
|
||||
|
||||
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("HLW: EPC %u, CFlen %d usec"), Hlw.energy_period_counter, Hlw.cf_pulse_length);
|
||||
|
||||
hlw_len = 10000 * 100 / Hlw.energy_period_counter; // Add *100 to fix rounding on loads at 3.6kW (#9160)
|
||||
Hlw.energy_period_counter = 0;
|
||||
if (hlw_len) {
|
||||
|
|
Loading…
Reference in New Issue