Rob Dobson / Mbed 2 deprecated SpideyWallWeb

Dependencies:   EthernetInterfacePlusHostname RdWebServer mbed-rtos mbed

Revision:
3:e5ea80fae61d
Parent:
1:362331cec9b7
--- a/cmdmsg.cpp	Sat Aug 29 05:33:30 2015 +0000
+++ b/cmdmsg.cpp	Mon Aug 31 09:03:15 2015 +0000
@@ -32,6 +32,7 @@
     (COD & 0x7f) ....
     0x01:
         Clear the entire strip
+        There are no parameters
     0x02:
         Fill a series of leds with RGB values
         <PARAMS> := <START><NUM><RGB1><RGB2>
@@ -85,6 +86,21 @@
             <LINKNUMLEDS> is the number of LEDs to control (1 byte)
             <LINKRGB> is the colour to make the link LEDs (3 bytes)
         
+    0x08:
+        Raw HSV values for a series of leds
+        <PARAMS> := <START><NUM><HSV1><HSV2><HSV3>....<HSVn>
+        Where:
+            <START> is a two byte value (bigendian) for led to start series
+            <NUM> is a two byte (bigendian) number of leds to set
+            <HSV1> is the RGB value for 1st LED (16bits) - first 8 bits = H, upper 4 (bigendian) = S / 16, lower 4 = V / 16
+            <HSV2> is the RGB value for 2nd LED
+            <HSVn> is the RGB value for nth LED
+            
+    0x09:
+        ShowLeds
+        Until this command is sent all other commands simply "paint" into the buffer and don't actually change the LEDs
+        There are no parameters
+
 */
 
 #ifdef USE_SPIDEY_GEOM
@@ -301,6 +317,34 @@
 #endif
                 break;
             }
+            case 0x08: // Raw HSV 
+            {
+                if (paramsLen > 4)
+                {
+                    int startLed = (msg[0] * 256) + msg[1];
+                    int numLeds = (msg[2] * 256) + msg[3];
+                    if (paramsLen >= numLeds * 2 + 4)
+                    {
+                        pLedStrip->HsvFill(startLed, numLeds, msg+4);
+//                        printf("R Q%04x S%d N%d Pa%d\r\n", seqCount, startLed, numLeds, paramsLen);
+                    }
+                    else
+                    {
+                        sprintf(responseStr, "%04x HSV FILL - BufLengthMismatch %d", seqCount, paramsLen);
+                    }
+                }
+                else
+                {
+                    sprintf(responseStr, "%04x HSV FILL - ParamsLen Error %d", seqCount, paramsLen);            
+                }
+                break;
+            }
+            case 0x09: // ShowLeds
+            {
+//                printf("ShowLeds - nextbyte %d\r\n", msg[0]);
+                pLedStrip->ShowLeds();
+                break;
+            }
             default:
             {
                 sprintf(responseStr, "%04x CMD %02x UNKNOWN", seqCount, cmdCode);