Skip to content

Commit a1ddece

Browse files
committed
Add 100ms delay to allow for config to complete
-Adding this 100ms delay into setReports allows enough time for the configuration to process and the sensor to clear its reset status flag. When the main loop comes around again and checks for a reset, it no longer sees the previous reset flag and then can continue on to reading the sensor.
1 parent 8947e7b commit a1ddece

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

examples/SPI/Example_01_SPI_RotationVector/Example_01_SPI_RotationVector.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ void setReports(void) {
9090
} else {
9191
Serial.println("Could not enable rotation vector");
9292
}
93+
delay(100); // This delay allows enough time for the BNO086 to accept the new
94+
// configuration and clear its reset status
9395
}
9496

9597
void loop() {

examples/SPI/Example_02_SPI_ResetCheck/Example_02_SPI_ResetCheck.ino

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,9 @@ void setup() {
8080
}
8181
Serial.println("BNO08x found!");
8282

83-
if( myIMU.requestResetReason() == true ) {
84-
Serial.print(F("Reset Reason: "));
85-
printResetReasonName(myIMU.getResetReason());
86-
Serial.println();
87-
}
88-
else {
89-
Serial.println("Reset Reason Request failed.");
90-
}
83+
Serial.print(F("Reset Reason: "));
84+
printResetReasonName(myIMU.getResetReason());
85+
Serial.println();
9186

9287
setReports();
9388

@@ -104,6 +99,8 @@ void setReports(void) {
10499
} else {
105100
Serial.println("Could not enable gyro");
106101
}
102+
delay(100); // This delay allows enough time for the BNO086 to accept the new
103+
// configuration and clear its reset status
107104
}
108105

109106
void loop() {
@@ -115,14 +112,9 @@ void loop() {
115112
// different resets.
116113
if (myIMU.wasReset()) {
117114
Serial.println(" ------------------ BNO08x has reset. ------------------ ");
118-
if( myIMU.requestResetReason() == true ) {
119-
Serial.print(F("Reset Reason: "));
120-
printResetReasonName(myIMU.getResetReason());
121-
Serial.println();
122-
}
123-
else {
124-
Serial.println("Reset Reason Request failed.");
125-
}
115+
Serial.print(F("Reset Reason: "));
116+
printResetReasonName(myIMU.getResetReason());
117+
Serial.println();
126118

127119
setReports(); // We'll need to re-enable reports after any reset.
128120
}

examples/SPI/Example_03_SPI_Sleep/Example_03_SPI_Sleep.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ void setReports(void) {
9191
} else {
9292
Serial.println("Could not enable rotation vector");
9393
}
94+
delay(100); // This delay allows enough time for the BNO086 to accept the new
95+
// configuration and clear its reset status
9496
}
9597

9698
void loop() {

0 commit comments

Comments
 (0)