When I press the X button on a RepRap discount LCD, OctoPrint disconnects from the 3D printer.
What did you already try to solve it?
I'm not quite sure if it's realted to OctoPrint or to Marlin. On Marlin 1.1.9, it didn't happen to me.
Since upgradging to Marlin 2.0 (with BIGTREETECH SKR 2) this issue started to occur.
2022-03-05 16:16:10,866 - octoprint.util.comm - ERROR - Unexpected error while reading from serial port
Traceback (most recent call last):
File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/comm.py", line 3940, in _readline
ret = self._serial.readline()
File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/comm.py", line 6605, in readline
c = self.read(1)
File "/home/pi/oprint/lib/python3.7/site-packages/serial/serialposix.py", line 596, in read
'device reports readiness to read but returned no data '
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
2022-03-05 16:16:10,881 - octoprint.util.comm - ERROR - Please see https://faq.octoprint.org/serialerror for possible reasons of this.
2022-03-05 16:16:10,892 - octoprint.util.comm - INFO - Changing monitoring state from "Printing" to "Offline after error"
I assume that this message is because the KILL button shuts off the MCU of the SKR2 and causing a disconnection so this error is presented.
However, I thought about a workaround but not sure if it's possible - is there any GCODE command that can make a connection back to OctoPrint? I was thinking about adding it to the auto0.g file on the SD card, so every-time the printer reboot it will initiate a connection. Is that possible?
If you use it, usually something is going wrong. So disconnecting essential.
No, there isn't a GCODE command to establish a serial/USB connection.
Also, the connection can only be established by the host. In this case OctoPrint.