Skip to content

Commit ed75bea

Browse files
committed
rc v1.2
1 parent efca216 commit ed75bea

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

examples/exampleInterrupts.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,19 @@ extern "C" void app_main(){
8787
}
8888

8989
while (1){
90-
if (bno.interruptFlag == true){
91-
//See bno055_interrupts_status_t for more details.
92-
bno055_interrupts_status_t ist = bno.getInterruptsStatus();
93-
// remember that multiple interrupts can be triggered at the same time. so you shouldn't use 'else if'
94-
if (ist.accelAnyMotion == 1){
95-
ESP_LOGI(TAG, "AccelAnyMotion Interrupt received.");
96-
}
97-
if (ist.accelNoSlowMotion == 1){
98-
ESP_LOGI(TAG, "accelNoSlowMotion Interrupt received.");
99-
}
100-
bno.clearInterruptPin(); //don't forget to place this.
101-
}
10290
try{
91+
if (bno.interruptFlag == true){
92+
//See bno055_interrupts_status_t for more details.
93+
bno055_interrupts_status_t ist = bno.getInterruptsStatus();
94+
// remember that multiple interrupts can be triggered at the same time. so you shouldn't use 'else if'
95+
if (ist.accelAnyMotion == 1){
96+
ESP_LOGI(TAG, "AccelAnyMotion Interrupt received.");
97+
}
98+
if (ist.accelNoSlowMotion == 1){
99+
ESP_LOGI(TAG, "accelNoSlowMotion Interrupt received.");
100+
}
101+
bno.clearInterruptPin(); //don't forget to place this.
102+
}
103103
//Calibration 3 = fully calibrated, 0 = uncalibrated
104104
bno055_calibration_t cal = bno.getCalibration();
105105
bno055_vector_t v = bno.getVectorEuler();

src/BNO055ESP32.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ void BNO055::writeLen(bno055_reg_t reg, uint8_t *data2write, uint8_t len, uint32
174174
#ifndef BNO055_DEBUG_OFF
175175
ESP_LOG_BUFFER_HEXDUMP(BNO055_LOG_TAG, (const char*) cmd,(len+4), ESP_LOG_DEBUG);
176176
#endif
177-
free(cmd);
178177

179178
if (timeoutMS == 0){
180179
return; // Do not expect ACK/response
@@ -191,23 +190,27 @@ void BNO055::writeLen(bno055_reg_t reg, uint8_t *data2write, uint8_t len, uint32
191190

192191
if (data[0] == 0xEE){
193192
if (data[1] == 0x01){ //OK
193+
free(cmd);
194194
break;
195195
}
196196
else if ((data[1] == 0x07 || data[1] == 0x03 || data[1] == 0x06|| data[1] == 0x0A) && (round < UART_ROUND_NUM)){ // TRY AGAIN
197197
continue;
198198
}
199199
else{ //Error :-(
200200
ESP_LOGE(BNO055_LOG_TAG, "(WL) Error: %d.", (int)data[1]);
201+
free(cmd);
201202
throw getException(data[1]);
202203
}
203204
}
204205

205206
else{
207+
free(cmd);
206208
ESP_LOGE(BNO055_LOG_TAG, "(WL) Error: (BNO55_UNKNOW_ERROR)");
207209
throw BNO055UnknowError();
208210
}
209211
}
210212
else{
213+
free(cmd);
211214
throw BNO055UartTimeout();
212215
}
213216
}

0 commit comments

Comments
 (0)