Skip to content

Commit 0a8a784

Browse files
committed
WIP: revert
1 parent 1d650a0 commit 0a8a784

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,26 @@ class WipperSnapper_I2C_Driver_NAU7802 : public WipperSnapper_I2C_Driver {
7575
WS_DEBUG_PRINTLN("Failed to set gain to 128");
7676
return false;
7777
}
78+
79+
if (!_nau7802->setRate(NAU7802_RATE_10SPS) &&
80+
!_nau7802->setRate(NAU7802_RATE_10SPS)) {
81+
WS_DEBUG_PRINTLN("Failed to set sample rate to 10SPS");
82+
return false;
83+
}
84+
85+
// Take 10 readings to flush out old readings (10 samples per second)
86+
for (uint8_t skipCounter = 0; skipCounter < 10; skipCounter++) {
87+
while (!_nau7802->available())
88+
delay(1);
89+
_nau7802->read();
90+
}
91+
92+
while (!_nau7802->calibrate(NAU7802_CALMOD_INTERNAL)) {
93+
WS_DEBUG_PRINTLN("Failed to calibrate internal offset, retrying!");
94+
delay(1000);
95+
}
96+
WS_DEBUG_PRINTLN("Calibrated internal offset");
97+
7898
return true;
7999
}
80100

0 commit comments

Comments
 (0)