Skip to content

Added setPixel method - #3

Closed
electron-rare wants to merge 7 commits into
KurtMF:mainfrom
electron-rare:main
Closed

electron-rare wants to merge 7 commits into
KurtMF:mainfrom
electron-rare:main

Conversation

@electron-rare

Copy link
Copy Markdown

add setPixel method, to update pixel with source (SD, artnet, video...)

in progress added BGRW, GRBW, WRGB...

@KurtMF

KurtMF commented Feb 12, 2025 •

Copy link
Copy Markdown
Owner

Hello, and thank you for your interest in making ObjectFLED bertter. However I don't see a reason to expose a method to bypass draw buffer and write directly to frame buffer. What is your use case for this?

Also, I'm afraid such a method would not work anyway, since whatever it writes to frame buffer is overwritten by show().

When I ported OctoWS2811 code to ObjectFLED, I removed setPixel()/getPixel() methods, and encapsulated the framebuffer in the object, so users don't have to worry about it like in Octo code. You might find OctoWS2811 a better library for your needs, since framebuffer is created in user sketch.

I looked at your last 7 commits, and the one which changes ObjectFLED.cpp is a mess, from changing the whitespace of every line in your code editor. I cannot tell what you changed. If your code editor does this to a diff, then make separate commits: one for the whitespace changes when you load and save; and one for actual changes you make in code after that. Better yet, set your code editor not to re-format all the whitespace.

@electron-rare

electron-rare commented Feb 13, 2025 via email

Copy link
Copy Markdown
Author

@KurtMF

KurtMF commented Feb 13, 2025

Copy link
Copy Markdown
Owner

Arcnet frames? That is a LAN protocol. Neither Octo or ObjectFLED processes network frames. It still doesn't make sense to me to have this setPixel method when it's output to framebuffer is destroyed every time you show it.

It sounds to me like you are doing something proprietary with this code, and while you are welcome to use it for that, the changes you make don't belong in the library for general use. Setting pixel colors is performed with writes to the user-defined drawing buffer. A non-functional setPixel method is not something I'm going to merge into this library.

Also, I never intended to add all the possible combinations of RGB and RGBW to the code, since I cannot find evidence that anyone is actually making LED chips with color orders not already supported in ObjectFLED. I searched Google, Amazon, Digikey, and Adafruit websites for this. I don't want to add overhead to the show() method for checking color orders that don't actually exist in the real world. That said, do you have actual LED chips which require one of these extra color formats you want to add? Can you provide link to it's datasheet?

The only time ObjectFLED uses the color format routines you are trying to update, is when it is running the genFrameBuffer() routine, which is what replaces anything you put there with your new setPixel method. None of this makes sense to me, sorry.

@KurtMF

KurtMF commented Feb 14, 2025 •

Copy link
Copy Markdown
Owner

I did some reading about Artnet protocol, and I also double-checked the OctoWS2811 code for setPixel(). I confirmed that Octo does not write pixel data to it's framebuffer, it writes to user-supplied draw buffer. Then just as in Object, Octo replaces the entire framebuffer with new data every time show() is called. I cannot see how your code changes in this PR could possibly work or be functional.

From OctoWS2811:
void OctoWS2811::setPixel(uint32_t num, int color) {
...
uint8_t *dest = (uint8_t *)drawBuffer + num * 3;
...
}

If you had something working with OctoWS2811, and you want to port it to ObjectFLED, then these steps should convert your code successfully:

  • Replace instance of OctoWS2811 object with ObjectFLED object (incl. replacing WS2811_XXX with CORDER_XXX).
  • Optionally replace call to .begin() if you want to use custom LED waveform timing offered in ObjecfFLED
  • Replace calls to setPixel(index, color) with simple assignment to the drawbuffer array you defined in your Octo/Object object in the fisrt step.

setPixel(index, color); replaced with: myDrawBuffer[index] = color;
Or create setPixel method in your sketch to avoid re-writing many calls to it.

@KurtMF

KurtMF commented Feb 14, 2025

Copy link
Copy Markdown
Owner

There is 1 key difference between OctoWS2811 and ObjectFLED. While both libraries expect input in RGB byte-order format, Octo will apply different color formats (ie- GBR, RGBW, etc) only when setPixel() is used. If you write to your Octo draw buffer directly (without setPixel), you need to order the colors yourself.

ObjectFLED will apply different color formats when show() is called, translating RGB format of the entire draw buffer to the required format (GBR, RGBW, etc) in frame buffer. There is no need for setPixel(), except to simplify writing an already simple memory assignment to draw buffer. In addition to color order translation, ObjectFLED show() also applies brightness and color balance translations to the draw buffer when generating frame buffer. These translations are not available in Octo.

@KurtMF

KurtMF commented Feb 24, 2025

Copy link
Copy Markdown
Owner

Closing this, will re-visit when you return to LEDCurtain duty.

Does your OctoWWS2811 LEDCurtain code work? If so, I think there's easier way to port it to ObjectFLED.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants