Open NuclearPhoenixx opened 2 years ago
I can confirm this is the case on ESP32-WROOM-32 38 pin dev module as well, in Arduino IDE 1.8.19 and 2.0.1.
Yes, i display.begin returns always TRUE on Pi Pico , ESP8266 , ESP32
Well, i digged around within the source code of the lib and found NO return of FALSE if the display is not avaiable !
I thought about a workaround and here is the tested and working result: Wire.begin(); Wire.beginTransmission (SCREEN_ADDRESS); if (Wire.endTransmission () > 0){ Serial.println("SSD1306 allocation failed"); for(;;); // Don't proceed, loop forever } Wire.end(); if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) { Serial.println(F("SSD1306 FAIL: Buffer allocation error, not enough memory")); for(;;); // Don't proceed, loop forever }
instead of: if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) { Serial.println(F("SSD1306 allocation failed")); for(;;); // Don't proceed, loop forever }
Additional Info:
if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) { Serial.println(F("SSD1306 allocation failed")); for(;;); // Don't proceed, loop forever }
works but NOT as expected , it only returns FALSE if not enough memory for display buffer is avaiable. so it would be better to change the phrase " Serial.println(F("SSD1306 allocation failed")); " to " Serial.println(F("SSD1306 FAIL: Buffer allocation error, not enough memory")); "
Hi there! I have an issue where the
display.begin()
function will always return true regardless if there is an actual display plugged in or not. It works fine if there is a display, of course, but if there is none it doesn't register that and thinks there still is one.Arduino board: Raspberry Pi Pico with arduino-pico core
Arduino IDE version (found in Arduino -> About Arduino menu): 2.0.1
List the steps to reproduce the problem below (if possible attach a sketch or copy the sketch code in too):
ssd1306_128x64_i2c
example.Serial.println(F("SSD1306 allocation failed"));
will never show becausedisplay.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)
will never befalse
.Maybe it's got something to do with the Raspberry Pi Pico? I don't think so tbh, because everything else works fine, so there must be an issue here.