Giter Site home page Giter Site logo

Comments (12)

marcmerlin avatar marcmerlin commented on August 12, 2024

Interesting. normally when I've seen such code, no one writes in the cells that aren't mapped to any hardware pixels, so it's not an issue (you can assign them to 0 instead of -1)

So basically you recommend that I edit
Framebuffer_GFX::drawPixel
and have this instead
uint32_t idx = _fb[XY(x,y)];
if (idx<0 || idx>numpix) return;
_fb[idx] = passThruFlag ? passThruColor : expandColor(color);

I'm not sure how I feel about returning fake index values, when you could just return 0 on empty cells, or numpix-1, or have a empty pixel (define numpix+1 and the last pixel isn't actually there, but exists in the array), but I guess it doesn't hurt to have defense in depth and reject bad mappings either.

If you'd rather keep using -1, can you check the code I just gave you and confirm it fixes your issue?

from fastled_neomatrix.

jrork avatar jrork commented on August 12, 2024

uint32_t idx = XY(x,y);
if (idx<0 || idx>numpix) return;
_fb[idx] = passThruFlag ? passThruColor : expandColor(color);

--and--

uint32_t idx = XY(x,y);
if (idx<0 || idx>numpix) return;
_fb[idx] = color;

...works. The code above still crashes as it returns the value of _fb[XY(x,y)] instead of XY(x,y);

0 and numpix-1 are both visible pixels. I've tried the led(numpix+1) trick but it can become a hassle to maintain when setting up the matrix numbering. As you noted, this is a very unusual use case and was difficult to find a working example to pattern off of. However, the examples I did find used -1, and it also makes it much easier to visualize the layout when looking at the array initialization.

Thanks Marc, and thank you for the great libraries! I'll do a post when I'm complete

from fastled_neomatrix.

marcmerlin avatar marcmerlin commented on August 12, 2024

Ok, thanks for confirming. I'll apply #1 then.

from fastled_neomatrix.

jrork avatar jrork commented on August 12, 2024

For clarity, i was attempting (and failing) to point out that the fix needed to go into two different places...

from fastled_neomatrix.

marcmerlin avatar marcmerlin commented on August 12, 2024

Ooops, sorry. This should be better.
Next time, feel free to send a PR so that you can get credit for your change :)

from fastled_neomatrix.

jrork avatar jrork commented on August 12, 2024

This is my first ever, so didn't realize I could/should do a PR. Next time...

Thanks again!

from fastled_neomatrix.

marcmerlin avatar marcmerlin commented on August 12, 2024
  1. could => you always can :)
  2. should => there is no rule, any contribution is welcome, even if it's a bug report without a fix :)

Basically you can contribute to whichever level is interesting and/or challenging to you, and if you send a PR, you get your name in the git history :)
After some amount of that, you may end up writing your own library and share it with others too.

from fastled_neomatrix.

jrork avatar jrork commented on August 12, 2024

from fastled_neomatrix.

marcmerlin avatar marcmerlin commented on August 12, 2024

the fix is already in, so no need to send it again (or send stuff that doesn't really need to be in), but if you find another bug or you want to add a worthwhile addition (and that's more tricky, because I get to decide whether it makes sense to add, or not :) ), feel free

from fastled_neomatrix.

jrork avatar jrork commented on August 12, 2024

from fastled_neomatrix.

marcmerlin avatar marcmerlin commented on August 12, 2024

but in the meantime, you can send me details on your project when it's up and running :)

from fastled_neomatrix.

marcmerlin avatar marcmerlin commented on August 12, 2024

look in the history of this issue for
marcmerlin closed this in marcmerlin/Framebuffer_GFX@e14e11a 3 hours ago
marcmerlin added a commit to marcmerlin/Framebuffer_GFX that referenced this issue 2 hours ago
and click on both

from fastled_neomatrix.

Related Issues (12)

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.