diff options
author | Daniel Friesel <derf@finalrewind.org> | 2016-03-12 22:07:12 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2016-03-12 22:07:12 +0100 |
commit | 0ee7d763090e32118829fb897ff8ad4261c3c27e (patch) | |
tree | 4b1c4084adb70f10dd99b45a243b3ce467b834a6 /src/display.cc | |
parent | 31d40607ceaae5dcb78f41fcfe7dbd777f75d485 (diff) |
>255byte pattern support, commit 2/2
Diffstat (limited to 'src/display.cc')
-rw-r--r-- | src/display.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/display.cc b/src/display.cc index ed1880e..025ebbf 100644 --- a/src/display.cc +++ b/src/display.cc @@ -15,6 +15,7 @@ #include "display.h" #include "font.h" +#include "storage.h" Display display; @@ -84,7 +85,7 @@ void Display::update() { if (current_anim->direction == 0) glyph_addr = (uint8_t *)pgm_read_ptr(&font[current_anim->data[str_pos]]); else - glyph_addr = (uint8_t *)pgm_read_ptr(&font[current_anim->data[current_anim->length - 1 - str_pos]]); + glyph_addr = (uint8_t *)pgm_read_ptr(&font[current_anim->data[current_anim->length - 1 - str_pos]]); // XXX Broken by str_chunk changes, FIXME! glyph_len = pgm_read_byte(&glyph_addr[0]); char_pos++; @@ -113,11 +114,21 @@ void Display::update() { } str_pos += 8; } - if (str_pos >= current_anim->length) { + if ((current_anim->length >= 128) && (str_pos >= 128)) { + str_pos = 0; + str_chunk++; + storage.loadChunk(str_chunk, current_anim->data); + } + if ((str_chunk == (current_anim->length / 128)) + && (str_pos >= (current_anim->length % 128))) { + str_chunk = 0; str_pos = 0; if (current_anim->delay > 0) { status = PAUSED; } + if (current_anim->length >= 128) { + storage.loadChunk(str_chunk, current_anim->data); + } } } else if (status == PAUSED) { str_pos++; @@ -134,6 +145,7 @@ void Display::reset() for (uint8_t i = 0; i < 8; i++) disp_buf[i] = 0xff; str_pos = 0; + str_chunk = 0; char_pos = -1; need_update = 1; status = RUNNING; |