Merge pull request #5389 from thinkyhead/distribute_screen_updates
Distribute GLCD screen updates in time
This commit is contained in:
commit
6253b765aa
@ -64,6 +64,9 @@ void lcd_status_screen();
|
|||||||
millis_t next_lcd_update_ms;
|
millis_t next_lcd_update_ms;
|
||||||
|
|
||||||
uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to draw, decrements after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial)
|
uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to draw, decrements after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial)
|
||||||
|
#if ENABLED(DOGLCD)
|
||||||
|
bool drawing_screen = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(DAC_STEPPER_CURRENT)
|
#if ENABLED(DAC_STEPPER_CURRENT)
|
||||||
#include "stepper_dac.h" //was dac_mcp4728.h MarlinMain uses stepper dac for the m-codes
|
#include "stepper_dac.h" //was dac_mcp4728.h MarlinMain uses stepper dac for the m-codes
|
||||||
@ -413,6 +416,9 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
|
|||||||
#endif
|
#endif
|
||||||
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
||||||
screen_changed = true;
|
screen_changed = true;
|
||||||
|
#if ENABLED(DOGLCD)
|
||||||
|
drawing_screen = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2832,6 +2838,9 @@ void lcd_update() {
|
|||||||
|
|
||||||
encoderPosition += (encoderDiff * encoderMultiplier) / ENCODER_PULSES_PER_STEP;
|
encoderPosition += (encoderDiff * encoderMultiplier) / ENCODER_PULSES_PER_STEP;
|
||||||
encoderDiff = 0;
|
encoderDiff = 0;
|
||||||
|
#if ENABLED(DOGLCD)
|
||||||
|
drawing_screen = false; // refresh the complete screen for a encoder change (different menu-item/value)
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
|
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
|
||||||
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
||||||
@ -2864,20 +2873,28 @@ void lcd_update() {
|
|||||||
|
|
||||||
if (LCD_HANDLER_CONDITION) {
|
if (LCD_HANDLER_CONDITION) {
|
||||||
|
|
||||||
if (lcdDrawUpdate) {
|
#if ENABLED(DOGLCD)
|
||||||
|
if (lcdDrawUpdate || drawing_screen)
|
||||||
switch (lcdDrawUpdate) {
|
#else
|
||||||
case LCDVIEW_CALL_NO_REDRAW:
|
if (lcdDrawUpdate)
|
||||||
lcdDrawUpdate = LCDVIEW_NONE;
|
#endif
|
||||||
break;
|
{
|
||||||
case LCDVIEW_CLEAR_CALL_REDRAW: // set by handlers, then altered after (rarely occurs here)
|
#if ENABLED(DOGLCD)
|
||||||
case LCDVIEW_CALL_REDRAW_NEXT: // set by handlers, then altered after (never occurs here?)
|
if (!drawing_screen)
|
||||||
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
#endif
|
||||||
case LCDVIEW_REDRAW_NOW: // set above, or by a handler through LCDVIEW_CALL_REDRAW_NEXT
|
{
|
||||||
case LCDVIEW_NONE:
|
switch (lcdDrawUpdate) {
|
||||||
break;
|
case LCDVIEW_CALL_NO_REDRAW:
|
||||||
} // switch
|
lcdDrawUpdate = LCDVIEW_NONE;
|
||||||
|
break;
|
||||||
|
case LCDVIEW_CLEAR_CALL_REDRAW: // set by handlers, then altered after (rarely occurs here)
|
||||||
|
case LCDVIEW_CALL_REDRAW_NEXT: // set by handlers, then altered after (never occurs here?)
|
||||||
|
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
||||||
|
case LCDVIEW_REDRAW_NOW: // set above, or by a handler through LCDVIEW_CALL_REDRAW_NEXT
|
||||||
|
case LCDVIEW_NONE:
|
||||||
|
break;
|
||||||
|
} // switch
|
||||||
|
}
|
||||||
#if ENABLED(ULTIPANEL)
|
#if ENABLED(ULTIPANEL)
|
||||||
#define CURRENTSCREEN() (*currentScreen)(), lcd_clicked = false
|
#define CURRENTSCREEN() (*currentScreen)(), lcd_clicked = false
|
||||||
#else
|
#else
|
||||||
@ -2885,17 +2902,13 @@ void lcd_update() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(DOGLCD) // Changes due to different driver architecture of the DOGM display
|
#if ENABLED(DOGLCD) // Changes due to different driver architecture of the DOGM display
|
||||||
static int8_t dot_color = 0;
|
if (!drawing_screen) {
|
||||||
dot_color = 1 - dot_color;
|
u8g.firstPage();
|
||||||
u8g.firstPage();
|
drawing_screen = 1;
|
||||||
do {
|
}
|
||||||
lcd_setFont(FONT_MENU);
|
lcd_setFont(FONT_MENU);
|
||||||
u8g.setPrintPos(125, 0);
|
CURRENTSCREEN();
|
||||||
u8g.setColorIndex(dot_color); // Set color for the alive dot
|
if (drawing_screen && (drawing_screen = u8g.nextPage())) return;
|
||||||
u8g.drawPixel(127, 63); // draw alive dot
|
|
||||||
u8g.setColorIndex(1); // black on white
|
|
||||||
CURRENTSCREEN();
|
|
||||||
} while (u8g.nextPage());
|
|
||||||
#else
|
#else
|
||||||
CURRENTSCREEN();
|
CURRENTSCREEN();
|
||||||
#endif
|
#endif
|
||||||
@ -2911,22 +2924,25 @@ void lcd_update() {
|
|||||||
|
|
||||||
#endif // ULTIPANEL
|
#endif // ULTIPANEL
|
||||||
|
|
||||||
switch (lcdDrawUpdate) {
|
#if ENABLED(DOGLCD)
|
||||||
case LCDVIEW_CLEAR_CALL_REDRAW:
|
if (!drawing_screen)
|
||||||
lcd_implementation_clear();
|
#endif
|
||||||
case LCDVIEW_CALL_REDRAW_NEXT:
|
{
|
||||||
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
switch (lcdDrawUpdate) {
|
||||||
break;
|
case LCDVIEW_CLEAR_CALL_REDRAW:
|
||||||
case LCDVIEW_REDRAW_NOW:
|
lcd_implementation_clear();
|
||||||
lcdDrawUpdate = LCDVIEW_NONE;
|
case LCDVIEW_CALL_REDRAW_NEXT:
|
||||||
break;
|
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
||||||
case LCDVIEW_NONE:
|
break;
|
||||||
break;
|
case LCDVIEW_REDRAW_NOW:
|
||||||
} // switch
|
lcdDrawUpdate = LCDVIEW_NONE;
|
||||||
|
break;
|
||||||
|
case LCDVIEW_NONE:
|
||||||
|
break;
|
||||||
|
} // switch
|
||||||
|
}
|
||||||
} // LCD_HANDLER_CONDITION
|
} // LCD_HANDLER_CONDITION
|
||||||
|
} // ELAPSED(ms, next_lcd_update_ms)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_utf_strlen(char* s, uint8_t n) {
|
void set_utf_strlen(char* s, uint8_t n) {
|
||||||
|
@ -145,7 +145,7 @@
|
|||||||
#elif ENABLED(U8GLIB_ST7920)
|
#elif ENABLED(U8GLIB_ST7920)
|
||||||
//U8GLIB_ST7920_128X64_4X u8g(LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS); // Original u8glib device. 2 stripes
|
//U8GLIB_ST7920_128X64_4X u8g(LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS); // Original u8glib device. 2 stripes
|
||||||
// No 4 stripe device available from u8glib.
|
// No 4 stripe device available from u8glib.
|
||||||
//U8GLIB_ST7920_128X64 u8g(LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS); // Original u8glib device. 8 stripes
|
//U8GLIB_ST7920_128X64_1X u8g(LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS); // Original u8glib device. 8 stripes
|
||||||
U8GLIB_ST7920_128X64_RRD u8g(0); // Number of stripes can be adjusted in ultralcd_st7920_u8glib_rrd.h with PAGE_HEIGHT
|
U8GLIB_ST7920_128X64_RRD u8g(0); // Number of stripes can be adjusted in ultralcd_st7920_u8glib_rrd.h with PAGE_HEIGHT
|
||||||
#elif ENABLED(CARTESIO_UI)
|
#elif ENABLED(CARTESIO_UI)
|
||||||
// The CartesioUI display
|
// The CartesioUI display
|
||||||
|
@ -32,8 +32,8 @@
|
|||||||
#define ST7920_CS_PIN LCD_PINS_RS
|
#define ST7920_CS_PIN LCD_PINS_RS
|
||||||
|
|
||||||
//#define PAGE_HEIGHT 8 //128 byte framebuffer
|
//#define PAGE_HEIGHT 8 //128 byte framebuffer
|
||||||
//#define PAGE_HEIGHT 16 //256 byte framebuffer
|
#define PAGE_HEIGHT 16 //256 byte framebuffer
|
||||||
#define PAGE_HEIGHT 32 //512 byte framebuffer
|
//#define PAGE_HEIGHT 32 //512 byte framebuffer
|
||||||
|
|
||||||
#define LCD_PIXEL_WIDTH 128
|
#define LCD_PIXEL_WIDTH 128
|
||||||
#define LCD_PIXEL_HEIGHT 64
|
#define LCD_PIXEL_HEIGHT 64
|
||||||
|
Loading…
Reference in New Issue
Block a user