@@ -42,7 +42,7 @@ OLEDDisplay::OLEDDisplay() {
4242
4343 displayWidth = 128 ;
4444 displayHeight = 64 ;
45- displayBufferSize = 1024 ;
45+ displayBufferSize = displayWidth * displayHeight / 8 ;
4646 color = WHITE;
4747 geometry = GEOMETRY_128_64;
4848 textAlignment = TEXT_ALIGN_LEFT;
@@ -800,19 +800,28 @@ int OLEDDisplay::_putc(int c) {
800800#endif
801801
802802// Private functions
803- void OLEDDisplay::setGeometry (OLEDDISPLAY_GEOMETRY g) {
803+ void OLEDDisplay::setGeometry (OLEDDISPLAY_GEOMETRY g, uint16_t width, uint16_t height ) {
804804 this ->geometry = g;
805- if (g == GEOMETRY_128_64) {
806- this ->displayWidth = 128 ;
807- this ->displayHeight = 64 ;
808- } else if (g == GEOMETRY_128_32) {
809- this ->displayWidth = 128 ;
810- this ->displayHeight = 32 ;
811- }
812- this ->displayBufferSize = displayWidth*displayHeight/8 ;
805+ switch (g) {
806+ case GEOMETRY_128_64:
807+ this ->displayWidth = 128 ;
808+ this ->displayHeight = 64 ;
809+ break ;
810+ case GEOMETRY_128_32:
811+ this ->displayWidth = 128 ;
812+ this ->displayHeight = 32 ;
813+ break ;
814+ case GEOMETRY_RAWMODE:
815+ this ->displayWidth = width > 0 ? width : 128 ;
816+ this ->displayHeight = height > 0 ? height : 64 ;
817+ break ;
818+ }
819+ this ->displayBufferSize = displayWidth * displayHeight /8 ;
813820}
814821
815822void OLEDDisplay::sendInitCommands (void ) {
823+ if (geometry == GEOMETRY_RAWMODE)
824+ return ;
816825 sendCommand (DISPLAYOFF);
817826 sendCommand (SETDISPLAYCLOCKDIV);
818827 sendCommand (0xF0 ); // Increase speed of the display max ~96Hz
0 commit comments