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 {
89
89
_nau7802->read ();
90
90
}
91
91
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
+ }
93
97
WS_DEBUG_PRINTLN (" Failed to calibrate internal offset, retrying!" );
94
98
delay (1000 );
95
99
}
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 ;
99
102
}
100
103
101
104
/* ******************************************************************************/
You can’t perform that action at this time.
0 commit comments