emonPi_Startup.ino calc_rms BUG

This is not important as the code works as is with this hardware but should be corrected anyway.

The function calc_rms(int pin, int samples) receives the pin number for the readings, but all the readings are made in pin 0 and the variable isn't used.

Cheers.

Robert Wall's picture

Re: emonPi_Startup.ino calc_rms BUG

Well spotted - I'll point Glyn towards this.

glyn.hudson's picture

Re: emonPi_Startup.ino calc_rms BUG

Thanks, I've made the fix. Well spotted, would no doubt have caused confusion in the future! Is that what you meant: https://github.com/openenergymonitor/emonpi/commit/555f4784a06e4daa576611193cd16fd0c43671f8

CidiRome's picture

Re: emonPi_Startup.ino calc_rms BUG

Hi,

Don't seem right as is

Made correction:
+ int raw = (pin-512);
Correct correction:
+ int raw = (analogRead(pin)-512);

Cheers.

glyn.hudson's picture

Re: emonPi_Startup.ino calc_rms BUG

Woops, yes indeed https://github.com/openenergymonitor/emonpi/commit/cf67c91be4be581b1cf90390522318c2606fc72b

​Thanks, 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.