Skip to content

Conversation

@FintasticMan
Copy link
Member

@FintasticMan FintasticMan commented Mar 17, 2023

Implements a simple circular buffer template. buf[0] is the value at the current index. You can use the ++ and -- operators to move the index. You can initialise the buffer using aggregate initialisation, meaning you can just initialise with a curly-brace list.

@github-actions
Copy link

github-actions bot commented Mar 17, 2023

Build size and comparison to main:

Section Size Difference
text 409268B 0B
data 996B 0B
bss 63356B 0B

@FintasticMan FintasticMan added the maintenance Background work label Mar 17, 2023
@FintasticMan FintasticMan requested a review from a team March 17, 2023 22:40
@FintasticMan FintasticMan changed the title circularbuffer: Add circular buffer utility struct circularbuffer: Add circular buffer utility struct and switch NotificationManager to use it Mar 20, 2023
@FintasticMan
Copy link
Member Author

FintasticMan commented Mar 20, 2023

I've just pushed a change that switches NotificationManager to use this new CircularBuffer. IMO it makes the code easier to understand from a glance.

@Riksu9000
Copy link
Contributor

Riksu9000 commented Mar 22, 2023

Maybe a static sized vector class is more along the lines of what we need for NotificationManager, along with a helper function that will erase the oldest entry if pushing a new element wouldn't fit otherwise.

See #1712

@FintasticMan FintasticMan changed the title circularbuffer: Add circular buffer utility struct and switch NotificationManager to use it circularbuffer: Add circular buffer utility struct Jun 17, 2023
@FintasticMan
Copy link
Member Author

Merged with #826.

@FintasticMan FintasticMan added this to the 1.14.0 milestone Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Background work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants