summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2016-03-17 18:42:32 +0100
committerDaniel Friesel <derf@finalrewind.org>2016-03-17 18:42:32 +0100
commite73906de2627bac605d4894da1d19dfe50042b84 (patch)
tree13584e92c8aeea891fa65dd477c1873535b54dc4
parent04045e50f734d2dc2533facab5b91b9ad444cb54 (diff)
Fix bug when using FRAMES animation with length % chunksize == 0
-rw-r--r--src/display.cc16
1 files 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)
{