Commit d974cd2f authored by Rahix's avatar Rahix
Browse files

hack(streams): Discard overflowing samples

As discussed in card10/firmware!316, this commit prevents I2C lockup by
discarding overflowing samples instead of blocking until they have been
read.  This is not ideal as the samples read will not be the most recent
ones.  A deeper refactor of the sensor-stream internal API can fix this
in the future.

Cc: @flo_h

Signed-off-by: Rahix's avatarRahix <>
parent c3ca9d22
Pipeline #3999 passed with stages
in 2 minutes and 13 seconds
......@@ -312,11 +312,15 @@ bhi160_handle_packet(bhy_data_type_t data_type, bhy_data_generic_t *sensor_data)
data_vector.y = sensor_data->data_vector.y;
data_vector.z = sensor_data->data_vector.z;
data_vector.status = sensor_data->data_vector.status;
/* Discard overflow. See discussion in !316. */
if (xQueueSend(
0) != pdTRUE) {
LOG_WARN("bhi160", "queue full for %d", sensor_type);
if (wakeup) {
......@@ -155,13 +155,10 @@ static void max30001_handle_samples(int16_t *sensor_data, int16_t n)
while (n--) {
uint16_t data = -*sensor_data++;
if (xQueueSend(
MAX30001_MUTEX_WAIT_MS) != pdTRUE) {
"queue full"); // TODO; handle queue full
/* Discard overflow. See discussion in !316. */
if (xQueueSend(max30001_stream.queue, &data, 0) != pdTRUE) {
LOG_WARN("max30001", "queue full");
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment