From 118fdccc786d1661fbc3821eb9872ca2eed1f860 Mon Sep 17 00:00:00 2001 From: "Jan \"Yenya\" Kasprzak" Date: Thu, 30 Aug 2012 00:41:52 +0200 Subject: [PATCH] number pattern --- pattern.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pattern.c b/pattern.c index 0691170..c2942e5 100644 --- a/pattern.c +++ b/pattern.c @@ -91,6 +91,15 @@ void pattern_init() test_running = 0; } +static pattern_t *number_pattern(unsigned char num) +{ + if (num >= 9) + num = 9; + + return pattern_num + sizeof(pattern_num)/sizeof(pattern_t) + - 1 - 2*num; +} + static inline pattern_t *pattern_select(unsigned char n) { if (n < N_PWMLEDS && !pwmled_enabled(n)) @@ -107,8 +116,7 @@ static inline pattern_t *pattern_select(unsigned char n) return mode1_pattern; } } - return pattern_num + sizeof(pattern_num)/sizeof(pattern_t) - - 1 - 2*(1+ambient_zone); + return number_pattern(1+ambient_zone); } static void led_set_mode(unsigned char n, unsigned char mode) -- 2.39.3