From e73906de2627bac605d4894da1d19dfe50042b84 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 17 Mar 2016 18:42:32 +0100 Subject: Fix bug when using FRAMES animation with length % chunksize == 0 --- src/display.cc | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/display.cc b/src/display.cc index b0f5369..0f7a56a 100644 --- a/src/display.cc +++ b/src/display.cc @@ -113,11 +113,6 @@ void Display::update() { str_pos += 8; } if (current_anim->direction == 0) { - 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 - 1) / 128)) && (str_pos > ((current_anim->length - 1) % 128))) { str_chunk = 0; @@ -129,6 +124,10 @@ void Display::update() { if (current_anim->length > 128) { storage.loadChunk(str_chunk, current_anim->data); } + } else if ((current_anim->length > 128) && (str_pos >= 128)) { + str_pos = 0; + str_chunk++; + storage.loadChunk(str_chunk, current_anim->data); } } else { if (str_pos >= 128) { @@ -194,12 +193,9 @@ void Display::show(animation_t *anim) } /* - * Draws a single display column. This function should be called at least once - * per millisecond. - * * Current configuration: - * Called every 256 microseconds. The whole display is refreshed every 2048us, - * giving a refresh rate of ~500Hz + * One interrupt per 256 microseconds. The whole display is refreshed every + * 2048us, giving a refresh rate of ~500Hz */ ISR(TIMER0_OVF_vect) { -- cgit v1.2.3