diff --git a/platformio.ini b/platformio.ini index e584623d5..84e756278 100644 --- a/platformio.ini +++ b/platformio.ini @@ -30,15 +30,10 @@ build_flags = #build_flags for the IRremoteESP8266 library (enabled decoders have to appear here) -D _IR_ENABLE_DEFAULT_=false -D DECODE_HASH=true - -D DECODE_NEC=true -D DECODE_SONY=true - -D DECODE_PANASONIC=true - -D DECODE_JVC=true -D DECODE_SAMSUNG=true -D DECODE_LG=true - -D DECODE_SANYO=true - -D DECODE_SHARP=true - -D DECODE_DENON=true + # TODO replace libs in /lib with managed libs in here if possible. # If they are not changed it's just a matter of setting the correct version and change the import statement lib_deps_external = @@ -52,8 +47,7 @@ lib_deps_external = Esp Async WebServer@1.2.0 #ArduinoJson@5.13.5 #IRremoteESP8266@2.7.2 - #For saving 20k program space the brnach "compile_flags" will be used: - https://github.com/crankyoldgit/IRremoteESP8266.git#compile_flags + https://github.com/crankyoldgit/IRremoteESP8266.git #Time@1.5 #Timezone@1.2.1 #For use SSD1306 0.91" OLED display uncomment following diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 14a46b534..0c82f4ab9 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -2976,3 +2976,31 @@ uint16_t WS2812FX::mode_plasma(void) { return FRAMETIME; } + +/* + * Percentage display + * Intesity values from 0-100 turn on the leds. + */ +uint16_t WS2812FX::mode_percent(void) { + + uint8_t percent = max(0, min(100, SEGMENT.intensity)); + + float active_float = SEGLEN * percent / 100.0; + uint16_t active_leds = active_float; + uint16_t active_part = (active_float - active_leds) * 255; + CRGB color; + + for (uint16_t i = 0; i < SEGLEN; i++) { + if (i < active_leds) { + setPixelColor(i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 0)); + } + else if (i == active_leds) { + setPixelColor(i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 0, active_part)); + } + else { + setPixelColor(i, SEGCOLOR(1)); + } + } + + return FRAMETIME; +} \ No newline at end of file diff --git a/wled00/FX.h b/wled00/FX.h index 2ed1f2f4b..d4bf4ff5d 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -91,7 +91,7 @@ #define IS_REVERSE ((SEGMENT.options & REVERSE ) == REVERSE ) #define IS_SELECTED ((SEGMENT.options & SELECTED) == SELECTED ) -#define MODE_COUNT 98 +#define MODE_COUNT 99 #define FX_MODE_STATIC 0 #define FX_MODE_BLINK 1 @@ -191,7 +191,7 @@ #define FX_MODE_POPCORN 95 #define FX_MODE_DRIP 96 #define FX_MODE_PLASMA 97 - +#define FX_MODE_PERCENT 98 class WS2812FX { typedef uint16_t (WS2812FX::*mode_ptr)(void); @@ -378,6 +378,7 @@ class WS2812FX { _mode[FX_MODE_POPCORN] = &WS2812FX::mode_popcorn; _mode[FX_MODE_DRIP] = &WS2812FX::mode_drip; _mode[FX_MODE_PLASMA] = &WS2812FX::mode_plasma; + _mode[FX_MODE_PERCENT] = &WS2812FX::mode_percent; _brightness = DEFAULT_BRIGHTNESS; currentPalette = CRGBPalette16(CRGB::Black); @@ -560,7 +561,8 @@ class WS2812FX { mode_sinelon_rainbow(void), mode_popcorn(void), mode_drip(void), - mode_plasma(void); + mode_plasma(void), + mode_percent(void); private: @@ -640,7 +642,7 @@ const char JSON_mode_names[] PROGMEM = R"=====([ "Scanner Dual","Stream 2","Oscillate","Pride 2015","Juggle","Palette","Fire 2012","Colorwaves","Bpm","Fill Noise", "Noise 1","Noise 2","Noise 3","Noise 4","Colortwinkles","Lake","Meteor","Meteor Smooth","Railway","Ripple", "Twinklefox","Twinklecat","Halloween Eyes","Solid Pattern","Solid Pattern Tri","Spots","Spots Fade","Glitter","Candle","Fireworks Starburst", -"Fireworks 1D","Bouncing Balls","Sinelon","Sinelon Dual","Sinelon Rainbow","Popcorn","Drip","Plasma" +"Fireworks 1D","Bouncing Balls","Sinelon","Sinelon Dual","Sinelon Rainbow","Popcorn","Drip","Plasma","Percent" ])====="; diff --git a/wled00/html_settings.h b/wled00/html_settings.h index e99c03c58..d6cf7490d 100644 --- a/wled00/html_settings.h +++ b/wled00/html_settings.h @@ -189,7 +189,7 @@ const char PAGE_settings_sync[] PROGMEM = R"=====(