-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting extreme readings #1
Comments
After digging slightly more into the solution for your issue submitted on this other repo, this should definitely use the signed int16_t, the sensor datasheet at one point refers to returning values from -30,000 to +30,000 for each axis. (Section 5.1.2, p.17) |
Fixes sparkfun#1, according to datasheet section 5.1.2 "X-axis, Y-axis, and Z-axis 16-bit output sample data of the magnetic field strength expressed as signed 2's complement numbers."
Here we can only cast |
This library perfectly works on ESP32 devices. I checked it. Just change int to int16_t everywhere in the code. |
Hi @sparkfun,
I'm using this module with an ESP-12 and I'm just running the Basic example. I'm getting very unusual readings. Here is a typical sample:
X: 64895, Y: 425, Z: 64768
What could this be? Have I got a damaged MAG3110? Is there a weird scale value register set somewhere? Any clues would be much appreciated.
EDIT: Upon further investigation - the MAG3110 has two 8-bit registers for each axis. In this library, they're joined and packaged into an
int
. Shouldn't they be packed into auint16_t
or anunsigned int
? Surely there's no sign in the values the magnetometer will spit out. Could I be getting these values due to an overflow?The text was updated successfully, but these errors were encountered: