diff --git a/README.md b/README.md index 24bda5523..854a41835 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ # Glow Worm Luciferin +Ambient Lighting or Bias Light is a technology that enhances your viewing experience by projecting colored lights onto the wall behind your TV/Monitor, matching the colors on the screen. This creates a more immersive and engaging atmosphere, making your favorite shows, movies, and games feel even more captivating. + **Luciferin** is a generic term for the light-emitting compound found in organisms that generate bioluminescence like Fireflies and Glow Worms. `Glow Worm Luciferin is a firmware` for ESP8266/ESP32 boards designed for the [Firefly Luciferin](https://github.com/sblantipodi/firefly_luciferin) software, the combination of these software create the perfect diff --git a/docs/webInterface_1.5.0.slim.min.js b/docs/webInterface_1.5.0.slim.min.js new file mode 100644 index 000000000..65beb0807 --- /dev/null +++ b/docs/webInterface_1.5.0.slim.min.js @@ -0,0 +1,187 @@ +function poll() { + var poll = (promiseFn, time) => promiseFn().then(sleep(time).then(() => poll(promiseFn, time))) + poll(() => new Promise(() => { + const http = new XMLHttpRequest(); + http.open('GET', 'prefs'); + http.send(); + http.onload = () => { + console.log(http.responseText); + var prefs = JSON.parse(http.responseText); + console.log(prefs); + if (prefs.toggle == '0') { + $('#toggleLED').css('background-color','lightgrey'); + $('#toggleLED')[0].textContent = "Turn ON"; + $('#toggleLED').removeClass("active"); + } else if (prefs.toggle == '1') { + $('#toggleLED').css('background-color','orange'); + $('#toggleLED')[0].textContent = "Turn OFF"; + $('#toggleLED').addClass("active"); + } + if (prefs.effect == "GlowWormWifi") { + $('#effectSelect').val((prefs.ffeffect.length == 0 || prefs.ffeffect == 'null') ? 'Solid' : prefs.ffeffect); + } else { + $('#effectSelect').val((prefs.effect.length == 0 || prefs.effect == 'null') ? 'Solid' : prefs.effect); + } + kelvinPicker.color.set({ kelvin: (prefs.whiteTemp*100) }); + if (prefs.whiteTemp == 65) { $("#ut").show(); } else { $("#ut").hide(); } + if (prefs.cp.length > 0) { + colorPicker.color.rgb = { r: prefs.cp.split(',')[0], g: prefs.cp.split(',')[1], b: prefs.cp.split(',')[2] } + } + brightnessSlider.color.rgb = colorPicker.color.rgb; + brightnessSlider.colors[0].value=Math.round((100*prefs.brightness)/255); + $('#gitlink').text("Glow Worm Luciferin (V"+prefs.VERSION+')'); + if (prefs.wifi >= 0) { + $('#wifi').text(prefs.wifi + '% '); + $('#wf').show(); + $('#et').hide(); + } else { + $('#wf').hide(); + $('#et').show(); + } + $('#fps').text(prefs.framerate + 'FPS'); + if (prefs.ldr) { + $('#ldrgrp').show(); + $('#ldr').text(Math.round(prefs.ldr) + '%'); + } else { + $('#ldrgrp').hide(); + } + $("#autosave").prop('checked', prefs.autosave == 1); + } + }), 5000); +} +function callDevice(payload) { + console.log(payload); + const http = new XMLHttpRequest(); + http.open('GET', 'set?payload=' + payload); + http.send(); + http.onload = () => console.log(http.responseText); +} +function createPayload() { + var toggleLED = $('#toggleLED')[0]; + var payload = { + state: toggleLED.classList.contains('active') ? 'ON' : 'OFF', + effect: $('#effectSelect').val(), + color: colorPicker.color.rgb, + whitetemp: Math.round(kelvinPicker.color.kelvin/100), + brightness: Math.round((brightnessSlider.color.value * 255) / 100), + allInstances: 1 + } + return payload; +} +var colorPicker = new iro.ColorPicker('#picker', { + width: 320, + color: '#0091ff', + layout: [ + { + component: iro.ui.Wheel + } + ] +}); +var brightnessSlider = new iro.ColorPicker("#brightnessSlider", { + width: 300, + color: colorPicker.color.rgb, + borderWidth: 1, + borderColor: "#fff", + layout: [ + { + component: iro.ui.Slider, + options: { + sliderType: 'value' + } + } + ] +}); +var kelvinPicker = new iro.ColorPicker("#kelvinPicker", { + width: 360, + color: "rgb(255, 0, 0)", + borderWidth: 1, + borderColor: "#fff", + layoutDirection: 'vertical', + layout: [ + { + component: iro.ui.Slider, + options: { + sliderType: 'kelvin', + sliderSize: 40, + minTemperature: 2000, + maxTemperature: 11000 + } + }, + ] +}); +$('#effectSelect').change(function () { + callDevice(JSON.stringify(createPayload())); +}); +$('#whiteTempSelect').change(function () { + callDevice(JSON.stringify(createPayload())); +}); +brightnessSlider.on(['input:end'], function(color) { + callDevice(JSON.stringify(createPayload())); +}); +kelvinPicker.on(['input:end'], function(color) { + callDevice(JSON.stringify(createPayload())); +}); +kelvinPicker.on(['color:change'], function(color) { + if (Math.round(kelvinPicker.color.kelvin/100) == 65) { $("#ut").show(); } else { $("#ut").hide(); } +}); +$('#toggleLED').click(function () { + callDevice(JSON.stringify(createPayload())); + var toggleLED = $('#toggleLED')[0]; + if (toggleLED.classList.contains('active')) { + $('#toggleLED').css('background-color','orange'); + $('#toggleLED')[0].textContent = "Turn OFF"; + } else { + $('#toggleLED').css('background-color','lightgrey'); + $('#toggleLED')[0].textContent = "Turn ON"; + } +}); +colorPicker.on(['input:end'], function(color) { + callDevice(JSON.stringify(createPayload())); +}); +colorPicker.on(['color:change'], function () { + brightnessSlider.color.rgb = colorPicker.color.rgb; +}); +const sleep = (s) => { + return new Promise(resolve => setTimeout(resolve, (s))); +}; +sleep(100).then(() => { + $("#subtitle").text("Bias Lighting and Ambient Light firmware designed for Firefly Luciferin") + $("#ut").text("No white balance") + $('#effectSelect').append(new Option("Solid", "Solid")); + $('#effectSelect').append(new Option("Fire", "Fire")); + $('#effectSelect').append(new Option("Twinkle", "Twinkle")); + $('#effectSelect').append(new Option("Bpm", "Bpm")); + $('#effectSelect').append(new Option("Rainbow", "Rainbow")); + $('#effectSelect').append(new Option("Slow rainbow", "Slow rainbow")); + $('#effectSelect').append(new Option("Chase rainbow", "Chase rainbow")); + $('#effectSelect').append(new Option("Solid rainbow", "Solid rainbow")); + $('#effectSelect').append(new Option("Random colors", "Random colors")); + $('#effectSelect').append(new Option("Rainbow colors", "Rainbow colors")); + $('#effectSelect').append(new Option("Meteor", "Meteor")); + $('#effectSelect').append(new Option("Color waterfall", "Color waterfall")); + $('#effectSelect').append(new Option("Random marquee", "Random marquee")); + $('#effectSelect').append(new Option("Rainbow marquee", "Rainbow marquee")); + $('#effectSelect').append(new Option("Pulsing rainbow", "Pulsing rainbow")); + $('#effectSelect').append(new Option("Christmas", "Christmas")); + $('#effectSelect').append(new Option("Bias light", "Bias light")); + $('#effectSelect').append(new Option("Music mode (VU Meter)", "Music mode (VU Meter)")); + $('#effectSelect').append(new Option("Music mode (Stereo VU Meter)", "Music mode (Stereo VU Meter)")); + $('#effectSelect').append(new Option("Music mode (Screen capture)", "Music mode (Screen capture)")); + $('#effectSelect').append(new Option("Music mode (Rainbow music)", "Music mode (Rainbow music)")); + poll(); +}); +function asCBAction(cbAs) { + var strConfirm = "If auto save is enabled, color and brightness information is stored into memory to retain this settings after reboot.\nIf you change color often, this can stress the small memory on your microcontroller.\nIn that case it is recommended to disable auto save.\nIf you want to save only one color as default, please enable auto save, choose the desired color and then disable auto save.\n\nDo you want to enable auto save now?"; + if (($("#autosave").prop('checked') && confirm(strConfirm)) || !($("#autosave").prop('checked'))) { + const http = new XMLHttpRequest(); + if (cbAs.checked) { + http.open('GET', 'setAutoSave?autosave=1'); + } else { + http.open('GET', 'setAutoSave?autosave=0'); + } + http.send(); + http.onload = () => console.log(http.responseText); + } else { + $("#autosave").prop('checked', false); + } +} diff --git a/include/EffectsManager.h b/include/EffectsManager.h index 3e8c70793..578bcec41 100644 --- a/include/EffectsManager.h +++ b/include/EffectsManager.h @@ -35,24 +35,39 @@ class EffectsManager { public: - static void fire(int cooling, int sparking, int speedDelay, int dynamicLedNum); + static void twinkleRandom(); - static void twinkleRandom(int count, int speedDelay, boolean onlyOne, int dynamicLedNum); + void theaterChaseRainbow(); - void theaterChaseRainbow(int dynamicLedNum); + void mixedRainbow(); - void mixedRainbow(int dynamicLedNum); + void bpm(); - void bpm(int dynamicLedNum); + void colorWipe(byte red, byte green, byte blue); - void rainbow(int dynamicLedNum); + static RgbColor Wheel(uint8_t WheelPos); - void solidRainbow(int dynamicLedNum); + void solidRainbow(); - void colorWipe(int dynamicLedNum, byte red, byte green, byte blue); + static void randomColors(); - static RgbColor Wheel(uint8_t WheelPos); + static void rainbowColors(); + + static void meteor(); + + static void colorWaterfall(); + + static void randomMarquee(); + + static void rainbowMarquee(); + + static void pulsing_rainbow(); + + static void christmas(); + + void fire(int cooling, int sparking, int speedDelay); + void rainbow(boolean slowdown); }; #endif //GLOW_WORM_LUCIFERIN_EFFECTSMANAGER_H diff --git a/include/Globals.h b/include/Globals.h index a96a68ad3..8b851c8dd 100644 --- a/include/Globals.h +++ b/include/Globals.h @@ -70,10 +70,14 @@ extern byte bStored; extern byte brightnessStored; extern boolean autoSave; enum class Effect { - GlowWormWifi, GlowWorm, solid, fire, twinkle, bpm, rainbow, chase_rainbow, solid_rainbow, mixed_rainbow + GlowWormWifi, GlowWorm, solid, fire, twinkle, bpm, rainbow, chase_rainbow, solid_rainbow, slowRainbow, randomColors, + rainbowColors, meteor, colorWaterfall, randomMarquee, rainbowMarquee, pulsing_rainbow, christmas }; extern Effect effect; extern String ffeffect; +// TODO remove +extern String iip; +extern String bbip; extern float framerate; extern float framerateSerial; extern float framerateCounter; diff --git a/include/LedManager.h b/include/LedManager.h index 35c00c43c..95ae26311 100644 --- a/include/LedManager.h +++ b/include/LedManager.h @@ -131,6 +131,7 @@ class LedManager { static void manageBuiltInLed(uint8_t r, uint8_t g, uint8_t b); + RgbColor getPixelColor(uint16_t index) const; }; #endif //GLOW_WORM_LUCIFERIN_LEDMANAGER_H diff --git a/include/Version.h b/include/Version.h index 0831b6844..f027cc67b 100644 --- a/include/Version.h +++ b/include/Version.h @@ -4,6 +4,6 @@ #define VERSION "5.16.7" #endif #ifndef BUILD_TIMESTAMP - #define BUILD_TIMESTAMP "2024-09-21 17:00:15.821945" + #define BUILD_TIMESTAMP "2024-12-17 14:38:58.822045" #endif \ No newline at end of file diff --git a/include/WebSettings.h b/include/WebSettings.h index 50d113bf2..854f970e4 100644 --- a/include/WebSettings.h +++ b/include/WebSettings.h @@ -21,7 +21,7 @@ #ifndef GLOW_WORM_LUCIFERIN_WEBSETTINGS_H #define GLOW_WORM_LUCIFERIN_WEBSETTINGS_H -const char settingsPage[] PROGMEM = R"=====(
Bias Lighting and Ambient Light firmware designed for Firefly Luciferin