Closed nelgin closed 8 months ago
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.
If i compile my own version, would it be easy enough to change com4 to com12, for example?
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);
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.
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...
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.
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).
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.
That’s a good option and what putty and SyncTerm use (both terminal clients for the PC).
You’d have to go through all the devices and see what are hooked to COM* otherwise if you want to pick up modems, com0com devices and the like. Unfortunately USB modems don’t register as a port but they consume one.
Any update on this?
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.
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!
Sorry, been ill and then busy at work. I'll hop back on this over the weekend. Thanks.
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?
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.
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?
We could use your other issue https://github.com/stardot/beebem-windows/issues/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.
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.
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?