Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GenericComPlugin.cs #44

Open
wants to merge 5 commits into
base: GenericCom
Choose a base branch
from

Conversation

NeoTokyoNori
Copy link

Hello CV,
I have continued to work on my gun controller,
and am at the point where, almost everything is working,
but the serial data lag is still a problem.

The previous pull request based on your advice, improved the lag,
but it lasts only for about 24 hrs, after which I must re-boot my computer to fix it again.
But now, it seems that even that is not fixing it anymore.....

When viewing the data in the arduino serial monitor, there is no lag,
but there is major lag when watching it in FP (10secs+),
so I guess the issue must be in this code.

I would like to try to add a PurgeComm method to the code,
but I do not understand c# enough to get it to work,
so I would really like to hear your advise..

The main error is:
The name 'PurgeComm' does not exist in the current context

edit;
SerialPort.DiscardInBuffer Method
may be more appropriate.

cheers!

PurgeComm(serialPort, PURGE_RXCLEAR | PURGE_TXCLEAR);
Compiles, but crashes when run. please help.
@AndersMalmgren
Copy link
Owner

I would write my custom plugin for this, if its going to be a product in the end it better as a plugin anyway. You can base it on the FreeIMU plugin.

I will take a look at the generic com, but I wouldn't hold my breath :/

@NeoTokyoNori
Copy link
Author

Hi CV,
Since I cannot get it to work in the source code yet,
I just tried doing DiscardInBuffer(); from the FP script like below,
and it has definitely made the lag go away !

code:
from System.IO.Ports import SerialPort

if starting:
global port
port = SerialPort("COM19", 57600)
port.Open();
port.DiscardInBuffer();

So is it a good thing todo in general, when initializing the port....no?

btw, I am going to do this as an opensource hardware project.
I do not plan to make a product and sell it. ; )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants