joakimtoe / KlipperLCD

A simple LCD service that enables the Neptune 3 Pro LCD screen with Klipper
Apache License 2.0
60 stars 9 forks source link

Unable to connect to socket #4

Open Ink81100 opened 6 months ago

Ink81100 commented 6 months ago

When I start main.py I got this error and

Waiting for connect to /home/pi/printer_data/comms/klippy.sock

Unable to connect socket /home/pi/printer_data/comms/klippy.sock [2,ENOENT]

Unexpected data received: 0x1a
Unexpected data received: 0xff
Unexpected data received: 0xff
Unexpected data received: 0xff

I chech and I have klippy enable:

cat ~/printer_data/systemd/klipper.env
KLIPPER_ARGS="/home/ink/klipper/klippy/klippy.py /home/ink/printer_data/config/printer.cfg -l /home/ink/printer_data/logs/klippy.log -I /home/ink/printer_data/comms/klippy.serial -a /home/ink/printer_data/comms/klippy.sock"
1coderookie commented 6 months ago

Seems like you need to adjust the path as your username isn't pi but ink.
Right now it's
/home/pi/printer_data/comms/klippy.sock
while your path is
/home/ink/printer_data/comms/klippy.sock

VNBYT commented 5 months ago

Greetings!

When trying to run main.py I get the following errors:

I use a USB to UART adapter for connection

orangepi@orangepizero3:~/KlipperLCD$ python3 main.py
Traceback (most recent call last):
  File "/home/orangepi/KlipperLCD/main.py", line 8, in <module>
    from printer import PrinterData
  File "/home/orangepi/KlipperLCD/printer.py", line 7, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

main.py has been edited according to instructions

 self.lcd = LCD("/dev/ttyUSB1", callback=self.lcd_callback)
        self.lcd.start()
        self.printer = PrinterData('XXXXXX', URL=("127.0.0.1"), klippy_sock='/home/orangepi/printer_data/comms/klippy.sock', callback=self.printer_callback)

Klipper API:

orangepi@orangepizero3:~$   cat ~/printer_data/systemd/klipper.env
KLIPPER_ARGS="/home/orangepi/klipper/klippy/klippy.py /home/orangepi/printer_data/config/printer.cfg -I /home/orangepi/printer_data/comm                                 s/klippy.serial -l /home/orangepi/printer_data/logs/klippy.log -a /home/orangepi/printer_data/comms/klippy.sock"orangepi@orangepizero3:~   

also unusual things when installing:

orangepi@orangepizero3:~$ pip install pyserial
Collecting pyserial
  Downloading pyserial-3.5-py2.py3-none-any.whl (90 kB)
     |████████████████████████████████| 90 kB 818 kB/s
Installing collected packages: pyserial
  WARNING: The scripts pyserial-miniterm and pyserial-ports are installed in '/home/orangepi/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pyserial-3.5

I apologize in advance for my poor knowledge of linux and programming. I hope my problem will be solved:) Thanks.

1coderookie commented 5 months ago

@VNBYT

ModuleNotFoundError: No module named 'requests'

I had the same problem, you need to install the missing module, see here: https://github.com/joakimtoe/KlipperLCD/issues/3

VNBYT commented 5 months ago

HI! Thanks to your help I managed to start the screen, but only once. After rebooting and trying to run main.py, the web interface reports an error and the screen won't run any further image

orangepi@orangepizero3:~/KlipperLCD$ python3 main.py
Traceback (most recent call last):
  File "/home/orangepi/.local/lib/python3.9/site-packages/serial/serialposix.py"                                                                                         , line 322, in open
    self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
FileNotFoundError: [Errno 2] No such file or directory: '/dev/ttyUSB1'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/orangepi/KlipperLCD/main.py", line 224, in <module>
    x = KlipperLCD()
  File "/home/orangepi/KlipperLCD/main.py", line 14, in __init__
    self.lcd.start()
  File "/home/orangepi/KlipperLCD/lcd.py", line 193, in start
    self.ser.open()
  File "/home/orangepi/.local/lib/python3.9/site-packages/serial/serialposix.py"                                                                                         , line 325, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._p                                                                                         ort, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyUSB1: [                                                                                         Errno 2] No such file or directory: '/dev/ttyUSB1'
orangepi@orangepizero3:~/KlipperLCD$ nano main.py
orangepi@orangepizero3:~/KlipperLCD$ python3 main.py
http://127.0.0.1:80
Waiting for connect to /home/orangepi/printer_data/comms/klippy.sock

Connection.

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.9/threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "/home/orangepi/KlipperLCD/lcd.py", line 425, in run
    incomingByte = self.ser.read(1)
  File "/home/orangepi/.local/lib/python3.9/site-packages/serial/serialposix.py", line 595, in read
    raise SerialException(
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
Web site exists
235x235x280
v0.12.0-10
KlipperLCD start
Printer state: standby

Can you help me solve this problem? Thank you for your patience!

1coderookie commented 5 months ago

FileNotFoundError: [Errno 2] No such file or directory: '/dev/ttyUSB1'

Hmm, I'm not 100% sure, but it seems like the path to your printer in the [mcu] section of your printer.cfg might be wrong and therefore the host can't connect to the machine. You could also have a look at the klippy.log and see what it says there.
If you didn't do so, try to use serial-by-id, like this:

[mcu]
serial: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0

-> but of course the usb-1a86_USB_Serial-if00-port0 here has to match your setup. See here: https://www.klipper3d.org/FAQ.html#wheres-my-serial-port