SSD1306_NO_SPLASH not working?

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
NYCkid
 
Posts: 2
Joined: Thu Feb 20, 2020 3:52 am

SSD1306_NO_SPLASH not working?

Post by NYCkid »

Help... I've defined SSD1306_NO_SPLASH in my code (the OLED isn't supposed to be seen until well after the system has started up), but it still shows the splash screen no matter what I try:

Code: Select all

#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
#define SSD1306_NO_SPLASH 
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
The README.md in the library folder specifically says this has been done:

Code: Select all

## Changes
Pull Request:
   (November 2021) 
   * Added define `SSD1306_NO_SPLASH` to opt-out of including splash images in `PROGMEM` and drawing to display during `begin`.

Adafruit_SSD1306.cpp says:

Code: Select all

#ifndef SSD1306_NO_SPLASH
  if (HEIGHT > 32) {
    drawBitmap((WIDTH - splash1_width) / 2, (HEIGHT - splash1_height) / 2,
               splash1_data, splash1_width, splash1_height, 1);
  } else {
    drawBitmap((WIDTH - splash2_width) / 2, (HEIGHT - splash2_height) / 2,
               splash2_data, splash2_width, splash2_height, 1);
  }
#endif

splash.h says:

Code: Select all

/**
 * This file is autogenerated, do not edit.
 * Run `make` from the scripts directory to produce splash.h
 *
 * Splashes will be stored in PROGMEM (flash).
 * If SSD1306_NO_SPLASH is defined, the splashes are omitted.
 */

#ifndef SSD1306_NO_SPLASH
/* clang-format off */

#define splash1_width  82
#define splash1_height 64

const uint8_t PROGMEM splash1_data[] = {
**lots of pretty bitmap data**
};
/* clang-format on */
#endif
The only specific reference that seems to work is in Adafruit_SSD1306.h:

Code: Select all

// Uncomment to disable Adafruit splash logo
// #define SSD1306_NO_SPLASH
And the only way I seem to be able to get it to work is by uncommenting the #define in the header. Everything seems to be "if SSD1306_NO_SPLASH exists, don't do the following," but the compiler does it anyway... I've gone back over the ifndef statements and there are no misspellings... Is the compiler just being a brat and ignoring me, or is there something I'm missing? Do I need to take away it's phone or game console? ;-)

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: SSD1306_NO_SPLASH not working?

Post by adafruit_support_mike »

Your code needs to #define SSD1306_NO_SPLASH before #including the SSD1306 library. In the code above, it comes after the library:

Code: Select all

#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
#define SSD1306_NO_SPLASH 
Try this instead:

Code: Select all

#include <Adafruit_GFX.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
#define SSD1306_NO_SPLASH 
#include <Adafruit_SSD1306.h>

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”