|
@@ -308,19 +308,18 @@ static void IN15_FadeOut(void) {
|
|
|
* @param hue: 0-59, sat: 0-255, val (lightness): 0-255
|
|
|
* @return none. RGB value output direct to LED.
|
|
|
*/
|
|
|
-#define HUE_DEGREE 60
|
|
|
static void HSV2LED(const int hue, const uint8_t sat, const uint8_t val) {
|
|
|
uint8_t r, g, b;
|
|
|
|
|
|
int h = hue;
|
|
|
int s = sat;
|
|
|
int v = val;
|
|
|
- int i = h / (60 * HUE_DEGREE);
|
|
|
+ int i = h / 60;
|
|
|
int p = (256 * v - s * v) / 256;
|
|
|
|
|
|
if (i & 1)
|
|
|
{
|
|
|
- int q = (256 * 60 * HUE_DEGREE * v - h * s * v + 60 * HUE_DEGREE * s * v * i) / (256 * 60 * HUE_DEGREE);
|
|
|
+ int q = (256 * 60 * v - h * s * v + 60 * s * v * i) / (256 * 60);
|
|
|
switch (i)
|
|
|
{
|
|
|
case 1:
|
|
@@ -342,7 +341,7 @@ static void HSV2LED(const int hue, const uint8_t sat, const uint8_t val) {
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- int t = (256 * 60 * HUE_DEGREE * v + h * s * v - 60 * HUE_DEGREE * s * v * (i + 1)) / (256 * 60 * HUE_DEGREE);
|
|
|
+ int t = (256 * 60 * v + h * s * v - 60 * s * v * (i + 1)) / (256 * 60);
|
|
|
switch (i)
|
|
|
{
|
|
|
case 0:
|
|
@@ -427,9 +426,7 @@ void showTime(void) {
|
|
|
RTOS_SetTask(MinusFadeOut, 500, 0);
|
|
|
|
|
|
if (Flag.Now_Day != 0) {
|
|
|
- // new hsv2led
|
|
|
- //uint16_t hue = (uint16_t)(bcd2bin(Clock.Sec) * 256) / 10;
|
|
|
- uint8_t hue = bcd2bin(Clock.Sec);
|
|
|
+ int hue = 6 * bcd2bin(Clock.Sec);
|
|
|
HSV2LED(hue, 255, BrightLevel);
|
|
|
} else {
|
|
|
HSV2LED(COLOUR_NIXIE, 255, BrightLevel);
|
|
@@ -447,7 +444,7 @@ void showMMSS(void) {
|
|
|
RTOS_DeleteTask(MinusFadeOut);
|
|
|
IN15_Minus;
|
|
|
|
|
|
- uint8_t hue = bcd2bin(Clock.Sec);
|
|
|
+ int hue = 6 * bcd2bin(Clock.Sec);
|
|
|
HSV2LED(hue, 255, BrightLevel);
|
|
|
|
|
|
tube4_t buf;
|