The London Hackspace bandwidth meter

Dependencies:   LPD8806 MODSERIAL mbed picojson

See:

Revision:
7:68a26efc1d02
Parent:
6:7e7b4c5d0ba6
Child:
8:add24f73747b
--- a/main.cpp	Sun Oct 21 07:20:24 2012 +0000
+++ b/main.cpp	Sun Oct 21 09:49:41 2012 +0000
@@ -248,19 +248,17 @@
                             printf("SetStrip: %s\r\n", buf);
                             // buf[0] == t or b for strip
                             // next 48 chars == HHH rgb * 16
-                            int p, endp, r, g, b;
-                            if (buf[0] == 't') {
-                                p = 0; endp = p + 16;
-                            } else {
-                                p = 16; endp = p + 16;
+                            int p, endp, r, g, b, poff=16;
+                            p = 0; endp = p + 16;
+                            if (buf[0] == 'b') {
+                                poff = 16;
                             }
 
-
                             for (;p < endp ; p ++) {
                                 r = hex_char_to_int(buf[(p * 3) + 1]);
                                 g = hex_char_to_int(buf[(p * 3) + 2]);
                                 b = hex_char_to_int(buf[(p * 3) + 3]);
-                                strip.setPixelColor(p, strip.Color(r,g,b));
+                                strip.setPixelColor(p + poff , strip.Color(r,g,b));
                             }
                             changed = true;