Replies: 3 comments
-
Hi |
Beta Was this translation helpful? Give feedback.
-
Great! Here is a diff that implements the functionality I described: diff --git a/version for SK6812 cold white/HyperSerialEsp8266_SK6812ColdWhite/HyperSerialEsp8266_SK6812ColdWhite.ino b/version for SK6812 cold white/HyperSerialEsp8266_SK6812ColdWhite/HyperSerialEsp8266_SK6812ColdWhite.ino
index 9a67993..24b7d97 100644
--- a/version for SK6812 cold white/HyperSerialEsp8266_SK6812ColdWhite/HyperSerialEsp8266_SK6812ColdWhite.ino
+++ b/version for SK6812 cold white/HyperSerialEsp8266_SK6812ColdWhite/HyperSerialEsp8266_SK6812ColdWhite.ino
@@ -73,6 +73,7 @@ uint16_t stat_frames = 0;
uint16_t stat_final_good = 0;
uint16_t stat_final_frames = 0;
bool wantShow = false;
+bool turnOff = true;
inline void ShowMe()
{
@@ -81,6 +82,12 @@ inline void ShowMe()
stat_good++;;
wantShow = false;
strip->Show();
+ if (turnOff) {
+ digitalWrite(D6, HIGH);
+ } else {
+ digitalWrite(D6, LOW);
+ }
+ turnOff = true;
}
}
@@ -212,6 +219,8 @@ void readSerialData()
else
setStripPixel(currentPixel++, inputColor);
+ turnOff &= isBlack(inputColor);
+
if (count-- > 0) state = AwaProtocol::RED;
else state = AwaProtocol::FLETCHER1;
break;
@@ -241,6 +250,10 @@ inline void setStripPixel(uint16_t pix, RgbwColor& inputColor)
strip->SetPixelColor(pix, inputColor);
}
}
+inline bool isBlack(RgbwColor& inputColor)
+{
+ return inputColor.W == 0 && inputColor.R == 0 && inputColor.G == 0 && inputColor.B == 0;
+}
#else
inline void setStripPixel(uint16_t pix, RgbColor& inputColor)
{
@@ -249,10 +262,18 @@ inline void setStripPixel(uint16_t pix, RgbColor& inputColor)
strip->SetPixelColor(pix, inputColor);
}
}
+inline bool isBlack(RgbColor& inputColor)
+{
+ return inputColor.R == 0 && inputColor.G == 0 && inputColor.B == 0;
+}
#endif
void setup()
{
+ // Hardware relay
+ pinMode(D6, OUTPUT);
+ // Initially OFF
+ digitalWrite(D6, HIGH);
// Init serial port
Serial.begin(serialSpeed);
Serial.setTimeout(50); I have a LOW-triggered relay connected to pin D6. Seems to be working well so far. |
Beta Was this translation helpful? Give feedback.
-
That could work with one remark: when you receive black color even for a moment (very dark scene) that would cause entire LED strip to power OFF even if it is still receiving the data. Must be tested because the relay can have some delay and I don't know how it will behave. |
Beta Was this translation helpful? Give feedback.
-
LED strips will consume non-negligible power while they are connected, even if all the LEDs are set to off. This can be mitigated by using a relay to switch the power supply connection to the LED strips. WLED has this feature: https://kno.wled.ge/features/relay-control/.
I would like to implement the same thing for HyperSerialEsp8266, but it's not obvious to me when a relay can switch power off. This would be when HyperHDR disconnects, or the otherwise tells the ESP8266 to turn off the LEDs. Is there any signal in the AwaProtocol for this kind of thing?
Beta Was this translation helpful? Give feedback.
All reactions