From e061e10f175a9d15aee868179b2151682a782023 Mon Sep 17 00:00:00 2001 From: Awawa <69086569+awawa-dev@users.noreply.github.com> Date: Mon, 16 Mar 2026 21:07:11 +0100 Subject: [PATCH 1/2] Direct 32-bit rendering for HD107 or RGBW --- include/calibration.h | 2 ++ include/framestate.h | 24 +++++++++++++++++++++++ include/main.h | 45 ++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 70 insertions(+), 1 deletion(-) diff --git a/include/calibration.h b/include/calibration.h index b50c3f3..a535290 100644 --- a/include/calibration.h +++ b/include/calibration.h @@ -27,6 +27,8 @@ #ifdef NEOPIXEL_RGBW typedef RgbwColor ColorDefinition; +#elif defined(SPILED_APA102) + typedef DotStarColor ColorDefinition; #else typedef RgbColor ColorDefinition; #endif diff --git a/include/framestate.h b/include/framestate.h index f01ff83..a49987e 100644 --- a/include/framestate.h +++ b/include/framestate.h @@ -35,6 +35,7 @@ enum class AwaProtocol { HEADER_A, + HEADER_W, HEADER_w, HEADER_a, HEADER_HI, @@ -47,6 +48,7 @@ enum class AwaProtocol RED, GREEN, BLUE, + EXTRA_COLOR_BYTE_4, FLETCHER1, FLETCHER2 }; @@ -59,6 +61,7 @@ class { AwaProtocol state = AwaProtocol::HEADER_A; bool protocolVersion2 = false; + bool protocolVersion3 = false; uint8_t CRC = 0; uint16_t count = 0; uint16_t currentLed = 0; @@ -153,6 +156,27 @@ class return protocolVersion2; } + /** + * @brief Set if frame protocol version 3 (direct 32bit mode) + * + * @param newVer + */ + inline void setProtocolVersion3(bool newVer) + { + protocolVersion3 = newVer; + } + + /** + * @brief Verify if frame protocol version 3 (direct 32bit mode) + * + * @return true + * @return false + */ + inline bool isProtocolVersion3() const + { + return protocolVersion3; + } + /** * @brief Set new AWA frame state * diff --git a/include/main.h b/include/main.h index edfde6a..f8fff24 100644 --- a/include/main.h +++ b/include/main.h @@ -29,7 +29,7 @@ #define MAIN_H #define MAX_BUFFER 5120 -#define HELLO_MESSAGE "\r\nWelcome!\r\nAwa driver 8." +#define HELLO_MESSAGE "\r\nWelcome!\r\nAwa driver 11." #include "calibration.h" #include "statistics.h" @@ -86,6 +86,7 @@ void processData() case AwaProtocol::HEADER_A: // assume it's protocol version 1, verify it later frameState.setProtocolVersion2(false); + frameState.setProtocolVersion3(false); if (input == 'A') frameState.setState(AwaProtocol::HEADER_w); break; @@ -93,6 +94,20 @@ void processData() case AwaProtocol::HEADER_w: if (input == 'w') frameState.setState(AwaProtocol::HEADER_a); +#if defined(NEOPIXEL_RGBW) || defined(SPILED_APA102) + else if (input == 'W') + frameState.setState(AwaProtocol::HEADER_W); +#endif + else + frameState.setState(AwaProtocol::HEADER_A); + break; + case AwaProtocol::HEADER_W: + // detect protocol version 3 + if (input == 'a') + { + frameState.setState(AwaProtocol::HEADER_HI); + frameState.setProtocolVersion3(true); + } else frameState.setState(AwaProtocol::HEADER_A); break; @@ -169,10 +184,38 @@ void processData() frameState.setState(AwaProtocol::BLUE); break; + case AwaProtocol::EXTRA_COLOR_BYTE_4: + #ifdef NEOPIXEL_RGBW + frameState.color.W = input; + #elif defined(SPILED_APA102) + frameState.color.Brightness = input; + #endif + frameState.addFletcher(input); + + if (base.setStripPixel(frameState.getCurrentLedIndex(), frameState.color)) + { + frameState.setState(AwaProtocol::RED); + } + else + { + frameState.setState(AwaProtocol::FLETCHER1); + } + break; + case AwaProtocol::BLUE: frameState.color.B = input; frameState.addFletcher(input); + if (frameState.isProtocolVersion3()) + { + frameState.setState(AwaProtocol::EXTRA_COLOR_BYTE_4); + break; + } + + #if defined(SPILED_APA102) + frameState.color.Brightness = 0xFF; + #endif + #ifdef NEOPIXEL_RGBW // calculate RGBW from RGB using provided calibration data frameState.rgb2rgbw(); From d4bed8ccf1521b556bb359243142ef049590b386 Mon Sep 17 00:00:00 2001 From: Awawa <69086569+awawa-dev@users.noreply.github.com> Date: Mon, 16 Mar 2026 22:17:20 +0100 Subject: [PATCH 2/2] Fix for APA102 --- include/calibration.h | 2 +- include/main.h | 4 ++-- src/main.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/calibration.h b/include/calibration.h index a535290..fe152d6 100644 --- a/include/calibration.h +++ b/include/calibration.h @@ -28,7 +28,7 @@ #ifdef NEOPIXEL_RGBW typedef RgbwColor ColorDefinition; #elif defined(SPILED_APA102) - typedef DotStarColor ColorDefinition; + typedef RgbwColor ColorDefinition; #else typedef RgbColor ColorDefinition; #endif diff --git a/include/main.h b/include/main.h index f8fff24..ac8ec3c 100644 --- a/include/main.h +++ b/include/main.h @@ -188,7 +188,7 @@ void processData() #ifdef NEOPIXEL_RGBW frameState.color.W = input; #elif defined(SPILED_APA102) - frameState.color.Brightness = input; + frameState.color.W = input; #endif frameState.addFletcher(input); @@ -213,7 +213,7 @@ void processData() } #if defined(SPILED_APA102) - frameState.color.Brightness = 0xFF; + frameState.color.W = 0xFF; #endif #ifdef NEOPIXEL_RGBW diff --git a/src/main.cpp b/src/main.cpp index 9ba8274..aca9079 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -63,7 +63,7 @@ #elif NEOPIXEL_RGB #define LED_DRIVER NeoPixelBus #elif SPILED_APA102 - #define LED_DRIVER NeoPixelBus + #define LED_DRIVER NeoPixelBus #elif SPILED_WS2801 #define LED_DRIVER NeoPixelBus #endif