user82219: I'm working with a 128x64 Oled display. I have just installed the Adafruit library and I'm running some sample codes. I have not modified the sample code in anyway yet just testing if the oled display is working but I've noticed that the splashscreen logo only shows the top half of the image.
How can I fix this?


user70020: I'm unable to test this now, but here goes:
Turns out I did have the ability to test it (found an extra display module) and this does indeed explain the problem. The only other change I needed to make to your code in order to replicate the problem was change the display's I2C address to 0x3C. Adafruit GFX Library v1.10.13 and Adafruit SSD1306 version v2.5.1.

From comments on the question:

I added #define SSD1306_LCDHEIGHT 64 before line #53 to remove the
compilation error

Yeah, you can't do that. Under the old method of defining the screen dimensions, you are intended to modify the header itself:
// ONE of the following three lines must be #defined:
//#define SSD1306_128_64 ///< DEPRECTAED: old way to specify 128x64 screen
#define SSD1306_128_32 ///< DEPRECATED: old way to specify 128x32 screen
//#define SSD1306_96_16  ///< DEPRECATED: old way to specify 96x16 screen
// This establishes the screen dimensions in old Adafruit_SSD1306 sketches
// (NEW CODE SHOULD IGNORE THIS, USE THE CONSTRUCTORS THAT ACCEPT WIDTH
// AND HEIGHT ARGUMENTS).

You can see by default it is using a screen with dimensions 128x32. Later in the header this is used to set SSD1306_LCDHEIGHT to 32 in the header.
#if defined SSD1306_128_32
#define SSD1306_LCDWIDTH 128 ///< DEPRECATED: width w/SSD1306_128_32 defined
#define SSD1306_LCDHEIGHT 32 ///< DEPRECATED: height w/SSD1306_128_32 defined
#endif

What you have done in your code is redefine SSD1306_LCDHEIGHT to 64 from the point where you issued the #define downward, which only affects the code compiled in your sketch.
Meanwhile, over in Adafruit_SSD1306.cpp, SSD1306_LCDHEIGHT is still 32, because this file is compiled independently of your .ino and is unaware of your own re#define.  In other words, part of the code you've put into your Arduino thinks it has 32 lines and part of it thinks it has 64 lines.

So, the solution would be get rid of the #define that you inserted into the sketch and to modify header to read:
#define SSD1306_128_64 ///< DEPRECTAED: old way to specify 128x64 screen
//#define SSD1306_128_32 ///< DEPRECATED: old way to specify 128x32 screen
//#define SSD1306_96_16  ///< DEPRECATED: old way to specify 96x16 screen

Or to use the new method of supplying the dimensions by way of the constructor as is done in newer examples:
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
/// ...
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

The Adafruit SSD1306 version v2.5.1's ssd1306_128x64_i2c.ino example that uses this newer method of passing screen dimensions into the Adafruit_SSD1306 constructor and compiled and ran without modification in testing here.

82219: <p>I'm working with a 128x64 Oled display. I have just installed the Adafruit library and I'm running some sample codes. I have not modified the sample code in anyway yet just testing if the oled display is working but I've noticed that the splashscreen logo only shows the top half of the image.</p>
<p>How can I fix this?</p>
<p><a href="https://i.stack.imgur.com/jvUxk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jvUxk.jpg" alt="Splashscreen" /></a></p>
 70020: <p><s>I'm unable to test this now, but here goes:</s><br />
Turns out I <em>did</em> have the ability to test it (found an extra display module) and this does indeed explain the problem. The only other change I needed to make to your code in order to replicate the problem was change the display's I2C address to <code>0x3C</code>. Adafruit GFX Library v1.10.13 and Adafruit SSD1306 version v2.5.1.</p>
<hr />
<p>From comments on the question:</p>
<blockquote>
<p>I added <code>#define SSD1306_LCDHEIGHT 64</code> before line #53 to remove the
compilation error</p>
</blockquote>
<p>Yeah, you can't do that. Under the old method of defining the screen dimensions, you are intended to modify the <a href="https://github.com/adafruit/Adafruit_SSD1306/blob/4759c417580bfeba3803fb31f28b9285cfa3419e/Adafruit_SSD1306.h#L27" rel="nofollow noreferrer">header</a> itself:</p>
<pre class="lang-cpp prettyprint-override"><code>// ONE of the following three lines must be #defined:
//#define SSD1306_128_64 ///&lt; DEPRECTAED: old way to specify 128x64 screen
#define SSD1306_128_32 ///&lt; DEPRECATED: old way to specify 128x32 screen
//#define SSD1306_96_16  ///&lt; DEPRECATED: old way to specify 96x16 screen
// This establishes the screen dimensions in old Adafruit_SSD1306 sketches
// (NEW CODE SHOULD IGNORE THIS, USE THE CONSTRUCTORS THAT ACCEPT WIDTH
// AND HEIGHT ARGUMENTS).
</code></pre>
<p>You can see by default it is using a screen with dimensions 128x32. <a href="https://github.com/adafruit/Adafruit_SSD1306/blob/4759c417580bfeba3803fb31f28b9285cfa3419e/Adafruit_SSD1306.h#L116" rel="nofollow noreferrer">Later in the header</a> this is used to set <code>SSD1306_LCDHEIGHT</code> to <code>32</code> in the header.</p>
<pre class="lang-cpp prettyprint-override"><code>#if defined SSD1306_128_32
#define SSD1306_LCDWIDTH 128 ///&lt; DEPRECATED: width w/SSD1306_128_32 defined
#define SSD1306_LCDHEIGHT 32 ///&lt; DEPRECATED: height w/SSD1306_128_32 defined
#endif
</code></pre>
<p>What you have done in your code is <strong>re</strong>define <code>SSD1306_LCDHEIGHT</code> to <code>64</code> from the point where you issued the <code>#define</code> downward, which <em>only affects the code compiled in your sketch</em>.</p>
<p>Meanwhile, <a href="https://github.com/adafruit/Adafruit_SSD1306/blob/4759c417580bfeba3803fb31f28b9285cfa3419e/Adafruit_SSD1306.cpp#L330" rel="nofollow noreferrer">over in Adafruit_SSD1306.cpp</a>, <code>SSD1306_LCDHEIGHT</code> is <em>still</em> <code>32</code>, because this file is compiled independently of your .ino and is unaware of your own re<code>#define</code>.  In other words, part of the code you've put into your Arduino thinks it has 32 lines and part of it thinks it has 64 lines.</p>
<hr />
<p>So, the solution would be get rid of the <code>#define</code> that you inserted into the sketch and to modify header to read:</p>
<pre class="lang-cpp prettyprint-override"><code>#define SSD1306_128_64 ///&lt; DEPRECTAED: old way to specify 128x64 screen
//#define SSD1306_128_32 ///&lt; DEPRECATED: old way to specify 128x32 screen
//#define SSD1306_96_16  ///&lt; DEPRECATED: old way to specify 96x16 screen
</code></pre>
<p>Or to use the new method of supplying the dimensions by way of the constructor as is done in <a href="https://github.com/adafruit/Adafruit_SSD1306/blob/f8b3aeb/examples/ssd1306_128x64_i2c/ssd1306_128x64_i2c.ino#L26" rel="nofollow noreferrer">newer examples</a>:</p>
<pre class="lang-cpp prettyprint-override"><code>#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
/// ...
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &amp;Wire, OLED_RESET);
</code></pre>
<p>The Adafruit SSD1306 version v2.5.1's ssd1306_128x64_i2c.ino example that uses this newer method of passing screen dimensions into the <code>Adafruit_SSD1306</code> constructor and compiled and ran without modification in testing here.</p>
