• Welcome to Andy's Workshop Forums. Please login or sign up.
 
April 18, 2024, 11:56:53 am

News:

SMF - Just Installed!


Bug...maybe.

Started by mhel, December 01, 2015, 01:53:34 pm

Previous topic - Next topic

mhel

Hi,
I think I may have found a bug in CircularBufferInputOutputStream.
I'm testing it with usart receive interrupt. The buffer seems to get full
even if I'm reading it right away. I'm doing it this way:
In the interrupt routine

d = _usart.receive();
if (!inStream.isFull())
inStream.write(d);

then in my GetChar which I call in main, this what it does:

if (inStream.available()) {
     d = inStream.read();
     _usart.send(d);
}

In

  int16_t CircularBufferInputOutputStream::read() {
    ....
    if(_readPtr >= _buffer + _bufferSize) {
      _readPtr=_buffer;
    _wrappedWrite = false;  /* This seems to be a fix */
    }
    return value;
  }


I add _wrappedWrite = false;

It would be nice to have a confirmation if it's a bug or I'm doing it wrong again  :)

Andy Brown

Thanks for reporting this, I promise I'll investigate and fix any problem. It may take a couple of weeks though as I'm very busy with something else.
It's worse than that, it's physics Jim!