mirror of https://github.com/arendst/Tasmota.git
Add command SetOption39 1..255 to control CSE7766 (Pow R2) or HLW8032 (Blitzwolf SHP5) handling of power loads below 6W
Add command SetOption39 1..255 to control CSE7766 (Pow R2) or HLW8032 (Blitzwolf SHP5) handling of power loads below 6W. Default setting is 128 (#5756)
This commit is contained in:
parent
9f71afa1ac
commit
164b3aaf11
|
@ -2,6 +2,7 @@
|
|||
* Change webserver HTML input, button, textarea, and select name based on id
|
||||
* Fix webserver multiple Javascript window.onload functionality
|
||||
* Fix PZem startup issue (#5875)
|
||||
* Add command SetOption39 1..255 to control CSE7766 (Pow R2) or HLW8032 (Blitzwolf SHP5) handling of power loads below 6W. Default setting is 128 (#5756)
|
||||
*
|
||||
* 6.5.0.13 20190527
|
||||
* Add command SetOption38 6..255 to set IRReceive protocol detection sensitivity mimizing UNKNOWN protocols (#5853)
|
||||
|
|
|
@ -236,7 +236,7 @@ enum ButtonStates { PRESSED, NOT_PRESSED };
|
|||
|
||||
enum Shortcuts { SC_CLEAR, SC_DEFAULT, SC_USER };
|
||||
|
||||
enum SettingsParmaIndex {P_HOLD_TIME, P_MAX_POWER_RETRY, P_TUYA_DIMMER_ID, P_MDNS_DELAYED_START, P_BOOT_LOOP_OFFSET, P_RGB_REMAP, P_IR_UNKNOW_THRESHOLD, P_MAX_PARAM8}; // Max is PARAM8_SIZE (18) - SetOption32 until SetOption49
|
||||
enum SettingsParmaIndex {P_HOLD_TIME, P_MAX_POWER_RETRY, P_TUYA_DIMMER_ID, P_MDNS_DELAYED_START, P_BOOT_LOOP_OFFSET, P_RGB_REMAP, P_IR_UNKNOW_THRESHOLD, P_CSE7766_INVALID_POWER, P_MAX_PARAM8}; // Max is PARAM8_SIZE (18) - SetOption32 until SetOption49
|
||||
|
||||
enum DomoticzSensors {DZ_TEMP, DZ_TEMP_HUM, DZ_TEMP_HUM_BARO, DZ_POWER_ENERGY, DZ_ILLUMINANCE, DZ_COUNT, DZ_VOLTAGE, DZ_CURRENT, DZ_AIRQUALITY, DZ_MAX_SENSORS};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
xnrg_02_cse7766.ino - CSE7766 energy sensor support for Sonoff-Tasmota
|
||||
xnrg_02_cse7766.ino - CSE7766 and HLW8032 energy sensor support for Sonoff-Tasmota
|
||||
|
||||
Copyright (C) 2019 Theo Arends
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
|||
#ifdef USE_CSE7766
|
||||
/*********************************************************************************************\
|
||||
* CSE7766 - Energy (Sonoff S31 and Sonoff Pow R2)
|
||||
* HLW8032 - Energy (Blitzwolf SHP5)
|
||||
*
|
||||
* Based on datasheet from http://www.chipsea.com/UploadFiles/2017/08/11144342F01B5662.pdf
|
||||
\*********************************************************************************************/
|
||||
|
@ -44,7 +45,7 @@ long power_cycle = 0;
|
|||
long power_cycle_first = 0;
|
||||
long cf_pulses = 0;
|
||||
long cf_pulses_last_time = CSE_PULSES_NOT_INITIALIZED;
|
||||
uint8_t cse_power_invalid = CSE_MAX_INVALID_POWER;
|
||||
uint8_t cse_power_invalid = 0;
|
||||
|
||||
void CseReceived(void)
|
||||
{
|
||||
|
@ -106,7 +107,7 @@ void CseReceived(void)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (cse_power_invalid < CSE_MAX_INVALID_POWER) { // Allow measurements down to about 1W
|
||||
if (cse_power_invalid < Settings.param[P_CSE7766_INVALID_POWER]) { // Allow measurements down to about 1W
|
||||
cse_power_invalid++;
|
||||
} else {
|
||||
power_cycle_first = 0;
|
||||
|
@ -209,6 +210,10 @@ void CseDrvInit(void)
|
|||
if ((3 == pin[GPIO_CSE7766_RX]) && (1 == pin[GPIO_CSE7766_TX])) { // As it uses 8E1 currently only hardware serial is supported
|
||||
baudrate = 4800;
|
||||
serial_config = SERIAL_8E1;
|
||||
if (0 == Settings.param[P_CSE7766_INVALID_POWER]) {
|
||||
Settings.param[P_CSE7766_INVALID_POWER] = CSE_MAX_INVALID_POWER; // SetOption39 1..255
|
||||
}
|
||||
cse_power_invalid = Settings.param[P_CSE7766_INVALID_POWER];
|
||||
energy_flg = XNRG_02;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue