Browse Source

Fix: Contrast override in pins files

Move contrast handling to `Conditionals_post.h` so pins files can override the LCD defaults.
Scott Lahteine 6 years ago
parent
commit
04a9962cb5
2 changed files with 46 additions and 33 deletions
  1. 0
    26
      Marlin/src/inc/Conditionals_LCD.h
  2. 46
    7
      Marlin/src/inc/Conditionals_post.h

+ 0
- 26
Marlin/src/inc/Conditionals_LCD.h View File

30
 
30
 
31
   #define DOGLCD
31
   #define DOGLCD
32
   #define IS_ULTIPANEL
32
   #define IS_ULTIPANEL
33
-  #define LCD_CONTRAST_MIN  60
34
-  #define LCD_CONTRAST_MAX 140
35
-  #define LCD_CONTRAST_INIT 90
36
 
33
 
37
 #elif ENABLED(ZONESTAR_LCD)
34
 #elif ENABLED(ZONESTAR_LCD)
38
 
35
 
63
   #define IS_ULTIPANEL
60
   #define IS_ULTIPANEL
64
 
61
 
65
   #if ENABLED(miniVIKI)
62
   #if ENABLED(miniVIKI)
66
-    #define LCD_CONTRAST_MIN      75
67
-    #define LCD_CONTRAST_MAX     115
68
-    #define LCD_CONTRAST_INIT     95
69
     #define U8GLIB_ST7565_64128N
63
     #define U8GLIB_ST7565_64128N
70
   #elif ENABLED(VIKI2)
64
   #elif ENABLED(VIKI2)
71
-    #define LCD_CONTRAST_MIN       0
72
-    #define LCD_CONTRAST_MAX     255
73
-    #define LCD_CONTRAST_INIT    140
74
     #define U8GLIB_ST7565_64128N
65
     #define U8GLIB_ST7565_64128N
75
   #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
66
   #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
76
-    #define LCD_CONTRAST_MIN      90
77
-    #define LCD_CONTRAST_MAX     130
78
-    #define LCD_CONTRAST_INIT    110
79
     #define U8GLIB_LM6059_AF
67
     #define U8GLIB_LM6059_AF
80
     #define SD_DETECT_INVERTED
68
     #define SD_DETECT_INVERTED
81
   #elif ENABLED(AZSMZ_12864)
69
   #elif ENABLED(AZSMZ_12864)
82
-    #define LCD_CONTRAST_MIN     120
83
-    #define LCD_CONTRAST_MAX     255
84
-    #define LCD_CONTRAST_INIT    190
85
     #define U8GLIB_ST7565_64128N
70
     #define U8GLIB_ST7565_64128N
86
   #endif
71
   #endif
87
 
72
 
128
 #elif ENABLED(MKS_MINI_12864)
113
 #elif ENABLED(MKS_MINI_12864)
129
 
114
 
130
   #define MINIPANEL
115
   #define MINIPANEL
131
-  #define LCD_CONTRAST_MAX  255
132
-  #define LCD_CONTRAST_INIT 150
133
 
116
 
134
 #elif ANY(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1)
117
 #elif ANY(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1)
135
 
118
 
136
   #define FYSETC_MINI_12864
119
   #define FYSETC_MINI_12864
137
   #define DOGLCD
120
   #define DOGLCD
138
   #define IS_ULTIPANEL
121
   #define IS_ULTIPANEL
139
-  #define LCD_CONTRAST_MIN    0
140
-  #define LCD_CONTRAST_MAX  255
141
-  #define LCD_CONTRAST_INIT 220
142
   #define LED_COLORS_REDUCE_GREEN
122
   #define LED_COLORS_REDUCE_GREEN
143
   #if HAS_POWER_SWITCH && EITHER(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1)
123
   #if HAS_POWER_SWITCH && EITHER(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1)
144
     #define LED_BACKLIGHT_TIMEOUT 10000
124
     #define LED_BACKLIGHT_TIMEOUT 10000
166
   #define IS_ULTIPANEL
146
   #define IS_ULTIPANEL
167
   #define U8GLIB_SSD1309
147
   #define U8GLIB_SSD1309
168
   #define LCD_RESET_PIN LCD_PINS_D6 //  This controller need a reset pin
148
   #define LCD_RESET_PIN LCD_PINS_D6 //  This controller need a reset pin
169
-  #define LCD_CONTRAST_MIN    0
170
-  #define LCD_CONTRAST_MAX  254
171
-  #define LCD_CONTRAST_INIT 127
172
   #define ENCODER_PULSES_PER_STEP 2
149
   #define ENCODER_PULSES_PER_STEP 2
173
   #define ENCODER_STEPS_PER_MENU_ITEM 2
150
   #define ENCODER_STEPS_PER_MENU_ITEM 2
174
 
151
 
190
   #if ENABLED(MAKRPANEL)
167
   #if ENABLED(MAKRPANEL)
191
     #define U8GLIB_ST7565_64128N
168
     #define U8GLIB_ST7565_64128N
192
   #endif
169
   #endif
193
-  #ifndef LCD_CONTRAST_INIT
194
-    #define LCD_CONTRAST_INIT    17
195
-  #endif
196
 #endif
170
 #endif
197
 
171
 
198
 #if ENABLED(IS_U8GLIB_SSD1306)
172
 #if ENABLED(IS_U8GLIB_SSD1306)

+ 46
- 7
Marlin/src/inc/Conditionals_post.h View File

247
 #endif
247
 #endif
248
 
248
 
249
 /**
249
 /**
250
- * Default LCD contrast for Graphical LCD displays
250
+ * LCD Contrast for Graphical Displays
251
  */
251
  */
252
-#define HAS_LCD_CONTRAST defined(LCD_CONTRAST_INIT)
252
+#if ENABLED(CARTESIO_UI)
253
+  #define _LCD_CONTRAST_MIN   60
254
+  #define _LCD_CONTRAST_INIT  90
255
+  #define _LCD_CONTRAST_MAX  140
256
+#elif ENABLED(miniVIKI)
257
+  #define _LCD_CONTRAST_MIN   75
258
+  #define _LCD_CONTRAST_INIT  95
259
+  #define _LCD_CONTRAST_MAX  115
260
+#elif ENABLED(VIKI2)
261
+  #define _LCD_CONTRAST_INIT 140
262
+#elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
263
+  #define _LCD_CONTRAST_MIN   90
264
+  #define _LCD_CONTRAST_INIT 110
265
+  #define _LCD_CONTRAST_MAX  130
266
+#elif ENABLED(AZSMZ_12864)
267
+  #define _LCD_CONTRAST_MIN  120
268
+  #define _LCD_CONTRAST_INIT 190
269
+#elif ENABLED(MKS_MINI_12864)
270
+  #define _LCD_CONTRAST_INIT 150
271
+#elif ANY(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1)
272
+  #define _LCD_CONTRAST_INIT 220
273
+#elif ENABLED(ULTI_CONTROLLER)
274
+  #define _LCD_CONTRAST_INIT 127
275
+  #define _LCD_CONTRAST_MAX  254
276
+#elif EITHER(MAKRPANEL, MINIPANEL)
277
+  #define _LCD_CONTRAST_INIT  17
278
+#endif
279
+
280
+#define HAS_LCD_CONTRAST defined(_LCD_CONTRAST_INIT)
253
 #if HAS_LCD_CONTRAST
281
 #if HAS_LCD_CONTRAST
254
-  #ifndef DEFAULT_LCD_CONTRAST
255
-    #define DEFAULT_LCD_CONTRAST LCD_CONTRAST_INIT
256
-  #endif
257
   #ifndef LCD_CONTRAST_MIN
282
   #ifndef LCD_CONTRAST_MIN
258
-    #define LCD_CONTRAST_MIN 0
283
+    #ifdef _LCD_CONTRAST_MIN
284
+      #define LCD_CONTRAST_MIN _LCD_CONTRAST_MIN
285
+    #else
286
+      #define LCD_CONTRAST_MIN 0
287
+    #endif
288
+  #endif
289
+  #ifndef LCD_CONTRAST_INIT
290
+    #define LCD_CONTRAST_INIT _LCD_CONTRAST_INIT
259
   #endif
291
   #endif
260
   #ifndef LCD_CONTRAST_MAX
292
   #ifndef LCD_CONTRAST_MAX
261
-    #define LCD_CONTRAST_MAX MAX(63, LCD_CONTRAST_INIT)
293
+    #ifdef _LCD_CONTRAST_MAX
294
+      #define LCD_CONTRAST_MAX _LCD_CONTRAST_MAX
295
+    #else
296
+      #define LCD_CONTRAST_MAX 63
297
+    #endif
298
+  #endif
299
+  #ifndef DEFAULT_LCD_CONTRAST
300
+    #define DEFAULT_LCD_CONTRAST LCD_CONTRAST_INIT
262
   #endif
301
   #endif
263
 #endif
302
 #endif
264
 
303
 

Loading…
Cancel
Save