SSD1306 - i2C - #define OLED_RESET 4

I am using the Particle SSD1306 library with an i2C module. All has been working well with a lot of different programs.

I just noticed I had been using:

    `#define OLED_RESET 4`

instead of

    `#define OLED_RESET D4`

I am surprised it has been working given that I must have copied the first statement from an old Arduino sketch.

Given that D4 happens to also be TX on the Xenon(Serial2), would this cause any problems?

Thanks in advance for any help.

If you know how D4 is defined, the answer becomes self-evident

Further down you’ll also find the definition of TX1 for the Xenon.
As long you don’t call Serial2.begin() D4 won’t be used as TX1 but the pin number would in both cases be 4.
You can write this obscure code and it would render perfectly valid results.

  pinMode(D4, OUTPUT);
  pinMode(D4, LOW);
  digitalWrite(TX1, HIGH);
  if (digitalRead(D4) == LOW)
    Serial.println("This will never happen"); 

Thank you @ScruffR for referring me to that document.

My main question was what would happen if I use D4 for OLED reset, AND also use Serial2 on the Xenon? Am I better off using a different pin for the OLED’s reset?

Most I2C SSD1306 devices don’t need the hardware reset line. They can be reset in software over I2C. I never connect it and I use a lot of those displays. In most libraries you can set the reset pin to -1 to indicate that you want to use software reset.

Thank you @rickkas7.