At work, our only option is to connect our printers via USB to one controlling computer while printing. We have four printers so things can get a bit confusing when they are all printing with four different Cura control windows open . Sometimes, when we want to pause or end a print, it is hard to tell which control window is controlling which printer. Is there some G-code command we can use in the control window that will tell us which serial port (COM1, COM2, etc.) the printer is connected to? We have our serial ports labeled so this would help us out a ton!
The firmware isn’t told the name of the computer’s port, so you won’t be able to get that from a Gcode response.
Someone may have a better suggestion… My first thought would be to modify Cura. Cura obviously knows which port is connected, so you could modify it to display the port name in the window title, along with the existing operational status and temperature values.
Another route might be to recompile and flash unique firmware on each machine, changing something like the “DETAILED_BUILD_VERSION SHORT_BUILD_VERSION” declaration in the Version.h file. This gets reported by the M115 command, so if it included a printer name you could identify the printer by it’s M115 response.
You could also make some insignificant but unique change to a parameter on each printer. For example, if you changed the hundredths digit of a PID value to be 1, 2, 3, or 4… That would not significantly affect control, but would allow you to identify the printer by its response to the M301 query.
I’m curious to see what others suggest, there may be a better way to correlate each Window with the Port it is using.
I have never looked at the Cura code before and I am not a Python programmer, so I have no idea if this is the RIGHT solution or not – and it may even be WRONG in some way. But with that disclaimer, I did find a way to add the port name in the print window which appears to work.
All I did was add two lines of code to the edit the “printWindow.py” file. Here are the lines I added (in bold), with a few surrounding lines for context:
if self._printerConnection.getTemperature(0) is not None:
info += ’ | Temperature: %d ’ % (self._printerConnection.getTemperature(0))
if self._printerConnection.getBedTemperature() > 0:
info += ‘Bed: %d’ % (self._printerConnection.getBedTemperature())
if self._printerConnection.getName() is not None:
info += ’ Port: %s’ % (self._printerConnection.getName())
self.SetTitle(info.replace(’\n’, ', ‘).strip(’, '))
if isPrinting != self._isPrinting:
self._isPrinting = isPrinting
I added it at the end, but obviously you could change the location so it came first, or before the temperatures, if you want.
That results in a print window that looks like this, with the port name shown in the window title:
Appreciate it, thanks! After your first post I asked a coworker to try editing that script and he came up with almost the exact same solution! Works great, thanks for your help!