New here and to Klipper. I started converting an old printer (Monoprice Maker Ultimate) to use Klipper and want to do a bit of development. I have programming experience, but not much in the embedded world. I’m looking for advice on how to start doing some Klipper development. I read through the developer documentation, but it wasn’t what I needed.
Thoughts on an IDE, or how to go about coding without plugging a keyboard/monitor into the RPi? VSCode + Remote SSH plugin?
Tips for quickly being able to test new python code? For example, it took a very long time to figure out that I had to delete the cached files for my changes to be reflected. (I’m all C++, in the process of learning Python). Feels like I am maybe missing something fundamental, like a “developer mode”.
Tips on logging/debugging? I’m sure for an experienced user, the log files are great. I end up with a MASSIVE log file after a while, where 99.99% of the information is irrelevant. Lets say I just want to log a couple variables, and the time they occurred…is there a good way to do that? Is there a way to restart a log file?
Any information on the underlying structure of klipper? I have many questions about this. For now, I’m just trying to understand how information flows. Say I add a module. Take the heater.py module, for example. From where is that called? How often? Is it a fixed rate? Can I change the rate? How can I obtain information about the state of the machine? etc.
I understand these may seem like silly questions, but overall I’m just struggling to get started. I’m working to improve my understanding, but I’m hoping for a (big) push in the right direction. Any help and general advice is appreciated!
First and foremost, it’s less “need” and more “want” and “interested”. I’d love to learn and contribute. I am indeed very new to Klipper, but that doesn’t mean I don’t want to learn.
In terms of what kind of development I want to do, first on the docket is the heater code. Will it ever make it to a pull request? Maybe not. Is it necessary in order to get my setup running? Nope. Would I love to implement a controller other than PID? Absolutely.
Really the goal is to learn. With any luck, I’ll eventually be able to give back to the community in some small way. Even if that’s building a better understanding to be a more qualified reviewer for pull requests.
Got it, I’ll have to take a look. I’m on windows (for now…) so I may have to find an alternative to rsync.
I am curious, though. When I change Python code (using nano, for example) and restart Klipper (using Fluidd, not in the terminal), it does not pick up the new code. I have to use the terminal to stop klipper, delete the Python cache, and start klipper again. Is that normal?
That looks extremely helpful. I kept thinking “if only there were a ‘hello world’ equivalent to get started,” and that’s it! I guess I didn’t realize there was a klipper vs klippy, either. I’d suppose that for now I’m trying to play with klippy. Eventually I want to get into klipper, too, though.
If you restart the klippers service it will automatically rebuild the cache on startup. Once you have passwordless SSH access set up you can run a command on the development machine to do this remotely:
ssh pi@your-printer.local 'sudo service klipper restart'
My “ + Deploy & Restart Klipper” chains together deploying the config, deploying the code, wiping the log file and restarting the klipper service. Saves hours of wasted time.