mirror of
https://github.com/meshtastic/firmware.git
synced 2025-07-29 18:05:42 +00:00
Add customizable boot logo based on resolution (#7146)
This commit is contained in:
parent
553fc0cb1b
commit
f99ac2104c
5
.gitignore
vendored
5
.gitignore
vendored
@ -37,4 +37,7 @@ release/
|
||||
.vscode/extensions.json
|
||||
/compile_commands.json
|
||||
src/mesh/raspihttp/certificate.pem
|
||||
src/mesh/raspihttp/private_key.pem
|
||||
src/mesh/raspihttp/private_key.pem
|
||||
|
||||
# Ignore logo (set at build time with platformio-custom.py)
|
||||
data/boot/logo.*
|
||||
|
@ -131,3 +131,33 @@ for lb in env.GetLibBuilders():
|
||||
if lb.name == "meshtastic-device-ui":
|
||||
lb.env.Append(CPPDEFINES=[("APP_VERSION", verObj["long"])])
|
||||
break
|
||||
|
||||
# Get the display resolution from macros
|
||||
def get_display_resolution(build_flags):
|
||||
# Check "DISPLAY_SIZE" to determine the screen resolution
|
||||
for flag in build_flags:
|
||||
if isinstance(flag, tuple) and flag[0] == "DISPLAY_SIZE":
|
||||
screen_width, screen_height = map(int, flag[1].split("x"))
|
||||
return screen_width, screen_height
|
||||
print("No screen resolution defined in build_flags. Please define DISPLAY_SIZE.")
|
||||
exit(1)
|
||||
|
||||
def load_boot_logo(source, target, env):
|
||||
build_flags = env.get("CPPDEFINES", [])
|
||||
logo_w, logo_h = get_display_resolution(build_flags)
|
||||
print(f"TFT build with {logo_w}x{logo_h} resolution detected")
|
||||
|
||||
# Load the boot logo from `branding/logo_<width>x<height>.png` if it exists
|
||||
source_path = join(env["PROJECT_DIR"], "branding", f"logo_{logo_w}x{logo_h}.png")
|
||||
dest_dir = join(env["PROJECT_DIR"], "data", "boot")
|
||||
dest_path = join(dest_dir, "logo.png")
|
||||
if env.File(source_path).exists():
|
||||
print(f"Loading boot logo from {source_path}")
|
||||
# Prepare the destination
|
||||
env.Execute(f"mkdir -p {dest_dir} && rm -f {dest_path}")
|
||||
# Copy the logo to the `data/boot` directory
|
||||
env.Execute(f"cp {source_path} {dest_path}")
|
||||
|
||||
# Load the boot logo on TFT builds
|
||||
if ("HAS_TFT", 1) in env.get("CPPDEFINES", []):
|
||||
env.AddPreAction('$BUILD_DIR/littlefs.bin', load_boot_logo)
|
||||
|
17
branding/README.md
Normal file
17
branding/README.md
Normal file
@ -0,0 +1,17 @@
|
||||
# Meshtastic Branding / Whitelabeling
|
||||
|
||||
This directory is consumed during the creation of **event** firmware.
|
||||
|
||||
`bin/platformio-custom.py` determines the display resolution, and locates the corresponding `logo_<width>x<height>.png`.
|
||||
|
||||
Ex:
|
||||
|
||||
- `logo_800x480.png`
|
||||
- `logo_480x480.png`
|
||||
- `logo_480x320.png`
|
||||
- `logo_320x480.png`
|
||||
- `logo_320x240.png`
|
||||
|
||||
This file is copied to `data/boot/logo.png` before filesytem image compilation.
|
||||
|
||||
For additional examples see the [`event/defcon33` branch](https://github.com/meshtastic/firmware/tree/event/defcon33).
|
@ -79,6 +79,7 @@ build_flags =
|
||||
-D SPI_FREQUENCY=80000000
|
||||
-D LGFX_SCREEN_WIDTH=240
|
||||
-D LGFX_SCREEN_HEIGHT=320
|
||||
-D DISPLAY_SIZE=320x240 ; landscape mode
|
||||
-D LGFX_PANEL=ST7789
|
||||
-D LGFX_ROTATION=1
|
||||
-D LGFX_CFG_HOST=SPI2_HOST
|
||||
@ -103,6 +104,7 @@ build_flags =
|
||||
-D SPI_FREQUENCY=60000000
|
||||
-D LGFX_SCREEN_WIDTH=320
|
||||
-D LGFX_SCREEN_HEIGHT=480
|
||||
-D DISPLAY_SIZE=320x480 ; portrait mode
|
||||
-D LGFX_PANEL=ILI9488
|
||||
-D LGFX_ROTATION=0
|
||||
-D LGFX_CFG_HOST=SPI2_HOST
|
||||
@ -126,3 +128,4 @@ extends = crowpanel_large_esp32s3_base
|
||||
build_flags =
|
||||
${crowpanel_large_esp32s3_base.build_flags}
|
||||
-D VIEW_320x240
|
||||
-D DISPLAY_SIZE=800x480 ; landscape mode
|
||||
|
@ -85,6 +85,7 @@ build_flags = ${mesh_tab_xpt2046.build_flags}
|
||||
-D SPI_FREQUENCY=60000000
|
||||
-D LGFX_SCREEN_WIDTH=240
|
||||
-D LGFX_SCREEN_HEIGHT=320
|
||||
-D DISPLAY_SIZE=320x240 ; landscape mode
|
||||
-D LGFX_PANEL=ST7789
|
||||
-D LGFX_INVERT_COLOR=false
|
||||
-D LGFX_ROTATION=3
|
||||
@ -97,6 +98,7 @@ build_flags = ${mesh_tab_xpt2046.build_flags}
|
||||
-D SPI_FREQUENCY=60000000 ; if image is distorted then lower to 40 MHz
|
||||
-D LGFX_SCREEN_WIDTH=240
|
||||
-D LGFX_SCREEN_HEIGHT=320
|
||||
-D DISPLAY_SIZE=320x240 ; landscape mode
|
||||
-D LGFX_PANEL=ILI9341
|
||||
-D LGFX_ROTATION=1
|
||||
-D LGFX_TOUCH_ROTATION=4
|
||||
@ -109,6 +111,7 @@ build_flags = ${mesh_tab_xpt2046.build_flags}
|
||||
-D DISPLAY_SET_RESOLUTION
|
||||
-D LGFX_SCREEN_WIDTH=320
|
||||
-D LGFX_SCREEN_HEIGHT=480
|
||||
-D DISPLAY_SIZE=320x480 ; portrait mode
|
||||
-D LGFX_PANEL=ILI9488
|
||||
-D LGFX_ROTATION=0
|
||||
-D LGFX_TOUCH_ROTATION=0
|
||||
@ -121,6 +124,7 @@ build_flags = ${mesh_tab_xpt2046.build_flags}
|
||||
-D DISPLAY_SET_RESOLUTION
|
||||
-D LGFX_SCREEN_WIDTH=320
|
||||
-D LGFX_SCREEN_HEIGHT=480
|
||||
-D DISPLAY_SIZE=320x480 ; portrait mode
|
||||
-D LGFX_PANEL=HX8357B
|
||||
-D LGFX_INVERT_COLOR=false
|
||||
-D LGFX_ROTATION=4
|
||||
@ -133,6 +137,7 @@ build_flags = ${mesh_tab_ft5x06.build_flags}
|
||||
-D SPI_FREQUENCY=75000000 ; may go higher upto 60/80 MHz
|
||||
-D LGFX_SCREEN_WIDTH=240
|
||||
-D LGFX_SCREEN_HEIGHT=320
|
||||
-D DISPLAY_SIZE=320x240 ; landscape mode
|
||||
-D LGFX_PANEL=ILI9341
|
||||
-D LGFX_ROTATION=1
|
||||
-D LGFX_TOUCH_X_MIN=0
|
||||
@ -149,6 +154,7 @@ build_flags = ${mesh_tab_ft5x06.build_flags}
|
||||
-D DISPLAY_SET_RESOLUTION
|
||||
-D LGFX_SCREEN_WIDTH=320
|
||||
-D LGFX_SCREEN_HEIGHT=480
|
||||
-D DISPLAY_SIZE=320x480 ; portrait mode
|
||||
-D LGFX_PANEL=ILI9488
|
||||
-D LGFX_ROTATION=2
|
||||
-D LGFX_TOUCH_X_MIN=0
|
||||
@ -165,6 +171,7 @@ build_flags = ${mesh_tab_ft5x06.build_flags}
|
||||
-D DISPLAY_SET_RESOLUTION
|
||||
-D LGFX_SCREEN_WIDTH=320
|
||||
-D LGFX_SCREEN_HEIGHT=480
|
||||
-D DISPLAY_SIZE=320x480 ; portrait mode
|
||||
-D LGFX_PANEL=HX8357B
|
||||
-D LGFX_ROTATION=4
|
||||
-D LGFX_TOUCH_X_MIN=0
|
||||
|
@ -44,6 +44,7 @@ build_flags =
|
||||
-D LOG_DEBUG_INC=\"DebugConfiguration.h\"
|
||||
-D LGFX_SCREEN_WIDTH=240
|
||||
-D LGFX_SCREEN_HEIGHT=320
|
||||
-D DISPLAY_SIZE=320x240 ; landscape mode
|
||||
-D LGFX_DRIVER=LGFX_PICOMPUTER_S3
|
||||
-D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_PICOMPUTER_S3.h\"
|
||||
-D VIEW_320x240
|
||||
|
@ -55,6 +55,7 @@ build_flags =
|
||||
-D CUSTOM_TOUCH_DRIVER
|
||||
-D LGFX_SCREEN_WIDTH=480
|
||||
-D LGFX_SCREEN_HEIGHT=480
|
||||
-D DISPLAY_SIZE=480x480
|
||||
-D LGFX_DRIVER=LGFX_INDICATOR
|
||||
-D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_INDICATOR.h\"
|
||||
-D VIEW_320x240
|
||||
|
@ -54,6 +54,7 @@ build_flags =
|
||||
; -D CALIBRATE_TOUCH=0
|
||||
-D LGFX_SCREEN_WIDTH=240
|
||||
-D LGFX_SCREEN_HEIGHT=320
|
||||
-D DISPLAY_SIZE=320x240 ; landscape mode
|
||||
-D LGFX_DRIVER=LGFX_TDECK
|
||||
-D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_T_DECK.h\"
|
||||
; -D LVGL_DRIVER=LVGL_TDECK
|
||||
|
@ -56,6 +56,7 @@ build_flags =
|
||||
-D LOG_DEBUG_INC=\"DebugConfiguration.h\"
|
||||
-D LGFX_SCREEN_WIDTH=320
|
||||
-D LGFX_SCREEN_HEIGHT=480
|
||||
-D DISPLAY_SIZE=320x480 ; portrait mode
|
||||
-D LGFX_DRIVER=LGFX_UNPHONE_V9
|
||||
-D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_UNPHONE.h\"
|
||||
-D VIEW_320x240
|
||||
|
Loading…
Reference in New Issue
Block a user