Skip to content

Commit 2723c39

Browse files
committed
fix(qmc883p): set range to 30G and log xyz until vector supported
1 parent e900680 commit 2723c39

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/components/i2c/drivers/WipperSnapper_I2C_Driver_QMC5883P.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ bool WipperSnapper_I2C_Driver_QMC5883P::begin() {
3333
_qmc->setOSR(QMC5883P_OSR_4);
3434
// Set DSR (Downsample Ratio) to 2
3535
_qmc->setDSR(QMC5883P_DSR_2);
36-
// Set Range to 8G
37-
_qmc->setRange(QMC5883P_RANGE_8G);
36+
// Set Range to 30G
37+
_qmc->setRange(QMC5883P_RANGE_30G);
3838
// Set SetReset mode to On
3939
_qmc->setSetResetMode(QMC5883P_SETRESET_ON);
4040

@@ -51,12 +51,21 @@ bool WipperSnapper_I2C_Driver_QMC5883P::getEventRaw(sensors_event_t *magEvent) {
5151

5252
// Get raw magnetic data
5353
if (!_qmc->getRawMagnetic(&x, &y, &z)) {
54+
WS_DEBUG_PRINTLN("Failed to read raw magnetic data");
5455
return false;
5556
}
5657

5758
// Get Gauss field data
5859
if (!_qmc->getGaussField(&gx, &gy, &gz)) {
60+
WS_DEBUG_PRINTLN("Failed to read Gauss field data");
61+
WS_DEBUG_PRINT("Raw X: "); WS_DEBUG_PRINTLN(x);
62+
WS_DEBUG_PRINT("Raw Y: "); WS_DEBUG_PRINTLN(y);
63+
WS_DEBUG_PRINT("Raw Z: "); WS_DEBUG_PRINTLN(z);
5964
return false;
65+
} else {
66+
WS_DEBUG_PRINT("Gauss X: "); WS_DEBUG_PRINTLN(gx);
67+
WS_DEBUG_PRINT("Gauss Y: "); WS_DEBUG_PRINTLN(gy);
68+
WS_DEBUG_PRINT("Gauss Z: "); WS_DEBUG_PRINTLN(gz);
6069
}
6170

6271
// Check for overflow

0 commit comments

Comments
 (0)