Bladeren bron

Fix Menu Mixer for Color UI (#20566)

Victor Oliveira 4 jaren geleden
bovenliggende
commit
185e31d322
No account linked to committer's email address

+ 9
- 0
Marlin/src/lcd/menu/menu_mixer.cpp Bestand weergeven

33
 
33
 
34
 #include "../../feature/mixing.h"
34
 #include "../../feature/mixing.h"
35
 
35
 
36
+#if HAS_GRAPHICAL_TFT
37
+  #include "../tft/tft.h"
38
+#endif
39
+
36
 #define CHANNEL_MIX_EDITING !HAS_DUAL_MIXING
40
 #define CHANNEL_MIX_EDITING !HAS_DUAL_MIXING
37
 
41
 
38
 #if ENABLED(GRADIENT_MIX)
42
 #if ENABLED(GRADIENT_MIX)
67
       mixer.refresh_gradient();
71
       mixer.refresh_gradient();
68
       ui.goto_previous_screen();
72
       ui.goto_previous_screen();
69
     }
73
     }
74
+    else {
75
+      TERN_(HAS_GRAPHICAL_TFT, tft.draw_edit_screen_buttons());
76
+    }
70
   }
77
   }
71
 
78
 
72
   void lcd_mixer_edit_gradient_menu() {
79
   void lcd_mixer_edit_gradient_menu() {
155
       ui.goto_previous_screen();
162
       ui.goto_previous_screen();
156
     }
163
     }
157
 
164
 
165
+    TERN_(HAS_GRAPHICAL_TFT, tft.draw_edit_screen_buttons());
166
+
158
   #else
167
   #else
159
 
168
 
160
     START_MENU();
169
     START_MENU();

+ 1
- 0
Marlin/src/lcd/tft/tft.h Bestand weergeven

93
     static inline void add_image(int16_t x, int16_t y, MarlinImage image, uint16_t color_main = COLOR_WHITE, uint16_t color_background = COLOR_BACKGROUND, uint16_t color_shadow = COLOR_BLACK) { queue.add_image(x, y, image, color_main,  color_background, color_shadow); }
93
     static inline void add_image(int16_t x, int16_t y, MarlinImage image, uint16_t color_main = COLOR_WHITE, uint16_t color_background = COLOR_BACKGROUND, uint16_t color_shadow = COLOR_BLACK) { queue.add_image(x, y, image, color_main,  color_background, color_shadow); }
94
     static inline void add_bar(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.add_bar(x, y, width, height, color); }
94
     static inline void add_bar(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.add_bar(x, y, width, height, color); }
95
     static inline void add_rectangle(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.add_rectangle(x, y, width, height, color); }
95
     static inline void add_rectangle(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.add_rectangle(x, y, width, height, color); }
96
+    static void draw_edit_screen_buttons();
96
 };
97
 };
97
 
98
 
98
 extern TFT tft;
99
 extern TFT tft;

+ 21
- 0
Marlin/src/lcd/tft/ui_320x240.cpp Bestand weergeven

442
     #endif
442
     #endif
443
   }
443
   }
444
 
444
 
445
+  tft.draw_edit_screen_buttons();
446
+}
447
+
448
+void TFT::draw_edit_screen_buttons() {
445
   #if ENABLED(TOUCH_SCREEN)
449
   #if ENABLED(TOUCH_SCREEN)
446
     add_control(32, 176, DECREASE, imgDecrease);
450
     add_control(32, 176, DECREASE, imgDecrease);
447
     add_control(224, 176, INCREASE, imgIncrease);
451
     add_control(224, 176, INCREASE, imgIncrease);
658
   #endif
662
   #endif
659
 }
663
 }
660
 
664
 
665
+void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row) {
666
+  #define TFT_COL_WIDTH ((TFT_WIDTH) / (LCD_WIDTH))
667
+  tft.canvas(col * TFT_COL_WIDTH, 4 + 45 * row, TFT_WIDTH - (col * TFT_COL_WIDTH), 43);
668
+  tft.set_background(COLOR_BACKGROUND);
669
+}
670
+
671
+int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
672
+  tft_string.set(utf8_str_P);
673
+  tft_string.trim();
674
+  tft.add_text(MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
675
+  return tft_string.width();
676
+}
677
+
678
+int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) {
679
+  return lcd_put_u8str_max_P(utf8_str, max_length);
680
+}
681
+
661
 void MarlinUI::move_axis_screen() {
682
 void MarlinUI::move_axis_screen() {
662
 }
683
 }
663
 
684
 

+ 21
- 0
Marlin/src/lcd/tft/ui_480x320.cpp Bestand weergeven

445
     #endif
445
     #endif
446
   }
446
   }
447
 
447
 
448
+  tft.draw_edit_screen_buttons();
449
+}
450
+
451
+void TFT::draw_edit_screen_buttons() {
448
   #if ENABLED(TOUCH_SCREEN)
452
   #if ENABLED(TOUCH_SCREEN)
449
     add_control(64, 256, DECREASE, imgDecrease);
453
     add_control(64, 256, DECREASE, imgDecrease);
450
     add_control(352, 256, INCREASE, imgIncrease);
454
     add_control(352, 256, INCREASE, imgIncrease);
661
   #endif
665
   #endif
662
 }
666
 }
663
 
667
 
668
+void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row) {
669
+  #define TFT_COL_WIDTH ((TFT_WIDTH) / (LCD_WIDTH))
670
+  tft.canvas(col * TFT_COL_WIDTH, 4 + 45 * row, TFT_WIDTH - (col * TFT_COL_WIDTH), 43);
671
+  tft.set_background(COLOR_BACKGROUND);
672
+}
673
+
674
+int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
675
+  tft_string.set(utf8_str_P);
676
+  tft_string.trim();
677
+  tft.add_text(MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
678
+  return tft_string.width();
679
+}
680
+
681
+int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) {
682
+  return lcd_put_u8str_max_P(utf8_str, max_length);
683
+}
684
+
664
 #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
685
 #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
665
   #include "../../feature/babystep.h"
686
   #include "../../feature/babystep.h"
666
 #endif
687
 #endif

Laden…
Annuleren
Opslaan