Circular buffer - FlushBuffer command

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 187 times
Been thanked: 140 times
Contact:

Circular buffer - FlushBuffer command

Post by petesmart »

Gents,

A quick one on the circular buffer. Does the FlushBuffer command simulate?

It appears not to do anything to the Circular buffer tab information in the console. Is this normal?

best

Pete
sorry about that Chief!

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Circular buffer - FlushBuffer command

Post by Benj »

Hi Pete,

For efficiency the flush command simply resets the read and write pointers, the contents of the buffer are unaffected so this is probably what you are seeing. I suppose for simulation I could also scrub the data if this would make things more obvious.

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 187 times
Been thanked: 140 times
Contact:

Re: Circular buffer - FlushBuffer command

Post by petesmart »

Thanks,


edit... forget below...I just re read your note... thats the way its designed!... dont bother changing the simulation...I will read out all of the data...


Got it.. was that supposed to be the design? - reset pointers and leave data in the buffer?

I will check again but the data still seems to be in the Circ buffer ie i can read it

best

Pete
sorry about that Chief!

User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Re: Circular buffer - FlushBuffer command

Post by AbhijitR »

Hello! Ben
good afternoon
Benj wrote:
Thu Aug 16, 2018 10:46 am

For efficiency the flush command simply resets the read and write pointers, the contents of the buffer are unaffected so this is probably what you are seeing.
May i request you if it is possible and the upgrade of component allows, to add one more option/command for this component, FlushBuffer which will absolutely clear the buffer and ResetBuffer which will rest the pointer.

In other case if it is not possible is there any other way to clear the buffer so it will be blank to receive next data.

I am using this component for the first time and it is indeed very helpful.

Thank you.

Abhi

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Circular buffer - FlushBuffer command

Post by Benj »

Hi Abhi,

This should not be required. If you flush the buffer then the buffer is effectively empty and available to receive more data.

Make sure you use the GetNumberBytes macro to check the contents of the buffer before reading out data and then you will be sure you won't be reading out old stale data.

If you do need to flood the buffer with a known value then you can do this by adding that value in a loop for the buffer size number of times. Then flushing the buffer. But as I say this shouldn't be required.

Post Reply