CHG ringbuffer delimiter to \r
This commit is contained in:
parent
5e863be2e3
commit
98ae8535af
@ -26,7 +26,7 @@ extern "C" {
|
|||||||
#define STR(x) STR_HELPER(x)
|
#define STR(x) STR_HELPER(x)
|
||||||
#endif
|
#endif
|
||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 5
|
#define VERSION_MINOR 6
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define VERSION_DEBUG ".D"
|
#define VERSION_DEBUG ".D"
|
||||||
#else
|
#else
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
#ifndef _INC_RINGBUF_H_
|
#ifndef _INC_RINGBUF_H_
|
||||||
#define _INC_RINGBUF_H_
|
#define _INC_RINGBUF_H_
|
||||||
|
|
||||||
|
/* Defines */
|
||||||
|
/* <ENTER> given, was \n, should be \r */
|
||||||
|
#define RINGBUF_DELIMITER '\r'
|
||||||
|
|
||||||
#define RING_STATISTICS_ENABLED 1
|
#define RING_STATISTICS_ENABLED 1
|
||||||
|
|
||||||
#define RINGBUF_MAX_READ_LEN 80
|
#define RINGBUF_MAX_READ_LEN 80
|
||||||
|
@ -135,7 +135,7 @@ int ringbuf_push(struct ringbuf *ring, const uint8_t *data, size_t size) {
|
|||||||
ring->head += (uint16_t)size;
|
ring->head += (uint16_t)size;
|
||||||
}
|
}
|
||||||
for (delimiterpos = 0; delimiterpos < size; delimiterpos++) {
|
for (delimiterpos = 0; delimiterpos < size; delimiterpos++) {
|
||||||
if (data[delimiterpos] == '\n' || data[delimiterpos] == 0 ) {
|
if (data[delimiterpos] == RINGBUF_DELIMITER || data[delimiterpos] == 0 ) {
|
||||||
delimiterfound++;
|
delimiterfound++;
|
||||||
ptr = ring->buf + ((head + delimiterpos) % ring->size);
|
ptr = ring->buf + ((head + delimiterpos) % ring->size);
|
||||||
*ptr = 0;
|
*ptr = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user