File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
src/components/i2c/drivers Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -89,13 +89,16 @@ class WipperSnapper_I2C_Driver_NAU7802 : public WipperSnapper_I2C_Driver {
8989 _nau7802->read ();
9090 }
9191
92- while (!_nau7802->calibrate (NAU7802_CALMOD_INTERNAL)) {
92+ for (int retries = 0 ; retries < 3 ; retries++) {
93+ if (_nau7802->calibrate (NAU7802_CALMOD_INTERNAL)) {
94+ WS_DEBUG_PRINTLN (" Calibrated internal offset" );
95+ return true ;
96+ }
9397 WS_DEBUG_PRINTLN (" Failed to calibrate internal offset, retrying!" );
9498 delay (1000 );
9599 }
96- WS_DEBUG_PRINTLN (" Calibrated internal offset" );
97-
98- return true ;
100+ WS_DEBUG_PRINTLN (" ERROR: Failed to calibrate internal offset of NAU7802." );
101+ return false ;
99102 }
100103
101104 /* ******************************************************************************/
You can’t perform that action at this time.
0 commit comments