Home
Home copied to clipboard
The HAL_RingBuffer template class doesn't work data sizes > 1
Target name(s)
ESP32 ( all targets that use RingBufer )
Firmware version
All
Was working before? On which version?
No
Description
After fixing issue in RingBuffer template class found on testing that the datasizes of > 1(byte) didn't work.
The _write_index and _read_index are byte indexes into the buffers but when working with arrays of uint16_t and you add index to it will be positioned to wrong place.
The code should be changed so that these indexes are element indexes and updated so it works for all data sizes
The class is located in src\HAL\include\nanoHAL.h
Currently we only use RingBuffer with byte arrays so not urgent to fix.
Used in Serial & Can drivers
Expected behaviour
RIngbuffer template works with all data sizes as originally designed
Screenshots
No response
Aditional information
No response