From b9d468299fc3699c6ae4c10b4b9a683dadb778e7 Mon Sep 17 00:00:00 2001 From: Johannes Kroll Date: Tue, 6 Mar 2012 23:19:49 +0100 Subject: mult stuff fixed --- shiftbrite.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/shiftbrite.c b/shiftbrite.c index a5f319b..048405f 100644 --- a/shiftbrite.c +++ b/shiftbrite.c @@ -94,21 +94,10 @@ void sb_setcolor(uint8_t lamp_index, uint8_t r, uint8_t g, uint8_t b) if(lamp_index >= MAXSHIFTBRITES) return; if(lamp_index+1 > sb_num_shiftbrites) sb_num_shiftbrites= lamp_index+1; - sb_colors[lamp_index].r= r*r>>6; - sb_colors[lamp_index].g= g*g>>6; - sb_colors[lamp_index].b= b*b>>6; + sb_colors[lamp_index].r= (uint16_t)r*r>>6; + sb_colors[lamp_index].g= (uint16_t)g*g>>6; + sb_colors[lamp_index].b= (uint16_t)b*b>>6; - - char ch[256]; - sprintf(ch, "%" PRIx16 " %" PRIx16 " %" PRIx16 "\n", sb_colors[lamp_index].r, sb_colors[lamp_index].g, sb_colors[lamp_index].b); - serial_send(ch, strlen(ch), 1); - - /* works */ -/* - sb_colors[lamp_index].r= ((uint16_t)r*r>>6); - sb_colors[lamp_index].g= ((uint16_t)g*g>>6); - sb_colors[lamp_index].b= ((uint16_t)b*b>>6); -*/ /* updates are now done in sb_tick() sb_update_all_colors(); -- cgit v1.2.1