Skip to content

Commit

Permalink
terminal: avoid double clear without draw
Browse files Browse the repository at this point in the history
  • Loading branch information
vroland committed May 25, 2020
1 parent 35dc854 commit 61e0d80
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions examples/terminal/main/st.c
Original file line number Diff line number Diff line change
Expand Up @@ -2681,18 +2681,23 @@ static GFXfont* get_font(Glyph g) {
return font;
};

static uint64_t updates_since_clear = 0;
static bool drawn_since_clear = true;

static void full_refresh() {
if (!drawn_since_clear) {
return;
}
epd_poweron();
epd_clear_area_cycles(epd_full_screen(), clear_cycles, clear_cycle_length);
epd_poweroff();

for (int i = 0; i < term.row; i++) {
memset(term.old_line[i], 0, term.col * sizeof(Glyph));
}
drawn_since_clear = false;
}

static uint64_t updates_since_clear = 0;

void render() {
memset(render_fb_write, 255, EPD_WIDTH / 2 * EPD_HEIGHT);
memset(render_fb_delete, 255, EPD_WIDTH / 2 * EPD_HEIGHT);
Expand Down Expand Up @@ -2825,6 +2830,7 @@ void render() {
}
epd_draw_image(area, start_ptr, BLACK_ON_WHITE);
epd_poweroff();
drawn_since_clear = true;
}

if (is_full_clear) {
Expand Down

0 comments on commit 61e0d80

Please sign in to comment.