From c53d7c6dbaa72f937c692462125927a3b1202b61 Mon Sep 17 00:00:00 2001
From: Micah Elizabeth Scott <micah@scanlime.org>
Date: Tue, 23 Jul 2013 17:43:05 -0700
Subject: [PATCH] Debug flag for disabling interpolation

---
 README.md              | 15 +++++++++------
 firmware/fadecandy.cpp |  5 +++++
 firmware/fc_usb.h      |  1 +
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md
index f9e29d2..d119b3c 100644
--- a/README.md
+++ b/README.md
@@ -135,12 +135,15 @@ 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
+A type 2 packet sets optional device-wide configuration settings:
+
+Byte Offset | Bits   | Description
+----------- | ------ | ------------
+0           | 7 … 0  | Control byte
+1           | 7 … 2  | (reserved)
+1           | 1      | Disable keyframe interpolation
+1           | 0      | Disable dithering
+2 … 63      | 7 … 0  | (reserved)
 
 
 Contact
diff --git a/firmware/fadecandy.cpp b/firmware/fadecandy.cpp
index b6a17b6..53c30db 100644
--- a/firmware/fadecandy.cpp
+++ b/firmware/fadecandy.cpp
@@ -54,6 +54,11 @@ static uint32_t calculateInterpCoefficient()
      * how long the interpolation between those keyframes should take.
      */
 
+    if (buffers.flags & CFLAG_NO_INTERPOLATION) {
+        // Always use fbNext
+        return 0x10000;
+    }
+
     uint32_t now = millis();
     uint32_t tsPrev = buffers.fbPrev->timestamp;
     uint32_t tsNext = buffers.fbNext->timestamp;
diff --git a/firmware/fc_usb.h b/firmware/fc_usb.h
index 5d69081..d1a019e 100644
--- a/firmware/fc_usb.h
+++ b/firmware/fc_usb.h
@@ -95,6 +95,7 @@ struct fcColorLUT : public fcPacketBuffer<PACKETS_PER_LUT>
  */
 
 #define CFLAG_NO_DITHERING      (1 << 0)
+#define CFLAG_NO_INTERPOLATION  (1 << 1)
 
 
 /*
-- 
GitLab