強要

Revision:
6:5c0cebb61b0f
Parent:
5:ea1b30a71280
--- a/HMC5883L.cpp	Wed Feb 06 11:53:18 2019 +0000
+++ b/HMC5883L.cpp	Thu Feb 07 06:13:40 2019 +0000
@@ -85,7 +85,7 @@
 char HMC5883L::getConfigurationB()
 {
     char cmd[2];
-    cmd[0] = CONFIG_A_REG; // register b address
+    cmd[0] = CONFIG_B_REG; // register b address
     i2c_.write(I2C_ADDRESS, cmd, 1, true);
     i2c_.read(I2C_ADDRESS, &cmd[1], 1, false);
     return cmd[1];
@@ -133,7 +133,7 @@
 {
     int16_t raw_data[3];
     getXYZ(raw_data);
-    double heading = atan2(static_cast<double>(raw_data[1]+Calib_x), static_cast<double>(raw_data[0])+Calib_y); // heading = arctan(Y/X)
+    double heading = atan2(static_cast<double>(raw_data[2]+Calib_x), static_cast<double>(raw_data[0])+Calib_y); // heading = arctan(Y/X)
     
     // TODO: declenation angle compensation