Coder Social home page Coder Social logo

Comments (12)

thebigpotatoe avatar thebigpotatoe commented on August 25, 2024

Ill have a dig into this, haven't seen it happen but will try to recreate.

from super-simple-rgb-wifi-lamp.

StefaanVanDooren avatar StefaanVanDooren commented on August 25, 2024

It only happens when turning the lamp off. When switching modes, it fades to black and then comes on again with the right mode.
I put a little video online : https://drive.google.com/file/d/11H5b7lDtVfai7jVCG0KzLAqhSe5cue0E/view?usp=sharing

PS: be sure to download the video, when I play it in my browser it's barely visible.

from super-simple-rgb-wifi-lamp.

thebigpotatoe avatar thebigpotatoe commented on August 25, 2024

Had to watch it a few times but i think i see what you mean (very evident when downloaded though). Might be an issue with wrap around in my code or fast LED. If you haven't, make sure you are up to date with the libraries in the meantime.

Awesome to see someone build it though.

from super-simple-rgb-wifi-lamp.

StefaanVanDooren avatar StefaanVanDooren commented on August 25, 2024

be sure to download the video, when I play it in my browser it's barely visible.

It's a great little project. I would love to see something like a fire mode ....

from super-simple-rgb-wifi-lamp.

StefaanVanDooren avatar StefaanVanDooren commented on August 25, 2024

I just noticed its not just when fading to black, it also happens when the lights are a full brightness. But then it's not that visible, because it switches directly back to full brightness.
New video uploaded, again you have to download it to really see it.... around second 2

https://drive.google.com/open?id=13ciJeC-3PrgpXlDLq5uSqk3twDCW0LJo

from super-simple-rgb-wifi-lamp.

StefaanVanDooren avatar StefaanVanDooren commented on August 25, 2024

New observation.... only happens with certain fade time... It does happen with 500, 1400, 1500, 1800 and 1900 but not with 0, 100, 200, 300, 400, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1500, 1600, 1700, 2000

from super-simple-rgb-wifi-lamp.

thebigpotatoe avatar thebigpotatoe commented on August 25, 2024

Awesome. Thanks for the updates. It does seem to happen for those numbers, just tested it then. I'll dig into the code as soon as I can and see where there is an error.

from super-simple-rgb-wifi-lamp.

StefaanVanDooren avatar StefaanVanDooren commented on August 25, 2024

I added some debugging to the code, and noticed that modeChangeFadeAmount got below 0 for those certain Fadetimes. Adding a constrain seems to stop the behavior for me.

if (modeChangeFadeAmount > 0) {
EVERY_N_MILLISECONDS(20) {
modeChangeFadeAmount -= (FadeTime > 0) ? (255 / ((float)FadeTime/20)) : 255;
modeChangeFadeAmount = constrain(modeChangeFadeAmount,0,255);
Serial.print("[handleMode] - modeChaneFadeAmount : ");
Serial.println(modeChangeFadeAmount);
};

I added a constrain in all places where you change the modeChangeFadeAmount.

from super-simple-rgb-wifi-lamp.

StefaanVanDooren avatar StefaanVanDooren commented on August 25, 2024

Looking a bit further, I found you have an "else" laying around before your constrain in the code. (LEDS.ino) commenting this one out, also fixes the issue....

else

// Globally Scale the brightness of all LED's
modeChangeFadeAmount = constrain(modeChangeFadeAmount, 0, 255);
nscale8(ledString, NUM_LEDS, (int)modeChangeFadeAmount);

from super-simple-rgb-wifi-lamp.

thebigpotatoe avatar thebigpotatoe commented on August 25, 2024

Found all of the above. Seemed to be summing one last time using the inbuilt fastLED function EVERY_N_MILLISECONDS for those times you stated.

Ended up just shuffling a few things around and now the integer does not overflow. Test and worked in the latest pull for myself, let me know if you have issues.

from super-simple-rgb-wifi-lamp.

StefaanVanDooren avatar StefaanVanDooren commented on August 25, 2024

Working for me.

from super-simple-rgb-wifi-lamp.

thebigpotatoe avatar thebigpotatoe commented on August 25, 2024

Perfect, closing issue

from super-simple-rgb-wifi-lamp.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.