OctoPrint flashing script for MMU2, MK2, MK3
Even though there is a Firmware Flashing plugin for OctoPrint, I find it a bit annoying that it doesn't allow easy profile switching and on top of that doesn't have support for flashing the MMU2 (could be easily added, but still).
I decided to write a script that takes care of this for you.
In case of the MK3 or MK2, it will disconnect the printer from OctoPrint using the API, flash the printer and then reconnect OctoPrint.
The MMU2 can only be flashed for about 5 seconds after restart (in bootloader stage), so for that I built in a reset detection so you can start the script, go to your printer, reset the MMU2 and it will start flashing after that.
No need to figure out devices and whatnot, the script will take care of that for you.
The syntax is simple: ./flash.sh mk2|mk3|mmu firmware.hex
The script expects to find avrdude and jq installed as it needs them both, there are no other dependencies except that it expects to be ran on raspbian.
The script can be found here.
Installing is a matter of creating the script file on your installation and making it executable. If you don't know how to do that, I advise you to stay away.
XL (5T) / MK4 / MK3S+-MMU3 / MK3S / MK2.5S-MMU2S / Mini / SL1S
Re: OctoPrint flashing script for MMU2, MK2, MK3
Hello steve.g,
thanks for your script. I took some stuff from it for my own script (to which one just gives the download url)
I have one problem left, and hope you may have som insigt:
The Slic3r Flash Tool does two flashes for the einsy in the mk3 and i can't seem to get it working.
This is my bash script snippet code:
csplit "-f$TMPDIR/mainfw" -n1 "$MAINFILE" "/^:00000001FF*/+1"
echo "Flashing main firmware part 1V"
/usr/bin/avrdude -C/etc/avrdude.conf -patmega2560 -cwiring -P/dev/ttyACM0 -b115200 -D -Uflash:w:$TMPDIR/mainfw0:i
echo "Flashing main firmware part 2"
/usr/bin/avrdude -C/etc/avrdude.conf -patmega2560 -carduino -P/dev/ttyACM0 -b115200 -D -Uflash:w:$TMPDIR/mainfw1:i
This is based on this:
https://github.com/prusa3d/Slic3r/blob/master/src/avrdude/fileio.c Line 124 and following
and this:
https://github.com/prusa3d/Slic3r/blob/master/src/slic3r/GUI/FirmwareDialog.cpp Line 486 and following.
Unfortunately the flash of part two does not work. Avrdude is no able to talk to the "arduino" bootloader
RE:
Hi Steve,
While I agree "for those that don't know how to create a script file on your installation they should stay away."
Could you provide a basic instruction or example for the newbies our here that are interested in this project on how to get this up and running?