Explorar o código

Revert hsv2grb.

Vladimir N. Shilov %!s(int64=2) %!d(string=hai) anos
pai
achega
a9b7204845
Modificáronse 1 ficheiros con 2 adicións e 68 borrados
  1. 2 68
      Src/clock.c

+ 2 - 68
Src/clock.c

@@ -314,7 +314,6 @@ static void IN15_FadeOut(void) {
  * @return none. RGB value output direct to LED.
  */
 static void HSV2LED(const uint8_t hue, const uint8_t sat, const uint8_t val) {
-#ifdef TEST_TEST_TEST
   int base;
   uint32_t r=0, g=0, b=0;
 
@@ -364,72 +363,6 @@ static void HSV2LED(const uint8_t hue, const uint8_t sat, const uint8_t val) {
   COLOR_G((uint8_t)g);
   COLOR_B((uint8_t)b);
 }
-#endif
-
-  uint8_t r, g, b;
-
-  if (sat == 0) {
-    r = val;
-    g = val;
-    b = val;
-  } else {
-
-    uint8_t sextant = hue >> 8;
-    uint8_t tmp;
-
-    // Swap pointers depending which sextant we are in
-		if((sextant) & 2) {
-      tmp = r; r = b; b = tmp;
-		}
-		if((sextant) & 4) {
-      tmp = g; g = b; b = tmp;
-		}
-		if(!((sextant) & 6)) {
-			if(!((sextant) & 1)) {
-        tmp = r; r = g; g = tmp;
-			}
-		} else {
-			if((sextant) & 1) {
-        tmp = r; r = g; g = tmp;
-			}
-		}
-
-    g = val; // Top level
-
-    // Perform actual calculations
-
-    /*
-    * Bottom level: v * (1.0 - s)
-    * --> (v * (255 - s) + error_corr + 1) / 256
-    */
-    uint16_t ww;        // Intermediate result
-    ww = val * (255 - sat); // We don't use ~s to prevent size-promotion side effects
-    ww += 1;            // Error correction
-    ww += ww >> 8;      // Error correction
-    b = ww >> 8;
-
-    uint8_t h_fraction = hue & 0xff; // 0...255
-    uint32_t d;                    // Intermediate result
-
-    if (!(sextant & 1))
-    {
-      // r = ...slope_up...;
-      d = val * (uint32_t)((255 << 8) - (uint16_t)(sat * (256 - h_fraction)));
-      d += d >> 8; // Error correction
-      d += val;      // Error correction
-      r = d >> 16;
-    } else {
-      // r = ...slope_down...;
-      d = val * (uint32_t)((255 << 8) - (uint16_t)(sat * h_fraction));
-      d += d >> 8; // Error correction
-      d += val;      // Error correction
-      r = d >> 16;
-    }
-  }
-  COLOR_R(r);
-  COLOR_G(g);
-  COLOR_B(b);
-}
 
 /**
   * Show info on tubes.
@@ -440,7 +373,8 @@ void showTime(void) {
 
   if (Flag.Now_Day != 0) {
     // new hsv2led
-    uint16_t hue = bcd2bin(Clock.Sec) * 256 / 10;
+    //uint16_t hue = (uint16_t)(bcd2bin(Clock.Sec) * 256) / 10;
+    uint8_t hue = bcd2bin(Clock.Sec);
     HSV2LED(hue, 255, BrightLevel);
   } else {
     HSV2LED(COLOUR_NIXIE, 255, BrightLevel);