adafruit / Adafruit_SSD1306

Arduino library for SSD1306 monochrome 128x64 and 128x32 OLEDs
http://www.adafruit.com/category/63_98
Other
1.81k stars 984 forks source link

Add a no splash #def #232

Closed caternuson closed 2 years ago

caternuson commented 2 years ago

This PR adds a commented out #def that can be used to disable the splash logo. I think that'll be an easier thing to point to for cases like this: https://forums.adafruit.com/viewtopic.php?f=25&t=187139

Still requires editing library source code though. If there's an easier way, then ignore PR.

BillyDonahue commented 2 years ago

Still requires editing library source code though. If there's an easier way, then ignore PR.

It's an interesting question. Here's a thought:

Rely on the linker instead of the preprocessor. The Adafruit_SSD1306::begin member function is the only thing that references the splash bitmap. We could have a Adafruit_SSD1306::beginNoSplash member function that does the same thing as begin, but doesn't mention splash. User sketches that call beginNoSplash instead of begin would have the splash bitmap optimized out. The linker aggressively optimizes for space in these toolchains with entity-level granularity, and it omits unused entities from the executable.

caternuson commented 2 years ago

Or as a parameter to a new begin() override?