What would be the easiest way to work in 256 (8-bit) color mode?

What would be the easiest way to work in 256 (8-bit) color mode? I’m sending data to an ESP8266 over UDP and for the sake of speed and max pixel count I want to not use full 24-bit colors but need to do so without a big performance hit on the ESP end.

I found the color palettes so I guess I could just define one for all 256 colors (sadly couldn’t find one predefined)… or is there a more performant way to do that?

Of the 16-million possible colors, which 256 of them do you want? :slight_smile: If arbitrary, then yes, I think the way to go is to define a 256-entry ColorPalette. I would copy the ColorPalette.ino example and start filling it out with your list of colors.

However, If you’re talking 8-bit color as described here:

then you could write a simple set of functions that scaled that single 8-bit value into a 24-bit RGB value. Something like:

uint8_t color8bit = 0b11001010; // 8-bit color

uint8_t r = ((color8bit & 0b11100000) >> 5) * 32;
uint8_t g = ((color8bit & 0b00011100) >> 2) * 32;
uint8_t b = ((color8bit & 0b00000011) >> 0) * 64;

Good point… I guess I was talking about whatever was “256 colors” mode back in the day on old computers. So I guess that wiki article is the same.

I just completed a huge installation that used ESP8266 and rendered data over the network. Some tips:

  1. Use MultiCast UDP not Unicast/brodcast, the ESP have pretty poor performance with unicast/broadcast. Specicly use the beginPacketMulticast method instead of beginPacket.
    2.The esp have a performance limit. I found sending anything larger than 500bytes at a high frame rate resulted in frame drops.
  2. the ESP8266 arduino library does not support any packet fragmentation(unless you recompile the lwip library yourself and change the header vars) via IP or UDP. Any packet larger than 1490bytes will be dropped.

Interesting… broadcast was a no-go for me as it kept dropping frames, but in the end I needed to unicast anyways because I have multiple displays showing different things. I tried multicast but never had any real luck getting it to receive correctly. Maybe I’ll try again.
Right now I’m sending 1152 bytes without huge problems, but I haven’t really tried to crank the framerate. But this is why I want to compress the colorspace.
And yeah… the packet fragmentation was my big problem here. I tried splitting and reassembling packets myself but it was super slow and not really worth it.

Thanks!

@Adam_Haile Yeah issues arise when you start hammering the frame rate. If you want to multicast separate data to separate devices use a different port for each device but same multicast ip. I also tried packet reasembly, and yeah slow. buts hey for $5 its still pretty damn good