 // Only update if turned on
 void updateLED() {
     if (gPowerState) {
-        hslToRgb(gHue, gSaturation, gBrightness);
+        hsvToRgb(gHue, gSaturation, gBrightness);
     } else {
         ledControl(0,0,0);
     }

}

int saturation(String value) {
    int result = -1;
    if (value.length() > 0) {
        float saturationFloat = value.toFloat();


/* LED color manipulation methods */

void hsvToRgb(float h, float s, float v) {
	float r, g, b;
	int i;
	float f, p, q, t;

	if(s == 0) {
		// Achromatic (grey)
		r = g = b = v;
		ledControl(round(r * 255), round(g * 255), round(b * 255));
	}

	h /= 60; // sector 0 to 5
	
	i = floor(h);
	f = h - i; // factorial part of h
	p = v * (1 - s);
	q = v * (1 - s * f);
	t = v * (1 - s * (1 - f));
 
	switch(i) {
		case 0:
			r = v;
			g = t;
			b = p;
			break;
 
		case 1:
			r = q;
			g = v;
			b = p;
			break;
 
		case 2:
			r = p;
			g = v;
			b = t;
			break;
 
		case 3:
			r = p;
			g = q;
			b = v;
			break;
 
		case 4:
			r = t;
			g = p;
			b = v;
			break;
 
		default: // case 5:
			r = v;
			g = p;
			b = q;
	}
 
	ledControl(round(r * 255), round(g * 255), round(b * 255));
}

void ledControl(int redValue, int greenValue, int blueValue)
