summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2016-01-29 16:57:52 +0100
committerDaniel Friesel <derf@finalrewind.org>2016-01-29 16:57:52 +0100
commit8b1bad7e3e8d9311cb881e4df2101203f5a1eb9e (patch)
tree194c95163163e52f215e46e678a4e7c0c5abc65b
parentedf5f5ab92520b6af3151bca2b97c618a9d1d7f9 (diff)
check ->length for texts, too
-rw-r--r--src/display.cc10
-rw-r--r--src/main.cc4
2 files changed, 5 insertions, 9 deletions
diff --git a/src/display.cc b/src/display.cc
index 5a652c8..970d823 100644
--- a/src/display.cc
+++ b/src/display.cc
@@ -74,10 +74,6 @@ void Display::update() {
str_pos++;
}
- if (active_anim->data[str_pos] == 0) {
- str_pos = 0;
- }
-
if (char_pos == 0) {
disp_buf[7] = 0xff; // whitespace
} else {
@@ -88,9 +84,9 @@ void Display::update() {
disp_buf[i] = ~active_anim->data[str_pos+i];
}
str_pos += 8;
- if (str_pos == active_anim->length) {
- str_pos = 0;
- }
+ }
+ if (str_pos >= active_anim->length) {
+ str_pos = 0;
}
}
}
diff --git a/src/main.cc b/src/main.cc
index a8fb5d3..91ff92a 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -15,8 +15,8 @@ int main (void)
animation_t ohai;
ohai.mode = AnimationType::TEXT;
ohai.speed = (4 << 4) + 15;
- ohai.data = (uint8_t *)"Ohai! ";
- ohai.length = 6;
+ ohai.data = (uint8_t *)"\001 Ohai ";
+ ohai.length = 8;
uint8_t anim_data[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0 };