Skip to content
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

LSM303 on POLOLU library #66

Open
StudiZaigo opened this issue Apr 24, 2020 · 0 comments
Open

LSM303 on POLOLU library #66

StudiZaigo opened this issue Apr 24, 2020 · 0 comments

Comments

@StudiZaigo
Copy link

I am JA7FKF Satoh.
Thank you for providing a great sketch.

Now I am trying to make an AZ / EL rotator. LSM303 is used to detect AZ / EL.
The library was specified by FEATURE_AZ_POSITION_POLOLU_LSM303.

I read the source because the AZ displayed on the LED is a little strange.

The original source is as follows.


void read_azimuth(byte force_read){
..............
#ifdef FEATURE_AZ_POSITION_POLOLU_LSM303
..............
float heading = compass.heading();

  //float heading = atan2(lsm.magData.y, lsm.magData.x);
  //  heading += declinationAngle; 
  // Correct for when signs are reversed.
  /*
  if (heading < 0) heading += 2 * PI;
  if (heading > 2 * PI) heading -= 2 * PI;
  raw_azimuth = (heading * RAD_TO_DEG) * HEADING_MULTIPLIER; // radians to degree

The unit of the return value of POLOLU's heading function is a degree, so I thought it was necessary to modify the source.

My modifications are as follows.


  float heading = compass.heading();

  //float heading = atan2(lsm.magData.y, lsm.magData.x);
  // heading += declinationAngle();      
  // Correct for when signs are reversed.

#ifdef POLOLU_LSM_303_DECLINATION_ANGLE // JA7FKF
heading += (POLOLU_LSM_303_DECLINATION_ANGLE); // JA7FKF
#endif // POLOLU_LSM_303_DECLINATION_ANGLE // JA7FKF
#ifdef POLOLU_LSM_303_CHANGE_AXIS // JA7FKF
heading += (POLOLU_LSM_303_CHANGE_AXIS); // JA7FKF
#endif // POLOLU_LSM_303_CHANGE_AXIS // JA7FKF
// if (heading < 0) heading += 2 * PI; // JA7FKF
// if (heading > 2 * PI) heading -= 2 * PI; // JA7FKF
while (heading < 0) heading += 360; // JA7FKF
while (heading > 359.99) heading -= 360; // JA7FKF
raw_azimuth = (heading * RAD_TO_DEG) * HEADING_MULTIPLIER; // radians to degree

Incidentally, we also included the conversion of declination and AXIS.
The declination and AXIS values were set in Settings.h.

At a minimum, it is suggested that the source correct the difference
between radians and degree.

Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant