Update to newer Klipper
Hi ! Thanks again for your great work on this, I use it every day with my Ender 6 and I'd love for this project to remain active ! Would you be able to merge this with a more recent version of Klipper ? Thanks a lot !
@ale-chronics
@ale-chronics, you might find the attached bash script helpful. I've been using it for the past two years to keep my Klipper installation updated with the original Klipper while maintaining the Ender 6 patches from Desuuuu.
Just run the script in the directory where your ./klipper/ is located. (Make sure you have a backup of your Klipper folder first.)
Also, remember that newer versions of Klipper may require updated firmware on the controller: ( cd klipper; make clean; make (might require make menuconfig, to update the .config file )
bash script :
#!/bin/bash
if [ ! -d klipper/.git ]; then
git clone https://github.com/Klipper3d/klipper.git klipper
else
echo "Klipper exists .."
fi
pushd klipper
if ( git branch | grep desuuuu-ender6 -q ); then
git switch desuuuu-ender6
else
git branch desuuuu-ender6
git checkout desuuuu-ender6
fi
GIT_EDITOR=/bin/true git pull https://github.com/Klipper3d/klipper.git
GIT_EDITOR=/bin/true git pull -q -X ours --no-rebase https://github.com/Desuuuu/klipper.git
popd
@xdadrm Will this work for CR10s pro. I have desuuuu's klipper installed on my board, rpi and the screen. Can you guide me how to update it? Would be a great help as I am thinking to install eddy probe which is only supported with mainline klipper + I can keep my klipper updated. Thanks
I recently wrote this guide for installing upstream Klipper on an Ender 6. It just requires changing out the touchscreen: https://github.com/zimmertr/Ender-6-Klipper-Guide
@xdadrm Will this work for CR10s pro. I have desuuuu's klipper installed on my board, rpi and the screen. Can you guide me how to update it? Would be a great help as I am thinking to install eddy probe which is only supported with mainline klipper + I can keep my klipper updated. Thanks
@nipunarora8 As I do not have a CR10, I'll not say "it works and here's how" ...hope the following still helps :
Klipper Software All the script above does it transfer desuuuu's patches into upstream klipper and I use that rather regularly to upgrade my installation. So as long you can get your original klipper directory back, there is little you can break by just trying (a recent backup is always a good idea anyway).
Klipper Firmware on the MCU Now that is a little trickier, if you're already on a 0.12 version (check klippy*logs for "Last MCU build version: v0.12.0"), if it is lower on your MCU, communication between Klipper and the MCU will probably not work after the first step. enter the klipper directory, copy .config from your old klipper directory if you started fresh, and try "make clean; make". If you get errors, run "make menuconfig" to update .config with new options, usually going with the defaults is ok. Once the firmware compiles, use out/klipper.bin to upgrade your CR10 MCU, via SDCard. (also here, having your original .bin file available would allow you to downgrade back to where you have been.)
Display I do not recall having had to upgrade the display after the initial conversion, so that should continue to work as is.
@zimmertr A nice, well put together guide ! @nipunarora8 appears to not be using a PI Display but the patched original Creality Display.
@xdadrm after adding the [t5uid1] section to printer.cfg (using your script), mainsail gives me an MCU Protocol error saying "mcu 'mcu': Unknown command: t5uid1_ping" at the end (and the screen stays on the klipper logo). could you please guide me in the right direction? I'm still new to klipper. once i remove the [t5uid1] section it doesn't give me an error anymore (but the screen still doesn't work).
@chirrupted if you had to add the [t5uid1[ section to your config that sounds like you were NOT running desuuuu's klipper on your setup before ?!
**If that is the case, do not continue, revert back to your old klipper installation and look at @zimmertr 's approach. **
If you want to contine (and I don't know if the CR10s pro is the same as the Ender 6 - MCU and Display wise ..) :
The error sounds like your MCU firmware is not up-to-date - you could check with "grep T5 klipper/.config" it should look like this :
CONFIG_T5UID1_SERIAL=y CONFIG_STM32_T5UID1_SERIAL_USART3=y CONFIG_STM32_T5UID1_SERIAL_USART3_PB11_PB10=y
if it is not, use make menuconfig to change the settings, make and then reflash the mcu with the new compiled binary.
@xdadrm I use an Ender 5 Plus. anyways, I got it to work (just forgot to flash to the printer :P) however I can't click on the Move button and retracting and advancing filament doesn't work. when printing, the screen doesn't change either (stays on homescreen). before using the script everything worked.
@chirrupted Hah, you got me there I've got you mixed up with @nipunarora8 :)
Anyway, glad it 'semi-worked' for you - from your description, I can only imagine that these might be incorrect for your machine / MCU,
CONFIG_STM32_T5UID1_SERIAL_USART3=y CONFIG_STM32_T5UID1_SERIAL_USART3_PB11_PB10=y
@xdadrm thanks! though i think I'll be using an android phone instead :P sorry for wasting your time
@xdadrm Thank you for your ideas. CR10s pro has the same screen as the ender 6 (I guess). And if I am not wrong, desuuuu also has Cr10s pro (because it was his config which I took while setting up klipper). I will implement your ideas on my printer but I am very busy until the weekend. Will keep you updated. Thanks
Hey @xdadrm, I seem to use your script but no success. I put your script next to klipper folder, ran it, two scripts were having conflicts (src/atsamd/serial.c and src/atsamd/Kconfig) so I used the new version. The make and flashing went without errors. For flashing it generated a .elf file which I flashed using make flash FLASH_DEVICE=serial port
Now my klipper version in mainsail says klipper -> v0.0.0-4766-gdgus-reloaded-230526-0-gbaae7f3a-dirty-inferred
and I can't connect to mcu cuz I have an error gcode command SET_PRINT_STATS_INFO already registered I commented this line in mainsail.cfg too, but still not luck.
Do you have an idea what can I do to make it work? Thanks
@nipunarora8 there should be no conflict, you can try moving your klipper directory to kipper.broken, and run the script again - that will pull mainline klipper and merge desuuuu's patches in and likely resolve the merge conflict as well as the SET_PRINT_STATS_INFO error.
( The script is 'dumb' and rather forcefully simply merges the two repositories together - often good enough but not failsafe )
Then, best copy your original .config (or kipper.broken/.config) to klipper/.config , rebuild and flash the firmware to be sure to have that match the klipper software.
Good luck !
Looking for SET_PRINT_STATS_INFO in the klipper source shows that it is only used in a single file: klippy/extras/print_stats.py
find . -type f -exec grep -l SET_PRINT_STATS_INFO {} +
./docs/Status_Reference.md ./docs/G-Codes.md ./klippy/extras/print_stats.py ./klippy/extras/pycache/print_stats.cpython-310.pyc
@xdadrm It worked, thank you soo much.
The SET_PRINT_STATS_INFO was basically a problem because of mainsail.cfg. I updated mainsail and things went smooth. The screen is also working fine as of now, but I will still check if it has any problems.
Thank's for helping. :)
@nipunarora8 great to hear, thanks for the feedback !
@xdadrm
bash script : #!/bin/bash if [ ! -d klipper/.git ]; then git clone https://github.com/Klipper3d/klipper.git klipper else echo "Klipper exists .." fi pushd klipper if ( git branch | grep desuuuu-ender6 -q ); then git switch desuuuu-ender6 else git branch desuuuu-ender6 git checkout desuuuu-ender6 fi GIT_EDITOR=/bin/true git pull https://github.com/Klipper3d/klipper.git GIT_EDITOR=/bin/true git pull -q -X ours --no-rebase https://github.com/Desuuuu/klipper.git popd
I did update to latest with your script, script works ok and also no errors when building... But after flashing new firmware, move (middle) button, and some buttons in setup are not working. Anyone with same problems?
My printer is Cr10sPro, with latest Desuuuu version of klipper screen was working Ok.
@brumela first thing might be to try and start fresh, the script is 'dumb' and rather forcefully simply merges the two repositories together - often good enough but not failsafe.
Try moving your klipper directory to kipper.broken, and run the script again - that will pull mainline klipper and merge desuuuu's patches in. Then, best copy your original .config (or kipper.broken/.config) to klipper/.config , rebuild and flash the firmware to be sure to have that match the klipper software.
@xdadrm Thank you for the script. I used it and it works great.
I am wondering if someone with the knowledge maybe could setup new repository that will be updated for the others that are not so skilled? :)
@xdadrm Thank you for the script. I used it and it works great.
I am wondering if someone with the knowledge maybe could setup new repository that will be updated for the others that are not so skilled? :)
@tssk , @Desuuuu , @brumela
I gave this a shot and set up a fork that should sync desuuuu's patches with upstream klipper every tuesday (if there were changes). We'll see if and how that works in reality.
I gave this a shot and set up a fork that should sync desuuuu's patches with upstream klipper every tuesday (if there were changes). We'll see if and how that works in reality.
Thanks. Fork syncing is based on your script? If so, I doubt that will work in my machine CR10s PRO.
Well, I also try to merge (sync) desuuuu's branch with upstream klipper, following this guide, but didn't succeed. What I notice is that sync with v0.12.0 works, but with latest doesn't. So, I guess latest changes brakes desuuuu's code. I also examine merged changes, made manual merge, didn't succeed.
But I will definitely try to build from your synced repo and report back.
@brumela if my script from above did not work, then this repo will unfortunately not work for you either - the code in both directories (from the script and from this repo ) would be exactly the same.
When you tried the merge yourself, you likely encountered a few conflicts that my script rather forcibly resolves and while that works in my situation, might have negative effects for your case.
I'll have a look to check if there might be anything 'obvious' ..
@brumela
I might have something - you're using the atmega2560 (and #160 seems be similar for the same mcu) , so I looked for changes in that area.
( after re-checking; I might be wrong. after running make menuconfig , .config always contains CONFIG_WANT_GPIO_BITBANGING=y )
Try adding this at line 13 of src/avr/Kconfig - right after select HAVE_STRICT_TIMING
select HAVE_STRICT_TIMING
select HAVE_GPIO_BITBANGING if !MACH_atmega168
and rebuild/flash the firmware on the mcu. (make menuconfig, make clean, make ..)
--- why ? --- Attempting to merge desuuuu with klipper shows the following intersting changes :
CONFLICT (content): Merge conflict in src/atsamd/Kconfig
CONFLICT (content): Merge conflict in src/atsamd/serial.c
Auto-merging src/avr/Kconfig
For the atmega2560, the two atsamd files should not be relevant, but src/avr/Kconfig is. Looking at changes there we see that HAVE_GPIO_BITBANGING has been removed :
> select HAVE_GPIO_BITBANGING if !MACH_atmega168
14d14
< select HAVE_LIMITED_CODE_SIZE if MACH_atmega168 || MACH_atmega328 || MACH_atmega328p || MACH_atmega32u4
150a151,152
>
> source "src/avr/t5uid1/Kconfig"
@brumela If all else fails, the following might help pinpoint the commit (or at least date range) where the problem started with, with that information we might be able to fix the problem. Tedious.
# Start with Desuuuu klipper
git clone https://github.com/Desuuuu/klipper.git klipper
pushd klipper
git remote add upstream https://github.com/Klipper3d/klipper.git
git fetch upstream
# git checkout origin/dgus-reloaded
# This first ones hould not change anything ( https://github.com/Klipper3d/klipper/commits/master/ - Aug 25, 2022 - the last klipper commit that made it into Desuuuu's repo. )
git merge -X ours f7e29b276e5c2454eaa801e78cf3f6aff29c4ba9 -m "starting point"
git diff HEAD..origin/HEAD > ../diff_start.txt
### make clean, make menuconfig, make, flash .. and test
git merge -X ours v0.11.0 -m "v0.11.0"
git diff HEAD..origin/HEAD > ../diff_start-v0.11.0.txt
### make clean, make menuconfig, make, flash .. and test
git merge -X ours v0.12.0 -m "v0.12.0"
git diff HEAD..origin/HEAD > ../diff_start-v0.12.0.txt
### make clean, make menuconfig, make, flash .. and test
git merge -X ours upstream/master -m "master"
git diff HEAD..origin/HEAD > ../diff_start-master.txt
### make clean, make menuconfig, make, flash .. and test
Once we know at which release it stops working, we can use this to get back to that starting point and then the git merge -X ours
git reset --hard f7e29b276e5c2454eaa801e78cf3f6aff29c4ba9
git merge -X [commit-hash] -m "my message"
### make clean, make menuconfig, make, flash .. and test
I gave this a shot and set up a fork that should sync desuuuu's patches with upstream klipper every tuesday (if there were changes). We'll see if and how that works in reality.
As expected code from your repo didn't work.
@brumela
I might have something - you're using the atmega2560 (and #160 seems be similar for the same mcu) , so I looked for changes in that area.
( after re-checking; I might be wrong. after running make menuconfig , .config always contains CONFIG_WANT_GPIO_BITBANGING=y )
Try adding this at line 13 of src/avr/Kconfig - right after select HAVE_STRICT_TIMING
select HAVE_STRICT_TIMING select HAVE_GPIO_BITBANGING if !MACH_atmega168and rebuild/flash the firmware on the mcu. (make menuconfig, make clean, make ..)
--- why ? --- Attempting to merge desuuuu with klipper shows the following intersting changes :
CONFLICT (content): Merge conflict in src/atsamd/Kconfig CONFLICT (content): Merge conflict in src/atsamd/serial.c Auto-merging src/avr/KconfigFor the atmega2560, the two atsamd files should not be relevant, but src/avr/Kconfig is. Looking at changes there we see that HAVE_GPIO_BITBANGING has been removed :
> select HAVE_GPIO_BITBANGING if !MACH_atmega168 14d14 < select HAVE_LIMITED_CODE_SIZE if MACH_atmega168 || MACH_atmega328 || MACH_atmega328p || MACH_atmega32u4 150a151,152 > > source "src/avr/t5uid1/Kconfig"
Also didn't work.
I see this error when Move button is pressed, printer_data/logs/klippy.log
Error evaluating 't5uid1_routine __move:script': AttributeError: 'BLTouchProbe' object has no attribute 'multi_probe_pending' Traceback (most recent call last): File "/home/brumela/klipper-Desuuuu-patch/klippy/extras/gcode_macro.py", line 61, in render return str(self.template.render(context)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/brumela/klippy-env/lib/python3.11/site-packages/jinja2/environment.py", line 1090, in render self.environment.handle_exception() File "/home/brumela/klippy-env/lib/python3.11/site-packages/jinja2/environment.py", line 832, in handle_exception reraise(*rewrite_traceback_stack(source=source)) File "/home/brumela/klippy-env/lib/python3.11/site-packages/jinja2/_compat.py", line 28, in reraise raise value.with_traceback(tb) File "<template>", line 2, in <module> File "/home/brumela/klipper-Desuuuu-patch/klippy/extras/t5uid1/t5uid1.py", line 866, in is_busy return (self.probe is not None and self.probe.multi_probe_pending) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'BLTouchProbe' object has no attribute 'multi_probe_pending' Error evaluating 't5uid1_var __switch_page:script': gcode.CommandError: Error evaluating 't5uid1_routine __move:script': AttributeError: 'BLTouchProbe' object has no attribute 'multi_probe_pending'
After some searching I found this file klippy\extras\probe.py was problematic, so I also try to fix it but no success... If I find some time will try this 2592833930 as you suggested and yes Tedious... Anyway thanks for suggestions.
Ah that's good - that looks ike it's only in the python code, not the mcu firmware , so easier to fiddle with :)
As a very first guess - try using klippy/extras/bltouch.py from upstream klipper ..
@brumela I've made a change to xdadrm/klipper-Desuuuu-patch) in t5uid1/t5uid1.py
that should fix your problem. Line 866 : return (self.probe is not None and self.probe.multi != "OFF")
@brumela I've made a change to xdadrm/klipper-Desuuuu-patch) in t5uid1/t5uid1.py
that should fix your problem. Line 866 : return (self.probe is not None and self.probe.multi != "OFF")
Thanks @xdadrm, I can confirm Move button and also Settings > Leveling button are working after this fix.
@xdadrm On more question, is "Screen status" working during printing with this fork? It worked for me till v0.12.0.