Why must I define the optional [reset] pin when running an OLED display?

My widget uses an Herkulex DRS-0401_SER0034 LCD and merrily runs this code

#include <Arduino.h>
#include <SPI.h>
#include <U8g2lib.h>

  U8G2_SSD1325_NHD_128X64_1_4W_SW_SPI u8g2(
  /* rotation zero */ U8G2_R0,  /* clock=*/ 13, /* data=*/ 11, 
  /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);


void setup(void) 
{
 u8g2.begin();
}

void loop(void) 
{
 u8g2.firstPage();
 do {
 u8g2.setFont(u8g2_font_ncenB14_tr);
 u8g2.drawStr(5, 15, "Hello World!");
 u8g2.drawStr(20, 35, "Goodbye!");
 u8g2.setFont(u8g2_font_unifont_t_symbols);
 u8g2.drawStr(0, 64, "No snow in Perth");
 } while (u8g2.nextPage());
 delay(1000);

180212-OLED_Works-640x478.jpg

The datasheet describes the relevant u8g2 instance as
U8G2_SSD1325_NHD_128X64_1_4W_SW_SPI(rotation, clock, data, cs, dc [, reset])
which, as I understand it means that defining 'reset' is optional.

I tried leaving it out and the widget did not work. I declared it and BINGO! All singing! All dancing!

Is that just a glitch in the datasheet, or is there a more sinister underlying reason?

Thanks

180212-OLED_Works-640x478.jpg

Probably some kind of glitch.
The code is far too large to track down the problem: https://github.com/olikraus/u8g2.
It might be a minor bug or it might be a timing problem which is solved with a dummy reset pin.

When a parameter is optional, it is set to a default value in the *.h file.
In U8g2lib.h you can find that it is default set to "U8X8_PIN_NONE". In the code, the part that uses the reset pin is skipped when it was not used.

Thanks Koepel

The constructor is:

public: U8G2_SSD1325_NHD_128X64_1_4W_SW_SPI(const u8g2_cb_t *rotation, uint8_t clock, uint8_t data, uint8_t cs, uint8_t dc, uint8_t reset = U8X8_PIN_NONE) : U8G2() {

So it should work fine without a reset as long as your screen indeed has no reset line :slight_smile:

septillion:
So it should work fine without a reset as long as your screen indeed has no reset line :slight_smile:

I wholeheartedly agree. It should! :slight_smile:

It don't! >:(

That's why I made the original post.

Do you agree with Koepel that it is ... some kind if glitch ?

But you now define it with some pin but don't use that pin?