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

Need to show more COM ports for RS423 #116

Closed
nelgin opened this issue Feb 3, 2023 · 18 comments
Closed

Need to show more COM ports for RS423 #116

nelgin opened this issue Feb 3, 2023 · 18 comments

Comments

@nelgin
Copy link

nelgin commented Feb 3, 2023

I have a lot of devices using COM ports such as the computer's internal serial port, USB serial connections, Arduinos and Micro:Bits and the link. COM1-4 are quickly filled. I just added a new USB modem and it's showing up as COM12. BeebEM either needs to display all COM ports that are in use or allow the user to type the COM port they wish to use (similar to how Putty allows it for serial connections).

Meanwhile, is there a way to bypass the menu and select COM12 via the config file?

@chrisn
Copy link
Collaborator

chrisn commented Feb 4, 2023

Yes, I've been thinking that this needs to be updated. Unfortunately, BeebEm currently can only use COM1 to COM4, putting any other value in the config file won't work.

@nelgin
Copy link
Author

nelgin commented Feb 4, 2023

If i compile my own version, would it be easy enough to change com4 to com12, for example?

@chrisn
Copy link
Collaborator

chrisn commented Feb 4, 2023

To hard code it to use COM12, you can change this line in serial.cpp:

hSerialPort=CreateFile(pnSerialPort,GENERIC_READ|GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_FLAG_OVERLAPPED,0);

to:

hSerialPort=CreateFile("\\\\.\\COM12",GENERIC_READ|GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_FLAG_OVERLAPPED,0);

@nelgin
Copy link
Author

nelgin commented Feb 5, 2023

Perfect. I got this to compile on Windows 10 with VS 2019 with minimal changes and it seems to work, except I have some work to do on my viewdata server. Thanks for that.

chrisn added a commit that referenced this issue Feb 5, 2023
Allow ports other than COM1 to COM4 to be specified. For now, there's
no UI for this, so must be done by editing Preferences.cfg.

Also, the serial port was not being closed in SerialClose()

See #116
@chrisn
Copy link
Collaborator

chrisn commented Feb 5, 2023

I have updated BeebEm so that you can put the COM port name in the Preferences file, e.g:

SerialPort=COM12

The menu still only allows you to select COM1 to COM4 though, but it's a start...

@chrisn
Copy link
Collaborator

chrisn commented Feb 12, 2023

I have changed BeebEm so that, instead of COM1 to COM4, it lists the serial ports that are actually installed. I also rebased the serial-debug branch on top of that change. Would you mind trying this? I'm interested to know if it lists the right serial ports on your system.

@nelgin
Copy link
Author

nelgin commented Feb 13, 2023

Sorry for the delay in getting around to this. I'm now seeing COM1, and 7-10. Those are what are under Com ports in Device Manager also, however there are other com ports not picked up, The USB modem is now on COM4 (I ended up moving it).

@chrisn
Copy link
Collaborator

chrisn commented Feb 13, 2023

Thanks for testing it. This was trying to be too clever, it seems. Just allowing the user to type the port name is probably the way to go.

@nelgin
Copy link
Author

nelgin commented Feb 13, 2023 via email

@nelgin
Copy link
Author

nelgin commented Feb 26, 2023

Any update on this?

@chrisn
Copy link
Collaborator

chrisn commented Feb 26, 2023

I backed out the previous change that enumerates the installed COM ports and am now adding a dialog box where you can type the port name, as well as select the IP address and port, if using the IP232 option. I'll push an update soon.

@chrisn
Copy link
Collaborator

chrisn commented Mar 1, 2023

I have now updated the master and serial-debug branches to add the RS423 config dialog box. Note that I have force-pushed, in case you have any local changes. Please give this a try!

@nelgin
Copy link
Author

nelgin commented Mar 21, 2023

Sorry, been ill and then busy at work. I'll hop back on this over the weekend. Thanks.

@nelgin
Copy link
Author

nelgin commented Apr 9, 2023

I finally got around to try this and it seems to be working ok. Only issue is that it doesn't seem to save the last used COM port and is defaulting to COM4. It may be because I have an old setting in the config?

@chrisn
Copy link
Collaborator

chrisn commented Apr 9, 2023

Thanks! I'll check the config. Note that BeebEm doesn't save the config automatically, only when you select Options -> Save Preferences, or if you tick the Options -> Preference Options -> Autosave All Prefs menu item.

@nelgin
Copy link
Author

nelgin commented Apr 9, 2023

Ah, my bad. I had autosave turned off. Now, I did mention that I'm losing characters, in fact it's stopping in a pretty repeatable place so I'm not sure if it's a handshaking problem where it stops but doesn't start or some odd character that's making it hang. Would you like me to open a new issue for that or carry on here with serial port stuff?

@chrisn
Copy link
Collaborator

chrisn commented Apr 9, 2023

We could use your other issue #117 for the lost characters issue, so this issue is just about selecting the COM ports.

Some of the preferences for the serial port and IP232 have changed, which means that config files saved from the latest BeebEm won't be compatible with 4.18 or earlier versions (e.g., the serial port is now stored as a string instead of a hex number). I don't think this should be a problem, but may affect people who have multiple versions installed, but using the same Documents\BeebEm folder.

@nelgin
Copy link
Author

nelgin commented Apr 9, 2023

I'm using my latest build with the 4.18 install files so not likely to be going back. I suppose this issue can be closed and we can carry on over at 117 then.

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

2 participants