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

COM Menu goes a little crazy sometimes. #397

Closed
buildlog opened this issue Jul 15, 2018 · 6 comments
Closed

COM Menu goes a little crazy sometimes. #397

buildlog opened this issue Jul 15, 2018 · 6 comments

Comments

@buildlog
Copy link

Sometimes my COM menu gets a little crazy. According to Device Manager, I only had 3 and 10.

coms

@buildlog
Copy link
Author

Here is what Device Manager showed at the time.

BTW: Is it possible to show the descriptive text in addition to the number to make it easier to know which one to pick?

coms2

@StuartB4
Copy link

StuartB4 commented Jul 15, 2018

If you are using an Arduino and you have the Arduino IDE running you should be able to see which one it is on. Then select the same one in LaserGRBL.
Also you should change the BAUD rate to 115200

untitled

@buildlog
Copy link
Author

Thanks for the reply

Yes, I understand how to find which one to use. I just thought it would save a step if it is in LaserGrbl too.

Why are so many duplicates showing up in the LaserGrbl list?

I am using a port of Grbl on a different processor (PSoC5). The USB can run at any speed up to 2M. I pick the fastest one in LaserGrbl.

@StuartB4
Copy link

I am using a port of Grbl on a different processor (PSoC5).

Maybe thats the reason. Never seen that happen before.

@arkypita
Copy link
Owner

Hi @buildlog thanks for issue submit

The code that fill the COM menu use the .net framework function SerialPort.GetPortNames() that return a list of the serial port names for the current computer.

https://msdn.microsoft.com/it-it/library/system.io.ports.serialport.getportnames(v=vs.110).aspx

CBPort.BeginUpdate();
CBPort.Items.Clear();
foreach (string portname in System.IO.Ports.SerialPort.GetPortNames())
{
	string purgename = portname;

	//FIX https://github.com/arkypita/LaserGRBL/issues/31
	if (!char.IsDigit(purgename[purgename.Length - 1]))
		purgename = purgename.Substring(0, purgename.Length - 1);

	CBPort.Items.Add(purgename);
}
CBPort.EndUpdate();

As documented the port names are obtained from the system registry (for example, HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM). If the registry contains stale or otherwise incorrect data then the GetPortNames method will return incorrect data.

Furthermore GetPortNames has some known bugs (releted to incorrect data in registry) that produce wrong results, so i have added that "purgename" to remove the last character if it is not a number.

In my opinion you should clean out your HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM registry key.

More info here: #31

@arkypita
Copy link
Owner

BTW: Is it possible to show the descriptive text in addition to the number to make it easier to know which one to pick?

This is a good hint but require me to use a different function to obtain this information because the system function in System.IO.Ports.SerialPort does not give me this informations. I'll get a look if possible by other way

@arkypita arkypita closed this as completed Nov 6, 2018
@arkypita arkypita mentioned this issue Nov 6, 2018
83 tasks
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

No branches or pull requests

3 participants