Well, this is just my little journey in 2020th second lock down.
By default I use my main printers, namely an “Anet A8” and a “TronXY X5” remotely, as each printer has a Raspberry Pi hooked up running OctoPrint to deal with Wifi and project storage.
But whenever I need to work right at the printer I need to use the display and it is a pain. Both printers were running some old Marlin V1.x.x.x firmware, where probably no security features where enabled. I did not care about that, as the OctoPrint instance has its own warning system ans it even able to shut a printer down by cutting the power.
However these interfaces are crap. If you turn a wheel left you expect it to count down, but it did the opposite. And when browsing to menus the selector always moves in the wrong direction. Then for calibration you need to move the head, but after 30 seconds the menu resets to the main screen. A pain! The TronXY also had the eeprom disabled in firmware. In addition to that both printers had menu items for SD Card usage, which I never even used, but no menus for stuff like homing a single axis.
You can imagine that I preferred using the OctoPrint interface on my ipad instead of the displays on the printer itself.
Yesterday I needed to calibrate my Anet A8, as I had to print a large print, which uses most of the print bed, just leaving about 5mm around on all sides. I did not get it to fit, as the default offset was wrong due to a bowden + E3D conversion I did about three years ago. I could have done try and error with modifying the printers slicer settings, but I didn´t I wanted it done right, once and for all.
I started installing “Visual Studio code”. Within I installed “Platform IO” and “Auto Build Marlin”
Then I picked the marlin software from github and the configuration archive from the same location. I extracted marlin and the configuration stuff, copied the default ANet A8 configuration files over the default ones in marlin.
I opened the folder within Visual Studio Code, located the “Auto Build Marlin” panel and clicked on “build”.
After a few minutes it was done. Yeah, I was surprised, too. My next problem was to find out how to flash the new binary without swapping SD-Cards, carry a computer next to my printer or just use a long usb cable to hook up a computer.
The solution was simple. I did just nothing. Well, physical. Even so the stuff is located in another room, I opened SSH and logged into my OctoPrint instance of the Anet A8, where I performed:
sudo apt-get install avrdude
A few seconds later it was done.
A quick test using showed the flashing would work and there is someone listening on the other end of the usb port:
avrdude -b 57600 -p ATmega1284P -c arduino -P /dev/ttyUSB0 -v -U thiswillfail.hex
It showed information about the printers hardware and that the board in general is ready to be flashed using that command, which failed due to the non existing firmware. This of course only works, when OctoPrint is disconnected from the printer via web intrface, because the serial will be in use otherwise.
Since I did not want to setup more than needed on my Raspberry Pi or other systems, I decided to upload the firmware.hex file to my web page. A simple “wget https://geit.de/tmp/firmware.hex” call and the firmware was located on the Raspberry Pi.
avrdude -b 57600 -p ATmega1284P -c arduino -P /dev/ttyUSB0 -v -U firmware.hex
It started flashing, then it did a verify run and the printer restarted with a shiny new marlin, where most issues already were fixed.
I opened the conguration.h and edited some lines. For example I disabled the SD-Card support, which also removed the menu items and regains some internal space, you can use for additional features. I also added PID control for the bed and heaters and fixed the default bed location, so the 0/0 is the corner of the bed and not some location outside the print area.
A day later I considered doing the same with the TronXY X5, but I did not know if there is a bootloader allowing to flash the firmware at all. I basically did the same as above. I logged into OctoPrint using SSH, installed avrdude and ran the command with the broken non existing firmware name. To my surprise it showed be nearly the same data than the Anet A8.
But there was one big issue. There is no default configuration for the TronXY X5 in the marlin repo. So what setup and which cpu or board pins to use? Well, I am an impatient and lazy guy, sometimes taking a risk. I took the profile of my printers successor. The TronXY X5S. It is a real CoreXY printer, while mine is just faking one. But mine has bearings and not crappy plastic wheels. I just changed the name wanted to compile it, but “Auto Build Marlin” gave me a choice.
Do I have the small board or the one with the bigger flash? The board is hidden inside a 3d printer case buried under tons of wires and finding the proper and secure answer would have taken at least 60 minutes. The only reason I would want to do that, would be a failed flash and only if I had to install a replacement SKR board while I am in there, anywere. Did I mention that I am lazy? I glanced at my printer: “You are a big boy, aren´t you?” I compiled the big version and flashed it the same way as I did with the Anet A8 above.
The printer restarted. The display was garbled but more or less readable. I could see the logo and the new firmware version was shown. The default info screen was also covered in little faulty segments. I clicked “Home X” and the printer moved the carriage right into the wall. Great. I changed the X direction in the firmware, compiled and uploaded it again. I had the new homing menu items enabled, so I just pushed “Home X” again and it worked. Promising! Then I selected “Home Y” and hell broke loose. The printer moved toward the Y end stop, but kept running into the X end stop. Good that all my printers have an emergency switch. The second time I used it today.
Well, remember I told you above that the successor was a real CoreXY? Yeah! It means that if only one axis moves, both motors for x and y need to move to perform the action. Someone, no clue who, forgot to deselect the CoreXY setting in the printers profile.
But on the bright side. The board side was compatible and so was the pin out. The end stops worked.
Next flash and another use of the emergency switch. Oh, this thing payed for the money I never payed for it, as it was removed from some 80th hardware. Well, you guessed it. Z direction was wrong and the nozzle drilled into the print bed.
After making sure to enable all features I wanted and to disable all features I don´t want, the final flash.
Everything worked fine. Everything? Right. I was starting to get used to have a broken display. Hell, no. I fixed the broken display mount two month ago and I will not tolerate it showing only a crappy content. I asked Mr. google. Mr. Google seems to have a neighbour named “Wiki”. Must be some kid on a boat or so. However this friendly guy knew exactly my issue. Crappy displays sometimes need a crappy timing. He was even so friendly to point out the lines I need to add. A compile and a flash later result was not good.
Was this Wiki kid taunting me? No, my display was just more crappy than the usually crappy display. I doubled the delay values and you guessed it: A compile and a flashing process later it worked.
In the end I must say this turned out to be a good one. I basically have two new printers. Remember they had the stock firmware compiled by some Chinese dude in 2016 or so. Now the latest and greatest Marlin is running on my printers, the annoying presets are gone, I can use the eeprom for the first time. The SD Card menus are no longer mocking me, when I need to skip them to get to the more important menu entries. The click wheel operates in the right direction and I have PID control, so no more overshooting by 15°C when heating the nozzle.
Maybe this inspires you to do the same with some old printer you barely use.
Supplemental: All my printed calibration cubes on both printers looked like melted ice-blocks. I printed several on each printer using different thermistor types (as I had to guess on the TronXY X5) in the firmware, but basically nothing happened. The cubes looked like crap.
Then I watched a print finish and saw the obvious. The part cooling fan was not turning. I did not check that, after the update. I pushed “Fan on” in OctoPrint and it started running. I checked the GCode and the command was there. WTF
Well, the problem was Cura. Well sort off. It seems old marlin versions ignore the P argument in “M106 S255 P1”. The “1” means part cooling fan #1. It should be zero. I checked my other older gcodes and they all worked fine before and they all have P1 as argument. Then I checked the printer settings in Cura and there is a “1” for cooling fan. The bubble clearly says: “Leave the value as default 0 unless you have more than one part cooling fan.” I for sure never changed that.
“BUT WHY IS THERE A 1?” I checked for the other printer and it is set there, too. So the next step is to write a script to fix all the M106 commands on all printers. I checked all the gcode I have and only the most recent are using the “P1” extension, so I guess it got added by the latest Cura 4.8.0 version with the wrong default.