bitbank2 / bb_spi_lcd

SPI LCD/OLED library which can be built for Arduino and Linux
GNU General Public License v3.0
92 stars 13 forks source link

Library crashes when display class is instantiated in c++ style #6

Closed cyberman54 closed 2 years ago

cyberman54 commented 2 years ago

Using this lib with a TTGO T-Display board on Arduino framework, it crashes when the display class is instantiated:

BB_SPI_LCD *dp = NULL;

void setup() { 
dp = new BB_SPI_LCD;
dp->begin( LCD_ST7789_135, FLAGS_NONE, 32000000, 5, 16, -1, 4, -1, 19, 18);
...
}

Crash occurs in line db->begin.

cyberman54 commented 2 years ago

It seems i could fix it by adding a line in bb_spi_lcd.h, but i am not sure if this is intentional:

class BB_SPI_LCD : public Print { public: BB_SPI_LCD() { memset(&_lcd, 0, sizeof(_lcd)); } int createVirtual(int iWidth, int iHeight);

bitbank2 commented 2 years ago

Thanks for catching this. It's necessary and I didn't catch it because of the specific build environment/settings. I just pushed new code with this change.