Commit 613afe3b authored by Rahix's avatar Rahix
Browse files

Merge 'streams: Only print a single warning once a queue is full'

Closes #208

See merge request card10/firmware!408
parents b84cd7e9 8ee0c644
......@@ -315,7 +315,16 @@ bhi160_handle_packet(bhy_data_type_t data_type, bhy_data_generic_t *sensor_data)
bhi160_streams[sensor_type].queue,
&data_vector,
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) {
......
......@@ -137,7 +137,12 @@ static void max30001_handle_samples(int16_t *sensor_data, int16_t n)
/* Discard overflow. See discussion in !316. */
if (xQueueSend(max30001_stream.queue, &data, 0) != pdTRUE) {
LOG_WARN("max30001", "queue full");
if (!max30001_stream.was_full) {
LOG_WARN("max30001", "queue full");
}
max30001_stream.was_full = true;
} else {
max30001_stream.was_full = false;
}
}
interrupt_trigger(EPIC_INT_MAX30001_ECG);
......
......@@ -136,8 +136,13 @@ static int max86150_handle_sample(struct max86150_sensor_data *data)
/* Discard overflow. See discussion in !316. */
if (xQueueSend(max86150_stream.queue, data, 0) != pdTRUE) {
LOG_WARN("max86150", "queue full");
if (!max86150_stream.was_full) {
LOG_WARN("max86150", "queue full");
}
max86150_stream.was_full = true;
return -EIO;
} else {
max86150_stream.was_full = false;
}
interrupt_trigger(EPIC_INT_MAX86150);
......
......@@ -67,6 +67,12 @@ struct stream_info {
* The function registered here should never block for a longer time.
*/
int (*poll_stream)();
/**
* Set to true if the last write to ``queue`` failed because
* the queue was full.
*/
bool was_full;
};
/**
......
Markdown is supported
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