Skip to content
Snippets Groups Projects
Commit 8ee0c644 authored by schneider's avatar schneider
Browse files

fix(streams): Only print a single warning once a queue is full

Closes #208
parent d8dd071a
No related branches found
No related tags found
1 merge request!408fix(streams): Only print a single warning once a queue is full
Pipeline #4747 passed
...@@ -315,7 +315,16 @@ bhi160_handle_packet(bhy_data_type_t data_type, bhy_data_generic_t *sensor_data) ...@@ -315,7 +315,16 @@ bhi160_handle_packet(bhy_data_type_t data_type, bhy_data_generic_t *sensor_data)
bhi160_streams[sensor_type].queue, bhi160_streams[sensor_type].queue,
&data_vector, &data_vector,
0) != pdTRUE) { 0) != pdTRUE) {
LOG_WARN("bhi160", "queue full for %d", sensor_type); if (!bhi160_streams[sensor_type].was_full) {
LOG_WARN(
"bhi160",
"queue full for %d",
sensor_type
);
}
bhi160_streams[sensor_type].was_full = true;
} else {
bhi160_streams[sensor_type].was_full = false;
} }
if (wakeup) { if (wakeup) {
......
...@@ -137,8 +137,13 @@ static void max30001_handle_samples(int16_t *sensor_data, int16_t n) ...@@ -137,8 +137,13 @@ static void max30001_handle_samples(int16_t *sensor_data, int16_t n)
/* Discard overflow. See discussion in !316. */ /* Discard overflow. See discussion in !316. */
if (xQueueSend(max30001_stream.queue, &data, 0) != pdTRUE) { if (xQueueSend(max30001_stream.queue, &data, 0) != pdTRUE) {
if (!max30001_stream.was_full) {
LOG_WARN("max30001", "queue full"); LOG_WARN("max30001", "queue full");
} }
max30001_stream.was_full = true;
} else {
max30001_stream.was_full = false;
}
} }
interrupt_trigger(EPIC_INT_MAX30001_ECG); interrupt_trigger(EPIC_INT_MAX30001_ECG);
} }
......
...@@ -136,8 +136,13 @@ static int max86150_handle_sample(struct max86150_sensor_data *data) ...@@ -136,8 +136,13 @@ static int max86150_handle_sample(struct max86150_sensor_data *data)
/* Discard overflow. See discussion in !316. */ /* Discard overflow. See discussion in !316. */
if (xQueueSend(max86150_stream.queue, data, 0) != pdTRUE) { if (xQueueSend(max86150_stream.queue, data, 0) != pdTRUE) {
if (!max86150_stream.was_full) {
LOG_WARN("max86150", "queue full"); LOG_WARN("max86150", "queue full");
}
max86150_stream.was_full = true;
return -EIO; return -EIO;
} else {
max86150_stream.was_full = false;
} }
interrupt_trigger(EPIC_INT_MAX86150); interrupt_trigger(EPIC_INT_MAX86150);
......
...@@ -67,6 +67,12 @@ struct stream_info { ...@@ -67,6 +67,12 @@ struct stream_info {
* The function registered here should never block for a longer time. * The function registered here should never block for a longer time.
*/ */
int (*poll_stream)(); int (*poll_stream)();
/**
* Set to true if the last write to ``queue`` failed because
* the queue was full.
*/
bool was_full;
}; };
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment