Guide

Prusa Dev Diaries #4: Getting the most out of 8-bit firmware

We have recently released a new 3.10 firmware version for all members of our Original Prusa i3 MK3 flagship 3D printer family. There is a lot of things worth talking about, both bug fixes and interesting new features. However, before we get to the details, let us clarify something first. We would love to come up with loads of new things, but the EINSY board doesn’t have much memory left anymore. Before we even get to adding new features, we always have to optimize the existing ones first. This time we managed to save a whopping 5 KB of FLASH memory and almost 400 B of RAM! This is more than it seems – actually, comparable memory size was enough for programming the Apollo Moon landing! (btw, that program is available on Github, too). That means we had enough elbow room this time.

How to save up space? By rewriting the TWI support, for example

One of our favorite methods of saving space is rewriting an older code into a smarter, leaner shape. The best opportunity is when software no longer has to do something that is done on a hardware level instead—for example, the communication between TWI (Two-Wire Interface) and the MK3 optical filament sensor. For historical reasons, we had implemented software support for the optical sensor communication. However, now the hardware-based TWI can take care of it. Even though this only impacts the original MK3 (as the later models have a different filament sensor), the code is shorter for all versions and opens up space for new features.

Rewriting a feature is not the only method of saving space, though. We also thoroughly reviewed the ASM list of critical features and tried to “motivate” the compiler to better translate the code. Sometimes it was a bit rough: for example, with the Thumbnail Skipper feature, the compiler resisted all of our optimization efforts, so we had to use brute-force assembler instead.

So, what are the new features anyway? The first one of them has been a popular user demand for quite some time: showing time remaining till the next filament change – both in manual mode and with the MMU upgrade. Now you can plan ahead instead of relying on the desperate beeping sound of your printer. Now we are waiting for the PrusaSlicer (or other slicers) updates to support this feature. It is coming soon to the MINI printer as well.

As for minor updates, there is now a preheat option for the PVB filament and a 0.8mm nozzle support.

Community translations

Also in the news: the firmware now supports community-made translations. Our printers speak many languages, however, so far, we had to take care of every translation ourselves. Which of more than 2000 world languages should we prioritize, given the limited memory space? One language takes up about 12 KB, therefore, we can only support 16 languages at a time. Eventually, we decided the printer will come with a pre-defined language set and allow for community translations. It seems fair to us: as long as there are active enthusiasts speaking that language, there will be a translation available. Thanks to 3d-gussner (also the author of the translation mechanism), there is now a Dutch version.

You can find the “Community made” submenu in the language selection step, with Nederlands as the only option (so far). If you choose this translation, the printer will copy it into the CPU FLASH and restart in that language – the same as with any other “official” translation. Be careful though, if you don’t speak any Dutch, you might have a hard time switching the language back 🙂 We are currently developing some tools and how-tos for community translators – stay tuned.

The SD-card reading process was reworked big time, and is now ten times faster! Creating the file list and working with it is very fast, no matter if there are a dozen or a hundred items. Up till now, creating long lists was a problem. For certain reasons, we are using the Bubble Sort algorithm, where sorting could take even 30 seconds. The Shell Sort algorithm, chosen from several options, is noticeably faster, even though it is harder to implement. Its only substantial downside is that it sorts the folders as well. We solved this by running the algorithm twice, for folders and files separately. For now, the firmware is still running with the Bubble Sort, which is now so much faster thanks to the new SD card reading process. However, as soon as we test everything properly, we are probably switching over to the Shell Sort.

Print Hosts support

Another reply to popular demand: better support of various external software, communicating with the printer via a serial line (Octoprint, Pronterface, or Repetier-Host), so the users can tailor everything as they wish. In this case, we also had the idea for some time already but had to wait for the available memory space.

For example, the Thumbnail Skipper feature, the main source of the SD-card reading speed increase. PrusaSlicer generates thumbnails for the MINI, which are part of the GCODE. On the MK3 display, these wouldn’t show of course. They weren’t even generated to avoid troubles (even rejecting the firmware by the watchdog) and delaying the start of print. However, an external software could actually use those thumbnails, as a picture always gives a better idea than just a file name (often rather cryptic). In Octoprint, there are already plugins that make thumbnails possible, so we had a lot of requests from the community in this regard.

We used the new SD-card reading process (increasing the speed almost ten times). This process can also skip comment lines in the GCODE, including the thumbnails. Such a change has to be tested thoroughly. It seems to be trivial, but a substantial overhaul of the important firmware section was needed.

Another feature focused on communication with external platforms are the Host Actions. This means equal priority for both local and distant control – being able to start the print both with the printer controlling knob and with external software, getting the same response in both cases. Again, this sounds trivial, but it is something that wasn’t foreseen in the beginning. For example, there is a routine stopping the fan to let the user clean it up in case of a malfunction. Of course, that would make no sense if you are away from the printer… We had to rethink and rework a lot of things.

Thanks to Host Actions, the pieces of code responsible for communication are now tidied up. We hope that the external software will now be able to communicate with the printer more smoothly. This means less need for user interventions and more opportunities for tailoring and fine-tuning everything for a specific workflow. By the way, this is a showcase of open source importance, which makes such quick and easy tweaks possible.

That is all. Almost! You can find all the less fancy (but important nonetheless) details in the very thorough 3.10 firmware Release Notes. Developer community support is not only about giving out swag during the trade shows and maker fairs but having perfect documentation in the first place. We will keep working on it!

We hope the extended Printer Hosts support will help advance all the external printer control software. By the way, let us know what is your favorite software and for what purpose, so we can better focus on the crucial things.

Last but not least, a little teaser for future firmware versions: there will be a “mileage counter”, properly called the “Maintenance menu”. It will track the mileage of the individual steppers and remind the user to lubricate the bearings, check or replace parts, etc. This is important both for the print quality and the longevity of your printer. More on this next time! In the meantime, if you have any ideas on how to improve the MK3s+, please let us know in the dedicated discussion thread of our forum!

Happy Printing!



Source link

Tags
Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Close