Wraparound corrected for power reset

git-svn-id: https://svn.fhem.de/fhem/trunk@2238 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig
2012-12-01 09:24:09 +00:00
parent 7c86010062
commit 386cfaadb7

View File

@@ -136,8 +136,9 @@ CUL_EM_Parse($$)
}
# correct counter wraparound
if($total_cnt< $total_cnt_last) {
$basis_cnt += 65536;
if($total_cnt < $total_cnt_last) {
# check: real wraparound or reset only
$basis_cnt += ($total_cnt_last > 65000 ? 65536 : $total_cnt_last);
$readings{basis} = $basis_cnt;
}