Skip to content

Commit

Permalink
Revert "Swap reading y and z values (#2133)" (#2135)
Browse files Browse the repository at this point in the history
This reverts commit 92b6bad.
  • Loading branch information
marcelstoer authored Oct 15, 2017
1 parent 92b6bad commit 443e821
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/modules/hmc5883l.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ static int hmc5883_setup(lua_State* L) {
if ((devid_a != 0x48) || (devid_b != 0x34) || (devid_c != 0x33)) {
return luaL_error(L, "device not found");
}

// 8 sample average, 15 Hz update rate, normal measurement
w8u(hmc5883_i2c_id, 0x00, 0x70);

Expand All @@ -57,6 +58,7 @@ static int hmc5883_setup(lua_State* L) {
}

static int hmc5883_init(lua_State* L) {

uint32_t sda;
uint32_t scl;

Expand Down Expand Up @@ -94,8 +96,8 @@ static int hmc5883_read(lua_State* L) {
platform_i2c_send_stop(hmc5883_i2c_id);

x = (int16_t) ((data[0] << 8) | data[1]);
z = (int16_t) ((data[2] << 8) | data[3]);

This comment has been minimized.

Copy link
@jeancode

jeancode Feb 2, 2018

whta?

y = (int16_t) ((data[4] << 8) | data[5]);
y = (int16_t) ((data[2] << 8) | data[3]);
z = (int16_t) ((data[4] << 8) | data[5]);

lua_pushinteger(L, x);
lua_pushinteger(L, y);
Expand Down

0 comments on commit 443e821

Please sign in to comment.