Klipper Firmware integration
Hi everyone,
I wanted to ask you if it was possible to insert the possibility to perform Klipper firmware updates directly from the repetier server web interface as other systems such as https://github.com/cadriel/fluidd or MainsailOS do now.
it would also be very useful to modify the firmware parameters in the printer.cfg file directly from repetier server.
I hope you can add these things in the next versions of repetier server to keep it up to date with the new firmware. Thanks so much.
I wanted to ask you if it was possible to insert the possibility to perform Klipper firmware updates directly from the repetier server web interface as other systems such as https://github.com/cadriel/fluidd or MainsailOS do now.
it would also be very useful to modify the firmware parameters in the printer.cfg file directly from repetier server.
I hope you can add these things in the next versions of repetier server to keep it up to date with the new firmware. Thanks so much.
Have a good day
Lorenzo
Comments
Furthermore there is no possibility to edit the printer.cfg inside Repetier Server, a request already made by me for some time, thing possible with MainsailOS and Octoprint (open source, so free frontend).
For updating you could make a script called by extcommands.xml that executes the update. Just for editing I'm not sure how to solve. Maybe making some extra xml to edit some scripts and run commands on safe. Then also other files could be edited. But that still leaves the permission problem open.
The problem remains that only Repetier Server cannot do it, and it is the only paid product of those mentioned above.
This should make him more powerful than the others.
My two cents...
Nothing appears here in the "Klipper Configuration" drop-down menu, it is empty.
Roland, if you need a beta tester for the next versions I can help you, at least with Klipper that I have always used.
After running the update command this came out:
Failed to open /dev/tty: No such device or address
But anyway my printers with Klipper still work anyway.
https://cln.sh/9vIqma
When you add a new printer with wizard and select Klipper as firmware it offers to install klipper for that installation. Afterwards it appears in your printer with empty config. You add it and save and save and restart klipper. Only thing you need to do manually is upload the firmware stub to your printer.
Documentation about klipper install and what to do is in manual in chapter "Printer Configuration" at the end.
Can you make a screenshot of what you consider "empty" or describe compared to my image. WIth old existing klipper install it of course does not contain any configurations. You must install with server or we have permission issues and don't know how to handle it. Only installations configured our way are editable and restartable in server.
https://postimg.cc/75pKKGYF
If I already use many printers with Klipper I don't understand why I should delete their configuration and recreate them, as well as being full of groups and gcodes.
I also tried to recreate the klipper.service service but it doesn't change anything.
If it is a question of permissions tell me how to act to resolve.
sudo -u repetierserver touch /var/lib/Repetier-Server/database/klipper/slug.cfg
with slug.cfg replaced by slug name of the printer.
Then go to klipper config scree again and you should see it. Now copy your klipper configuration into this, stop or uninstall old version and hit install button. Then you get same config with new klipper installation but manageable within repetier-server. This all only works when installs are in well defined folders. We also add a service that starts automatically on bootup.
Here the part from docs about where what gets stored with whom as owner:
Klipper
Klipper is a printer firmware with a special twist. The firmware is split into two parts. A small part resides inside the printer and the bigger part is a daemon running on the same pc as the server. So to use any printer with Klipper, you need to install the Klipper daemon and configure it so it is accessible from server.
Repetier-Server greatly minifies the required work. Already during installation with the printer wizard, you get offered to install the klipper daemon. You should always do this, even if you do not have a configuration yet. The instance must have the same name as the printer slug, so we can detect it correctly and can offer configuration with the server.
When you installed the daemon successfully, you get the following files and directories, where we assume that the printer slug name was MyKlipper:
In case your printer has no klipper stub matching the current version you need to create and upload that first. Please follow our instructions, which are adjusted to our installation method. First login to the pc via ssh.
When you do the installation you need to become root first and cd to our installation path. Then you configure the printer board and compile the binary.
The last command creates the required binary that needs to be installed on the printer board. For some you can just flash it to the connected printer, others require that you copy the file to a sd card on the printer and then reset the printer.
For the direct upload you need to know the serial port. This is not the one you entered in Repetier-Server! In Repetier-Server you set the virtual port that connects to the klipper daemon, while here you need the serial port of the printer. Enter
ls -l /dev/serial/by-id/*
to get a list of currently connected serial devices. If you are unsure which one is the correct one, disconnect the other devices. Once you know the path, run the following commands (remember we again use the MyKlipper placeholder for your printer slug):Now the printer stub is on your printer and Klipper can connect, but nothing will happen. The configuration file is empty. Switch to the Repetier-Server gui and select inside the printer menu Klipper Configuration. Here you see by default the configuration associated with the printer, but in the dropdown you can switch between them. For the active printer configuration you will also see options to install/uninstall/restart Klipper. And everytime you save the configuration, it will restart printer with new settings. So now you can edit your configuration according to the Klipper documentation and activate it directly. The editor uses highlighting to better show which parts are comments, sections, options and associated gcodes. For sections and options it has a autocomplete function to help you to write the right syntax.
In the installation directory in the config subdirectory you will find a lot of sample configurations. A easy way to copy it is to run
cat config/filename.cfg
and copy the shown configuration with copy and paste into the editor.Multiple Klipper Installations
Our solution is not limited to one installation, so there is no difference in installing one or two or three instances. Only the CPU power and RAM are the limit.
It would have been better if he leaned on standard path, i mean for klipper installation (the default is /home/pi/klipper and not /opt/klipper) and the various cfg, however better this way than nothing.
And to update Klipper? I only see Install and Uninstall.
Klipper you know it can work with multiple files in the configuration, did you expect that? That is, the cfg master can rely on other cfg ([include]), many for example keep all the macros in another file that must be recalled from the cfg master. From the server interface I understand that only the main cfg can be edited.
Once that operation is done, that is, I see the cfg I copied and pasted, I can't find INSTALL or UNINSTALL button anywhere, and before i removed Klipper from the system.
I only see "Cancel, Save As and Save configuration".
For testing just stop your old klipper service - no need to delete it for that. Just note that on reboot prbably both will start so connection will fail as both use same serial.
OK, from the url I see that printer is called Sapphire_Plus and I had omitted the underscore in the slug.
Another interesting thing for Klipper would be to have a menu to invoke the macros included in the cfg, it would be very useful.
For example I use this by invoking it from Octoprint with one of the various plugins available, and it flashes the board without any problem.
You know well that installing Klipper without flashing the board is useless, so it takes something to be able to do it without going to the shell, even if the make menuconfig is mandatory at least once, and obviously you can't do it from Repetier Server.
#!/bin/bash
sudo service klipper stop
cd /home/pi/klipper
git fetch --prune origin
git reset --hard origin/master
git clean -f -d
make clean
make
./scripts/flash-sdcard.sh /dev/ttyACM0 btt-skr-pro-v1.2
sudo service klipper start
Ok, found now, it is still in /tmp but with the name of the printer, good!
The only thing I don't like is the constant accesses to the virtual port file during any print, the life of the MicroSd in this way falls brutally.
Before being in /tmp I had ramdisk on for that folder, and it's not a good thing that it's now in /var/lib/klipper/sockets for that reason.
It would therefore be useful if the printer log and virtual port were in the same folder.
That is a os socket - why do you think it does write anything to disk? unix sockets and TCP/IP sockets also don't do that. And actually klipper puts only the link there - the real file is always in /dev/pts which is not even a physical filesystem - just mapped from linux. So all that happens is that klipper adds a link at connection, or do I miss something.
Flashing the printer is a bit of a problem. There are several solutions and some include copying a compiled bin file to sd card and reinsert it. Will think about that - at least creating the bin file and offer a download might be an option, but you still have to login to configure klipper for the correct board and some extra options before you can compile. And that might change between klipper version so might make any server side solution invalid.
SKR Pro for example through a very clever script creates a virtual socket on the board MicroSD, copies the bin and performs a reset, Klipper flashed.
Boards based on ArduinoDue also flash directly.
Flashing /opt/klipper/Sapphire_Plus/out/klipper.bin to /dev/ttyACM0
./scripts/flash-sdcard.sh: line 85: /root/klippy-env/bin/python: No such file or directory
So I go back to non-integration, at the most convenient at the moment imho.
Editing the printer.cfg with WinSCP is not dramatic.
Fluidd and Mainsail, but also Octoprint do not have these limitations as they work inside the user folder, so anything is possible.
The idea of having a Klipper folder for each printer is not bad, but it would have to stay inside the user folder to skip all the limits of having to use root.