1.3 Inch OLED issues

Hey all. I recently purchased this 1.3 inch OLED from ali. (https://www.aliexpress.com/snapshot/0.html?orderId=82629226226008&productId=32702482986)

I have followed the instructions as far as editing the best I can. Mainly referencing (http://reprap.org/wiki/MKS_12864OLED)

I am unable to get it to even light up let alone work. I was hoping someone else here has one of these guys working with their system. I am stuck while even trying to upload the config back to the board. I keep getting an error on the marlin_main.cpp “expected constructor, destructor, or type conversion before ‘(’ token”

Has anyone had any luck or can you point me in the right direction to hopefully get this guy up and running. I like the size of the other but the contrast in my sometimes cold garage is a pain in the butt to look at. This beauty should be awesome!

Thanks in advance.


Can you paste more of the error? Specifically, it points to a file:line, what’s in that line?

It looks like a simple coding error.

Also, that Alibaba link isn’t working.

Nice screen, https://www.aliexpress.com/item/Reprap-Ramps1-4-MKS-12864OLED-display-1-3inch-smart-controller-mini-oled-screen-oled-3d-printer/32702482986.html

They have some serious edits though, they could have just made their board match the one we use instead of all the firmware pin edits.

Did you make the changes to the 3 files in the description for the item?

I appreciate you helping out. I have tried to edit what I thought was right. I am assuming they have renamed the ‘dogm_lcd_implementation.h’ to ‘ultralcd_impl_DOGM’? I thought it was going to be fairly straight forward but I am not having much luck (wife had to work today, so I am stuck home with the kids - only had about 30 minutes to try different configs). I was hoping someone had already set one up and I could ‘borrow’ their code.

I will do a bit more googling as I am not having any luck


No all that is being added to the current code, in the proper file/tab.

They do have a github with that code added but then you would need to make all the mpcnc changes to their file.

Here is where it keeps crapping out.

I have tried to create a blank dogm_lcd_implementation.h as a new tab with the two lines of code only. This error however is under the marlin_main.cpp edit.


I have tried to flash the marlin_mini from here untouched (other than changing motherboard to 43 (ramps1.4)). and it did nothing

I may just have to send an lcd your way Ryan lol. I am awful when it comes to resolving these compiling errors.


You will have to have all the changes in there for it to compile.

So I just tried to whip one up for you but there instructions are for a much older version of marlin. I am not sure where a few of the lines go now in the newer versions we use.

That’s what I was afraid of. Googling has not bbeen much help for me… I am not giving up just yet. This display would be rad.

Hmmm. This is a pickle. I’m sure adding those lines to an empty file aren’t what you want. Those edits are changing the code in a very precise way, but not a very maintainable way. You’ll need to get them to do a similar changes in the current firmware.

I can say those LCD screens are pretty nice. I have one (without the PCB and without the knob) installed in my homemade thermostat. The contrast is fantastic. I can also vouch that the u8glib works with them.

That specific error is because of where you added that snippet of code. You can’t put that code in the global scope. I think it’s safe to add it inside the setup() function. But I have no idea where they intended you to put it (they suggest looking at some example firmware, but I don’t see it).

I think that u8g constructor with the many pins is going to be in ultralcd_impl_DOGM.h:

    #elif ENABLED(U8GLIB_SH1106)
      // Generic support for SH1106 OLED I2C LCDs
      //U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST);  // 8 stripes
      U8GLIB_SH1106_128X64_2X u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST); // 4 stripes

Should probably be something like:

    #elif ENABLED(U8GLIB_SH1106)
      U8GLIB_SH1106_128X64 u8g(23, 17, 16, 25); // SW SPI Com: SCK = 23, MOSI = 17, CS = 16, A0 = 25

This snippet:


	#define DOGLCD
	#define U8GLIB_SH1106
	#define NEWPANEL

Can probably be put at the very end of Configuration.h (but before the “#endif // CONFIGURATION_H”)

Put this stuff:

  pinMode(LCD_PINS_DC, OUTPUT);		  
  pinMode(LCD_PINS_RST, OUTPUT);		
  digitalWrite(LCD_PINS_RST  , LOW);
  digitalWrite(LCD_PINS_RST  , HIGH);

In Marlin_main.cpp inside the:

void setup() {

Put this stuff:

#ifdef LCD_PINS_D5
#undef LCD_PINS_D5
#define LCD_PINS_D5 -1
#ifdef LCD_PINS_D6
#undef LCD_PINS_D6
#define LCD_PINS_D6 -1
#define LCD_PINS_RST  27
#define LCD_PINS_DC   25

At the end of pins.h, but before the #endif //__PINS_H

Jeffeb3 I will give it a go! You rock. Will report back.