sparkfun / SparkFun_AS3935_Lightning_Detector_Arduino_Library

Other
37 stars 19 forks source link

Fix watchdogThreshold and noiseLevel #5

Closed mday64 closed 5 years ago

mday64 commented 5 years ago

The mask for getting and setting the noise floor was wrong. There were actually two masks. Replaced them with a single mask, NOISE_FLOOR_MASK, that has 1 bits where the noise floor field is within the register.

Setting the watchdogThreshold was using the wrong mask. Inverted THRESH_MASK so it has 1 bits where the watchdog field is within the register (you don't need to invert it when using it in the code).

edspark commented 5 years ago

I want to apologize for the delayed response. I was deep into some other projects and needed to step away from this particular one for a while. I reviewed my code and wasn't quite sure what was going on in my head when I was flipping these particular bits so thank you for taking a close look at it. I'll pull it in.