sparkfun / SparkFun_AS3935_Lightning_Detector_Arduino_Library

Other
37 stars 19 forks source link

Problem with tuneCap() and readTuneCap() #8

Closed fourstix closed 5 years ago

fourstix commented 5 years ago

I found an issue with tuneCap() and the mask used to set the AS3935 bits in register 0x08. If I edit Example 3 and change the code to set tuneCap to a value of 2 (for 16pf). When the code reads the value back with readTuneCape() it reports 88pf instead of 16. I traced the issue back to an incorrect value of the CAP_MASK in Sparkfun_AS3935.h. The value should be 0x0F, not 0xF0 to match the register map in the data sheet. Also I found a small error, in the readTuneCap() where the value read was anded with Not value of the mask, instead of the value of the mask. I will create a pull request with my changes. I have fixed these two error in my fork and tested them, and the code now works as expected.

edspark commented 5 years ago

Thanks fixed with your pull request: https://github.com/sparkfun/SparkFun_AS3935_Lightning_Detector_Arduino_Library/pull/9