raivisr / AS3935-Arduino-Library

AS3935 Franklin Lightning Sensorâ„¢ IC by AMS Arduino library
44 stars 40 forks source link

Distance Mask Incorrect? #5

Closed franksmicro closed 11 years ago

franksmicro commented 11 years ago

Thanks for the library. I bought a sensor and was using it yesterday. I believe however that there is an issue in returning the distance.

I think the mask for distance should be:

define AS3935_DISTANCE 0x07, 0x3F

instead of the present

define AS3935_DISTANCE 0x07, 0x1F

From the AS3935 spec sheet: DISTANCE [5:0] R 000000 Distance estimation

The 1F mask only allows 5 bits instead of 6, so distances returned would always be less than 32km instead of the 63km range of the chip.

Let me know if I am correct about this.

Thanks, Frank

raivisr commented 11 years ago

Thank you, duly noted and fixed.