From eb75130b019e04373efa310c032a85077e67d144 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 6 Oct 2019 14:56:26 +0200 Subject: blinkencat3: decrease default brightness --- src/app/blinkencat3/main.cc | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/src/app/blinkencat3/main.cc b/src/app/blinkencat3/main.cc index 79753b6..263822e 100644 --- a/src/app/blinkencat3/main.cc +++ b/src/app/blinkencat3/main.cc @@ -21,8 +21,11 @@ class Blinkencat { RGBWHEEL_SLOW, RGBFADE_FAST, RGBFADE_SLOW, + BRIGHTRGBWHEEL_FAST, + BRIGHTRGBWHEEL_SLOW, + BRIGHTRGBFADE_FAST, + BRIGHTRGBFADE_SLOW, COLD_WHITE, - BEEDOO, STROBE, COLOR_STROBE, MODE_ENUM_MAX @@ -139,7 +142,6 @@ void Blinkencat::loop(void) { static uint16_t rgbwheel_offset = 0; static uint16_t rgbfade_hsv = 0; - static uint8_t beedoo_pos = 0; static uint8_t strobe_on = 0; /* @@ -168,7 +170,7 @@ void Blinkencat::loop(void) case RGBWHEEL_SLOW: for (uint16_t i = 0; i < NUM_PIXELS; i++) { uint16_t hsv = (i * 252 + rgbwheel_offset) % 6553; - np.setPixelColor(i, np.gamma32(np.ColorHSV(hsv * 10))); + np.setPixelColor(i, np.gamma32(np.ColorHSV(hsv * 10, 255, 127))); } rgbwheel_offset = (rgbwheel_offset + 10) % 6553; np.show(); @@ -180,7 +182,7 @@ void Blinkencat::loop(void) case RGBFADE_FAST: case RGBFADE_SLOW: for (uint16_t i = 0; i < NUM_PIXELS; i++) { - np.setPixelColor(i, np.ColorHSV(rgbfade_hsv * 10)); + np.setPixelColor(i, np.ColorHSV(rgbfade_hsv * 10, 255, 63)); } rgbfade_hsv = (rgbfade_hsv + 10) % 6553; np.show(); @@ -189,20 +191,37 @@ void Blinkencat::loop(void) _delay_ms(99); } break; - case COLD_WHITE: + case BRIGHTRGBWHEEL_FAST: + case BRIGHTRGBWHEEL_SLOW: for (uint16_t i = 0; i < NUM_PIXELS; i++) { - np.setPixelColor(i, np.Color(127, 127, 127)); + uint16_t hsv = (i * 252 + rgbwheel_offset) % 6553; + np.setPixelColor(i, np.gamma32(np.ColorHSV(hsv * 10))); } + rgbwheel_offset = (rgbwheel_offset + 10) % 6553; np.show(); - sleep(); + _delay_ms(1); + if (mode == BRIGHTRGBWHEEL_SLOW) { + _delay_ms(9); + } break; - case BEEDOO: + case BRIGHTRGBFADE_FAST: + case BRIGHTRGBFADE_SLOW: for (uint16_t i = 0; i < NUM_PIXELS; i++) { - np.setPixelColor(i, np.Color(0, 0, (i+2 - beedoo_pos <= 2) * 255)); + np.setPixelColor(i, np.ColorHSV(rgbfade_hsv * 10)); } + rgbfade_hsv = (rgbfade_hsv + 10) % 6553; np.show(); - beedoo_pos = (beedoo_pos + 1) % NUM_PIXELS; - _delay_ms(20); + _delay_ms(1); + if (mode == BRIGHTRGBFADE_SLOW) { + _delay_ms(99); + } + break; + case COLD_WHITE: + for (uint16_t i = 0; i < NUM_PIXELS; i++) { + np.setPixelColor(i, np.Color(127, 127, 127)); + } + np.show(); + sleep(); break; case STROBE: for (uint16_t i = 0; i < NUM_PIXELS; i++) { -- cgit v1.2.3