Wraparound corrected for power reset

git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@2238 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig
2012-12-01 09:24:09 +00:00
parent 718fcc0297
commit 3d7c50ada9

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;
}