Skip to content
Snippets Groups Projects
Commit 1d035fad authored by Micah Elizabeth Scott's avatar Micah Elizabeth Scott
Browse files

Add a configuration flag to disable dithering

parent 32023635
No related branches found
No related tags found
No related merge requests found
......@@ -101,7 +101,7 @@ Type code | Meaning of 'final' bit | Index range | Packet contents
--------- | ------------------------------- | ----------- | -------------------------------------
0 | Interpolate to new video frame | 0 … 24 | Up to 21 pixels, 24-bit RGB
1 | Instantly apply new color LUT | 0 … 24 | Up to 31 16-bit lookup table entries
2 | | | (reserved)
2 | (reserved) | 0 | Set configuration data
3 | | | (reserved)
In a type 0 packet, the USB packet contains up to 21 pixels of 24-bit RGB color data. The last packet (index 24) only needs to contain 8 valid pixels. Pixels 9-20 in these packets are ignored.
......@@ -134,6 +134,13 @@ Byte Offset | Description
62 | LUT entry #30, low byte
63 | LUT entry #30, high byte
A type 2 packet sets optional device-wide configuration settings. Right now it's just used to disable dithering for debug or side-by-side comparison purposes. Other bytes in this packet are reserved.
Byte Offset | Description
------------- | ------------
0 | Control byte
1 | Flags. Bit 0: Disable dithering
Contact
-------
......
......@@ -419,5 +419,10 @@ extern "C" int main()
updateDrawBuffer((millis() << 4) & 0xFFFF);
leds.show();
// Optionally disable dithering by clearing our residual buffer every frame.
if (buffers.flags & CFLAG_NO_DITHERING) {
memset(residual, 0, sizeof residual);
}
}
}
......@@ -32,6 +32,7 @@
#define TYPE_FRAMEBUFFER 0x00
#define TYPE_LUT 0x40
#define TYPE_CONFIG 0x80
......@@ -70,6 +71,11 @@ void fcBuffers::handleUSB()
}
break;
case TYPE_CONFIG:
flags = packet->buf[1];
usb_free(packet);
break;
default:
usb_free(packet);
break;
......
......@@ -89,6 +89,13 @@ struct fcColorLUT : public fcPacketBuffer<PACKETS_PER_LUT>
};
/*
* Configuration flag values
*/
#define CFLAG_NO_DITHERING (1 << 0)
/*
* All USB-writable buffers
*/
......@@ -104,6 +111,8 @@ struct fcBuffers
fcColorLUT lutNew; // Partial LUT, not yet finalized
uint16_t lutCurrent[LUT_SIZE + 1]; // Active LUT, linearized for efficiency, padded on the end.
uint8_t flags; // Configuration flags
fcBuffers()
{
fbPrev = &fb[0];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment