<p>According to this question, <a href="https://3dprinting.stackexchange.com/questions/8256/mks-12864oled-display-setup">MKS 12864OLED Display setup</a>, I need to add a patch to "<code>Marlin_main.cpp</code>" but this a large file with 14789 lines of code! I don't know where I have to put this patch. Please help me.</p>

<p><strong>patch:</strong></p>

<pre><code>/*---------------MKS OLED patch_3-----------------------*/
#if defined (MKS_OLED96_128x64_FULL_GRAPHICS_CONTROLLER)
pinMode(LCD_PINS_DC, OUTPUT);
pinMode(LCD_PINS_RST, OUTPUT);
digitalWrite(LCD_PINS_RST , LOW);
delay(1000);
digitalWrite(LCD_PINS_RST , HIGH);
#endif
/*---------------MKS OLED patch_3-----------------------*/
</code></pre>

CC BY-SA 4.0
2019-05-04T21:02:46.653Z
The question you refer to has an incorrect answer, I've investigated it but never got the time to post a proper answer. If I recollect correctly, the latest version is not compatible with the suggested fix. Parts are already implemented in the code. When I have the time I will look into the problem again and post an answer. Note that I do not own such a display.
0scar
CC BY-SA 4.0
2019-05-04T21:11:48.133Z
I did post an [answer](/a/8273/) on [Connecting OLED 128x64 LCD; dogm_lcd_implementation.h is missing for patching](https://3dprinting.stackexchange.com/questions/8272/connecting-oled-128x64-lcd-dogm-lcd-implementation-h-is-missing-for-patching). I guess that is part of the solution. Do note that we are active on [chat]!
0scar
CC BY-SA 4.0
2019-05-04T21:16:05.590Z
Yes, thank you. but it's not working yet. I guess the patch for "Marlin_main.cpp” is needed too.
2012User
CC BY-SA 4.0
2019-05-07T09:51:14.997Z
Please join in [chat] to prevent a long comment discussion. I'll be looking into it tomorrow.
0scar
CC BY-SA 4.0
2019-05-21T16:47:56.057Z
I've seen that kind if ifdef in the .h file, before setup(), in other Arduno programs.  I've never had  a sketch that used  .cpp file, but I suspect if it goes there, it would be after  LCD_PINS_DC and  LCD_PINS_RST were assigned to pins.
CrossRoads
CC BY-SA 4.0
2021-10-28T03:31:46.483Z
From [your comment](https://3dprinting.stackexchange.com/questions/8256/mks-12864oled-display-setup#comment16240_9887), it seems as if @0scar's answer to the previous question fixed your issue. Therefore, closing this as a duplicate.
Greenonline
<marlin><reprap><full-graphic-smart-controller>
How to add a patch to "Marlin_main.cpp"?
2012User
# How to add a patch to "Marlin_main.cpp"?

(Asked by: username_0 on 2019-05-04)

According to this question, MKS 12864OLED Display setup, I need to add a patch to "Marlin_main.cpp" but this a large file with 14789 lines of code! I don't know where I have to put this patch. Please help me.
patch:
/*---------------MKS OLED patch_3-----------------------*/
#if defined (MKS_OLED96_128x64_FULL_GRAPHICS_CONTROLLER)
pinMode(LCD_PINS_DC, OUTPUT);
pinMode(LCD_PINS_RST, OUTPUT);
digitalWrite(LCD_PINS_RST , LOW);
delay(1000);
digitalWrite(LCD_PINS_RST , HIGH);
#endif
/*---------------MKS OLED patch_3-----------------------*/

**Tags:** marlin, reprap, full-graphic-smart-controller
> **Comments:**
> **username_1**: The question you refer to has an incorrect answer, I've investigated it but never got the time to post a proper answer. If I recollect correctly, the latest version is not compatible with the suggested fix. Parts are already implemented in the code. When I have the time I will look into the problem again and post an answer. Note that I do not own such a display.  
> **username_1**: I did post an [answer](/a/8273/) on [Connecting OLED 128x64 LCD; dogm_lcd_implementation.h is missing for patching](https://3dprinting.stackexchange.com/questions/8272/connecting-oled-128x64-lcd-dogm-lcd-implementation-h-is-missing-for-patching). I guess that is part of the solution. Do note that we are active on [chat]!  
> **username_0**: Yes, thank you. but it's not working yet. I guess the patch for "Marlin_main.cpp” is needed too.  
> **username_1**: Please join in [chat] to prevent a long comment discussion. I'll be looking into it tomorrow.  
> **username_2**: I've seen that kind if ifdef in the .h file, before setup(), in other Arduno programs.  I've never had  a sketch that used  .cpp file, but I suspect if it goes there, it would be after  LCD_PINS_DC and  LCD_PINS_RST were assigned to pins.  
> **username_3**: From [your comment](https://3dprinting.stackexchange.com/questions/8256/mks-12864oled-display-setup#comment16240_9887), it seems as if @0scar's answer to the previous question fixed your issue. Therefore, closing this as a duplicate.  

---

## 0 answers

