mirror of
https://github.com/torlando-tech/pyxis.git
synced 2026-03-29 05:19:50 +00:00
Clean up splash preprocessor structure and add include warning
Consolidate #ifndef/#ifdef into single #ifdef/#else/#endif block. Add warning comment to generated header about static linkage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -85,6 +85,7 @@ else:
|
||||
f.write(f"#define SPLASH_HEIGHT {SPLASH_HEIGHT}\n")
|
||||
f.write(f"#define HAS_SPLASH_IMAGE 1\n\n")
|
||||
f.write(f"// {SPLASH_WIDTH}x{SPLASH_HEIGHT} RGB565 big-endian ({len(rgb565_bytes)} bytes)\n")
|
||||
f.write("// WARNING: static linkage — include from exactly ONE translation unit\n")
|
||||
f.write("static const uint8_t PROGMEM splash_image[] = {\n")
|
||||
|
||||
# Write bytes, 16 per line
|
||||
|
||||
@@ -174,15 +174,10 @@ void Display::set_power(bool on) {
|
||||
}
|
||||
|
||||
void Display::show_splash() {
|
||||
#ifndef HAS_SPLASH_IMAGE
|
||||
// No splash image — fill with background color (#1D1A1E -> RGB565 0x18C3)
|
||||
fill_screen(0x18C3);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SPLASH_IMAGE
|
||||
// Splash image is full-screen (320x240), so offsets are 0
|
||||
static const uint16_t X_OFFSET = (Disp::WIDTH - SPLASH_WIDTH) / 2; // 0
|
||||
static const uint16_t Y_OFFSET = (Disp::HEIGHT - SPLASH_HEIGHT) / 2; // 0
|
||||
static const uint16_t X_OFFSET = (Disp::WIDTH - SPLASH_WIDTH) / 2;
|
||||
static const uint16_t Y_OFFSET = (Disp::HEIGHT - SPLASH_HEIGHT) / 2;
|
||||
|
||||
set_addr_window(X_OFFSET, Y_OFFSET,
|
||||
X_OFFSET + SPLASH_WIDTH - 1,
|
||||
@@ -204,6 +199,9 @@ void Display::show_splash() {
|
||||
|
||||
end_write();
|
||||
INFO(" Splash image rendered");
|
||||
#else
|
||||
// No splash image — fill with background color (#1D1A1E -> RGB565 0x18C3)
|
||||
fill_screen(0x18C3);
|
||||
#endif
|
||||
|
||||
// Backlight on now that screen content is ready
|
||||
|
||||
Reference in New Issue
Block a user