Search found 3 matches

by Gregor
Thu May 06, 2021 8:35 pm
Forum: ESP32 Arduino
Topic: 1+1 = 3 ?! Ringbuffer variables go crazy
Replies: 3
Views: 2877

Re: 1+1 = 3 ?! Ringbuffer variables go crazy

Thanks, in the meantime I also found out about this, now it works :-)
by Gregor
Tue May 04, 2021 1:09 am
Forum: ESP32 Arduino
Topic: 1+1 = 3 ?! Ringbuffer variables go crazy
Replies: 3
Views: 2877

Re: 1+1 = 3 ?! Ringbuffer variables go crazy

Meanwhile, I got some clue where the problem lies. Volatile doesnt make the vars threadsafe, incrementing a variable is not atomic, so if the variable is decremented from another thread during this operation, a count could be lost.

I have to dig deeper into this, any ideas how to solve this problem?
by Gregor
Sun May 02, 2021 2:28 am
Forum: ESP32 Arduino
Topic: 1+1 = 3 ?! Ringbuffer variables go crazy
Replies: 3
Views: 2877

1+1 = 3 ?! Ringbuffer variables go crazy

Hi I have a really strange problem with a program that sends espnow packets. I am using a ringbuffer to send the packets. After a while the ringbuffer variables go out of control. The ring size, begin and end dont match anymore. I then added a second var for the ring size, that makes the same as the...