From 09d120b9a835002c1971734f983dcdf8652a4f79 Mon Sep 17 00:00:00 2001 From: Christian Kroll Date: Mon, 23 May 2011 22:55:25 +0000 Subject: [PATCH] fixed framebuffer bugs --- animations/fpmath_patterns.c | 6 +++--- animations/gameoflife.c | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/animations/fpmath_patterns.c b/animations/fpmath_patterns.c index 54f10a7..635544c 100644 --- a/animations/fpmath_patterns.c +++ b/animations/fpmath_patterns.c @@ -45,9 +45,9 @@ static double dist(double x1, double y1, double x2, double y2) * Draws an animated two dimensional graph for a given function f(x,y,t). * @param t_start start value for the function's time variable * @param t_stop stop value for the function's time variable - * @param t_delta value by which the functions timing variable gets incremented + * @param t_delta value by which the function's timing variable gets incremented * @param frame_delay frame delay in ms - * @param fpPattern function which generates a pattern depending x, y, t + * @param fpPattern function which generates a pattern depending on x, y, t */ static void fpmath_pattern(double const t_start, double const t_stop, @@ -68,7 +68,7 @@ static void fpmath_pattern(double const t_start, unsigned char color = fpPattern(x, y, t); for (uint8_t p = NUMPLANE; p--;) { - if (p == (color - 1)) + if (p <= (color - 1)) { BUFFER[p][y][x / 8] |= shl_table[x % 8U]; } diff --git a/animations/gameoflife.c b/animations/gameoflife.c index 4fc895f..f849075 100644 --- a/animations/gameoflife.c +++ b/animations/gameoflife.c @@ -59,7 +59,7 @@ #define LOOP_DETECT_BUFFER_SIZE 8U #ifndef GOL_DELAY -#define GOL_DELAY 1 /* milliseconds */ +#define GOL_DELAY 100 /* milliseconds */ #endif #ifndef GOL_CYCLES @@ -170,8 +170,10 @@ void nextiteration(field_t dest, field_t src) { /******************************************************************************/ #ifdef BITSTUFFED -static void pfprint(field_t pf) { - memcpy(pixmap[NUMPLANE - 1], pf, sizeof(field_t)); +void pfprint(field_t pf) { + for (uint8_t i = NUMPLANE; i--;) { + memcpy(pixmap[i], pf, sizeof(field_t)); + } } #else void pfprint(field_t pf) { @@ -292,7 +294,6 @@ void gameoflife() { /* the main part */ pfprint(pf1); for (cycle = 1; cycle < GOL_CYCLES; ++cycle) { - wait(100); DEBUG_BYTE(0, (uint8_t)(GOL_CYCLES-cycle) & 0xff); DEBUG_BYTE(1, SREG); wait(GOL_DELAY); pfcopy(pf2, pf1);