I've succesfully installed klipper on my old phone LG G4 with Lineage OS 16.0. If you haven't read other posts, lease read them, cause i'm assuming you already accomplished the tasks below:
Prerequisites
- Android with printer serial driver installed (ch341 serial driver for Ender3 Pro).
- Debian Buster installed on Android (using Linux Deploy, check my post )
- Updated "sources.list" file
- Always on phone (Check my other posts for an always on phone
Setting Klippy-Env Python Version
Python version with Debian buster is 2.7.16 which is ok for Klipper. We just need to install "virtualenv" with "apt". It is possible to install with "pip" but you will have problems with dependencies. use "apt"!
sudo apt install virtualenv
Klipper creates a "klippy-env" folder when installing it, so creating a virtual-env and changing python version in advance helps overcoming problems:
mkdir /home/pi/klippy-env
virtualenv klippy-env
sudo apt-get install libffi-dev
sudo apt-get install git
source /home/pi/klippy-env/bin/activate
Check python and pip version inside virtualenv (python 2.7.16, pip 20.x)
python --versionpip install --upgrade "pip < 21.0" pip install --upgrade setuptoolspip install greenletpip install cffipip install pyserial
Installing Klipper
You could now start installing klipper (exit virtualenv first)
deactivategit clone https://github.com/KevinOConnor/klipper
You need to start installing using klipper scripts (Which is standard installation of klipper).
/home/pi/klipper/scripts/install-octopi.sh
Klipper Configuration File
In service start file we show printer.cfg file location in /home/pi. Copy the sample config file to "/home/pi/printer.cfg" and make it readable by any user so that octoprint can read it
cp /home/pi/klipper/config/printer-creality-ender3-2018.cfg /home/pi/printer.cfg chmod 777 /home/pi/printer.cfg
Enable virtual-sdcard from scratch so that you could start printing from lcd screen, and it works faster since klipper is directly sending commands not octoprint to klipper and klipper to printer.
You are still not ready to start klipper, next action is compiling:
Compiling Klipper for Mainboard
If you can not succeed compiling klipper on a phone, you could do it on a linux and then you could copy the "klipper" folder to your phone. If you don't compile it you won't have the necessary dictionaries etc. and you will have problems. In my case it seems like it was working but when i checked "/tmp/klippy.log", i saw errors of missing build.dict logs.
You need to compile klipper according to your printer board, which for my case ATMEGA 1284P 16Mhz for Ender3 Pro standart board (not the quiet one)
cd /home/pi/klipper/
make menuconfig
then you need to "make":
So if everything up to here is successful, start klipper and check for logs whether it works without any warning logs etc. Below commands clear log file, restart klipper and check it's status and log files:
pi@localhost:~/klipper$ sudo rm -rf /tmp/*
pi@localhost:~/klipper$ sudo service klipper restart
Restarting klipper: klipperStopping klipper: klipper.
Starting klipper: klipper.
pi@localhost:~/klipper$ sudo service klipper status
pi@localhost:~/klipper$ cat /tmp/klippy.log
Binding Octoprint to Klipper
Before changing the firmware of your board we need to be sure of 2 things:
- klipper and octoprint services are running (above)
- Octoprint is connected to klipper
So you need to bind octoprint to klipper as explained in the page below:
Next action is changing firmware of your printer and if klipper & octoprint does not work you will loose time either finding the problem or converting your printer back to Marlin.
Flashing Firmware to Mainboard
To flash klipper to printer, you need determine the serial connnected port by its id. First determine the id:
ls /dev/serial/by-id/*
It should report something similar to the following:
/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0
You can then flash klipper to printer.
make flash FLASH_DEVICE=/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0
After flashing, connect your phone (Which klipper is active), and then restart klipper service.
Fixing Permissions
If you found out in klipper log that "ttyusb0" permission denied, you need to give permission like below:
sudo su
cd /
cd dev
chown pi ttyUSB0
- Remove symlink protection (it is not possible in this debian version unfortunately)
Temporary Files
If temporary files uses too much space, at the end your 4gb image could fill and octoprint/klipper might stop working. Keep an eye on the octoprint main page, under upload file menu you could see the.
Folders you need to erase are:
- /home/pi/.octoprint/logs/*
- /tmp/*
- /var/log/*
PYTHON SCRIPT
I created a python script that clears all log files, restarts klipper and then change the permission of "/tmp/printer" links. ("sudo nano /home/pi/printer.py")
import os,time
os.system(r'rm -rf /var/log/*')
print r'/var/log cleaned'
os.system(r'rm -rf /tmp/*')
print r'/tmp cleaned'
os.system (r'rm -rf /home/pi/.octoprint/logs/*')
print 'octoprint logs cleaned'
os.system (r'service klipper restart')
print 'klipper service restarted'
time.sleep(2)
os.system(r'sudo chmod a=rwX /tmp/printer')
print 'klipper tmp-printer chmod changed'
Then add a system button to restart klipper by using "system command editor" plugin.
0 comments:
Post a Comment