Closed gps79 closed 2 years ago
are you using adafruit hardware? if so please post a photo!
I don't use adafruit hardware. I just pointed an error (i2c_dev is a null pointer and causes crash). The fix for that is to move line: uint16_t maxbuff = i2c_dev->maxBufferSize() - 1; below line: if (i2c_dev) { // I2C
so it's executed only when i2c_dev structure is initialized. Then the SW doesn't crash.
What code are you running? Is it calling begin()
on the display instance?
EDIT - oh, this is for SPI usage. OK, seeing it now. For the SPI case, i2c_dev
never gets init'd:
https://github.com/adafruit/Adafruit-GFX-Library/blob/4a33fcd467e373d1eedd3aef6f5f9be36f5c276b/Adafruit_GrayOLED.cpp#L242-L252
so the call to display()
will try to access a null pointer here:
https://github.com/adafruit/Adafruit_SH110x/blob/2f7d9fbdc6596d449d303bd7d8b44399012a27de/Adafruit_SH110X.cpp#L170
@gps79 If you can, please test the changes in PR #11.
It's working fine with your fix. No more crashes. Thank you.
Arduino board: NodeMCU v3
Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.15
List the steps to reproduce the problem below (if possible attach a sketch or copy the sketch code in too): LIST REPRO STEPS BELOW
Expected result: Software runs without errors.
Actual result: Software crashes.
Root cause: