File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
src/components/i2c/drivers Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments