Onion Information
Marlin Boot Animations
Marlin Boot Animations - In Marlin (the 3D Printer firmware), you can have an animated Bootscreen. This animation can be as long as you want, as long as it'll fit on the EEPROM. It has practically no documentation, so instead I'll...
Onion Details
Page Clicks: 0
First Seen: 04/27/2024
Last Indexed: 10/23/2024
Onion Content
Marlin Boot Animations In Marlin (the 3D Printer firmware), you can have an animated Bootscreen. This animation can be as long as you want, as long as it'll fit on the EEPROM. It has practically no documentation, so instead I'll be documenting it here. Keep in mind that I am far from an expert on this, so some experimentation may be necessary. Format Here's an example of an animated _Bootscreen.h : /** * Marlin 3D Printer Firmware * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ #pragma once #define CUSTOM_BOOTSCREEN_ANIMATED #define CUSTOM_BOOTSCREEN_TIMEOUT 0 // (ms) Extra timeout after the animation /** * Enable one of the following two options depending on your needs. * Also edit the "custom_bootscreen_animation" at the bottom of this file. */ #define CUSTOM_BOOTSCREEN_FRAME_TIME 200 // (ms) Same time for all frames //#define CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME // Each frame also has a duration #define CUSTOM_BOOTSCREEN_BMPWIDTH 128 const unsigned char custom_start_bmp [] PROGMEM = { 0xFF , 0xFF }; const unsigned char custom_start_bmp0 [] PROGMEM = { 0xFF , 0xFF }; const unsigned char custom_start_bmp1 [] PROGMEM = { 0xFF , 0xFF }; #ifdef CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME // Each frame has its own custom duration const boot_frame_t custom_bootscreen_animation [] PROGMEM = { custom_start_bmp0 , 600 }, { custom_start_bmp1 , 700 }, { custom_start_bmp , 500 }, }; #else // Each frame shows for CUSTOM_BOOTSCREEN_FRAME_TIME const unsigned char * const custom_bootscreen_animation [] PROGMEM = { custom_start_bmp , custom_start_bmp0 , custom_start_bmp1 }; #endif Here's a breakdown of that. The start #pragma once : Just generic C/C++ stuff to make sure the file is only included once, nothing interesting. ( Wikipedia ) #define CUSTOM_BOOTSCREEN_ANIMATED : Sets it to be an animated, not static, boot screen. define CUSTOM_BOOTSCREEN_TIMEOUT 0 : The extra time that the last frame is held for. #define CUSTOM_BOOTSCREEN_FRAME_TIME 200 : How many milliseconds each frame shows for. For a standard 128x64 display, 200ms is about as fast as it can go. //#define CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME : If uncommented, each frame would appear for a custom length of time (which will be set near the end of the file) #define CUSTOM_BOOTSCREEN_BMPWIDTH 128 : Sets the width of the frame. #define CUSTOM_BOOTSCREEN_BMPHEIGHT 64 : Sets the height of the frame. Not required, and not in the example, but it is created if using converter2.html The frames (byte arrays) Marlin uses C/C++ byte arrays to encode each frame, going like this: custom_start_bmp custom_start_bmp0 custom_start_bmp1 custom_start_bmp2 and so on. For a static boot screen, only use custom_start_bmp . Each array looks like the one below, which is the Linux Mint logo. const unsigned char custom_start_bmp [] PROGMEM = { B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11000000 , B00000011 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111100 , B00000000 , B00000000 , B01111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11110000 , B00000000 , B00000000 , B00001111 , B11111111 , B11111111 , B11111111 , B11111111 , B11000000 , B00000000 , B00000000 , B00000111 , B11111111 , B11111111 , B11111111 , B11111111 , B10000000 , B00000000 , B00000000 , B00000001 , B11111111 , B11111111 , B11111111 , B11111110 , B00000000 , B00000000 , B00000000 , B00000000 , B11111111 , B11111111 , B11111111 , B11111100 , B00000000 , B00000000 , B00000000 , B00000000 , B00111111 , B11111111 , B11111111 , B11111000 , B00000000 , B00000000 , B00000000 , B00000000 , B00011111 , B11111111 , B11111111 , B11110000 , B00000000 , B00000000 , B00000000 , B00000000 , B00001111 , B11111111 , B11111111 , B11100000 , B00000000 , B00000000 , B00000000 , B00000000 , B00001111 , B11111111 , B11111111 , B11000011 , B11100000 , B00000000 , B00000000 , B00000000 , B00000111 , B11111111 , B11111111 , B11000011 , B11100000 , B00000000 , B00000000 , B00000000 , B00000011 , B11111111 , B11111111 , B10000011 , B11100000 , B00000000 , B00000000 , B00000000 , B00000001 , B11111111 , B11111111 , B00000011 , B11100000 , B00000111 , B11100001 , B11111000 , B00000001 , B11111111 , B11111111 , B00000011 , B11100000 , B00011111 , B11110111 , B11111100 , B00000000 , B11111111 , B11111110 , B00000011 , B11100000 , B00111111 , B11111111 , B11111110 , B00000000 , B11111111 , B11111110 , B00000011 , B11100000 , B01111111 , B11111111 , B11111111 , B00000000 , B01111111 , B11111100 , B00000011 , B11100000 , B01111111 , B11111111 , B11111111 , B10000000 , B01111111 , B11111100 , B00000011 , B11100000 , B11111100 , B01111111 , B00011111 , B10000000 , B01111111 , B11111100 , B00000011 , B11100000 , B11111100 , B00111111 , B00001111 , B10000000 , B00111111 , B11111100 , B00000011 , B11100000 , B11111000 , B00111110 , B00001111 , B10000000 , B00111111 , B11111000 , B00000011 , B11100000 , B11111000 , B00111110 , B00001111 , B10000000 , B00111111 , B11111000 , B00000011 , B11100000 , B11111000 , B00111110 , B00001111 , B10000000 , B00011111 , B11111000 , B00000011 , B11100000 , B11111000 , B00111110 , B00001111 , B10000000 , B00111111 , B11111100 , B00000011 , B11100000 , B00000000 , B00000000 , B00001111 , B10000000 , B00111111 , B11111100 , B00000011 , B11110000 , B00000000 , B00000000 , B00001111 , B10000000 , B00111111 , B11111100 , B00000001 , B11110000 , B00000000 , B00000000 , B00001111 , B10000000 , B01111111 , B11111110 , B00000001 , B11111000 , B00000000 , B00000000 , B00011111 , B10000000 , B01111111 , B11111110 , B00000001 , B11111100 , B00000000 , B00000000 , B01111111 , B00000000 , B11111111 , B11111111 , B00000000 , B11111111 , B11111111 , B11111111 , B11111111 , B00000000 , B11111111 , B11111111 , B00000000 , B01111111 , B11111111 , B11111111 , B11111110 , B00000001 , B11111111 , B11111111 , B10000000 , B00111111 , B11111111 , B11111111 , B11111100 , B00000001 , B11111111 , B11111111 , B10000000 , B00011111 , B11111111 , B11111111 , B11111000 , B00000011 , B11111111 , B11111111 , B11000000 , B00000111 , B11111111 , B11111111 , B11100000 , B00000011 , B11111111 , B11111111 , B11100000 , B00000000 , B00000000 , B00000000 , B00000000 , B00000111 , B11111111 , B11111111 , B11100000 , B00000000 , B00000000 , B00000000 , B00000000 , B00001111 , B11111111 , B11111111 , B11110000 , B00000000 , B00000000 , B00000000 , B00000000 , B00011111 , B11111111 , B11111111 , B11111000 , B00000000 , B00000000 , B00000000 , B00000000 , B00111111 , B11111111 , B11111111 , B11111110 , B00000000 , B00000000 , B00000000 , B00000000 , B01111111 , B11111111 , B11111111 , B11111111 , B00000000 , B00000000 , B00000000 , B00000000 , B11111111 , B11111111 , B11111111 , B11111111 , B10000000 , B00000000 , B00000000 , B00000011 , B11111111 , B11111111 , B11111111 , B11111111 , B11100000 , B00000000 , B00000000 , B00001111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111000 , B00000000 , B00000000 , B00111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B00000000 , B00000000 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111000 , B00011111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 , B11111111 }; Which ends up looking like this: Rather than using Marlin's official converter, you can just take the array from the file generated by convert frame.png frame.xmp . Very useful for automation. Note that the earlier example was generated using convert , so it's in hexadecimal format rather than decimal, unlike converter.html would have generated. It's actually 3 frames (0.6 seconds) of Bad Apple (albeit a bit messed up for unknown reasons, but not because I'm using convert instead). The end #ifdef CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME // Each frame has its own custom duration const boot_frame_t custom_bootscreen_animation [] PROGMEM = { custom_start_bmp0 , 600 }, { custom_start_bmp1 , 700 }, { custom_start_bmp , 500 }, }; #else // Each frame shows for CUSTOM_BOOTSCREEN_FRAME_TIME const unsigned char * const custom_bootscreen_animation [] PROGMEM = { custom_start_bmp , custom_start_bmp0 , custom_start_bmp1 }; #endif If CUSTOM_BOOTSCREEN_ANIMATED_FRAME_TIME exists, the time for each frame is set to its corresponding value (milliseconds). If it doesn't exist, then every frame needs to be listed in the other thing. I don't know why, I just don't question it. How-to Manually Copy the starting code into _Bootscreen.h Generate each frame's byte array using converter.html , then paste it into the file. Adjust the naming as needed (remember, it goes custom_start_bmp , custom_start_bmp0 , custom_start_bmp1 ) Add the ending code. Automatically Note: This only allows for 5 FPS, no more, no less. However, I may edit animator.py to have an adjustable framerate. Get your video, then put it into handbrake. Set the maximum resolution as 128x64, and the frame rate as 5. Export it, and take note of where it's stored. Run git clone https://github.com/askiiart/marlin-auto-animation; cd marlin-auto-animation/ Edit animator.py , and specify the path to the video. ( video = /path/to/video.mp4 ) Run python3 animator.py . Depending on the size of your video, this might take a few minutes. Tools My video-to-animation maker ( Mirror ) Marlin official image-to-byte array tool ( Source ) There's also converter2.html , but I'd recommending just using converter.html , mostly because decimal allows for a "preview" of sorts.