mirror of https://github.com/arendst/Tasmota.git
v5.12.0e - Fix S31 power on wrong power report
Fix S31 power on wrong power report
This commit is contained in:
parent
1c8e8b7be7
commit
5677a9c854
|
@ -265,6 +265,7 @@ void HlwInit()
|
|||
#define CSE_UREF 100
|
||||
|
||||
uint8_t cse_receive_flag = 0;
|
||||
uint8_t cse_power_valid = 0;
|
||||
|
||||
long voltage_cycle = 0;
|
||||
long current_cycle = 0;
|
||||
|
@ -329,10 +330,16 @@ void CseReceived()
|
|||
if (adjustement & 0x10) { // Power valid
|
||||
if ((header & 0xF2) == 0xF2) { // Power cycle exceeds range
|
||||
energy_power = 0;
|
||||
} else {
|
||||
if (cse_power_valid < 16) { // Skip first incomplete power_cycle
|
||||
cse_power_valid++;
|
||||
energy_power = 0;
|
||||
} else {
|
||||
energy_power = (float)(Settings.energy_power_calibration * CSE_PREF) / (float)power_cycle;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cse_power_valid = 0;
|
||||
energy_power = 0; // Powered on but no load
|
||||
}
|
||||
if (adjustement & 0x20) { // Current valid
|
||||
|
|
Loading…
Reference in New Issue