Skip to content
Snippets Groups Projects
Verified Commit b74b7c56 authored by rahix's avatar rahix
Browse files

fix(bhi160): Fix FIFO parsing algorithm


FIFO parsing would parse certain packets late because of an incorrect
assumption about FIFO-internals.

Signed-off-by: default avatarRahix <rahix@rahix.de>
parent ed46ab5a
No related tags found
No related merge requests found
......@@ -262,12 +262,7 @@ static int bhi160_fetch_fifo(void)
/* Handle all full packets received in this transfer */
uint8_t *fifo_ptr = bhi160_fifo;
uint16_t bytes_left = bytes_read;
while (ret == BHY_SUCCESS &&
bytes_left > sizeof(bhy_data_generic_t)) {
/*
* TODO: sizeof(bhy_data_generic_t) is probably
* incorrect and makes some measurements arrive late.
*/
while (bytes_left > 0) {
bhy_data_generic_t sensor_data;
bhy_data_type_t data_type;
ret = bhy_parse_next_fifo_packet(
......@@ -279,6 +274,8 @@ static int bhi160_fetch_fifo(void)
if (ret == BHY_SUCCESS) {
bhi160_handle_packet(data_type, &sensor_data);
} else {
break;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment