openenergymonitor / EmonLib

Electricity monitoring library - install in Arduino IDE's libraries folder then restart the IDE
openenergymonitor.org
GNU Affero General Public License v3.0
589 stars 419 forks source link

At power-on, filteredV and I are uninitialised #4

Closed JackKelly closed 9 years ago

JackKelly commented 11 years ago

(Awesome project, by the way - thanks so much for sharing!)

The correct functioning of the high-pass filter in EnergyMonitor::calcVI() relies on the previous values for filteredI and filteredV being sane. But these variables are uninitialised when the code starts running; hence they will be set to a random value at power-on!

Here's a patch with a simple fix: https://github.com/JackKelly/EmonLib/commit/e10bfdff206e4e70e04afdfd0fdb698c33abe73a

glynhudson commented 9 years ago

Thanks, sorry it taken so long to resolve this issue https://github.com/openenergymonitor/EmonLib/commit/1a654efacafa48a9f11f505bd451d6490a518869