Typumwandlung korrigiert, default Brightness 255, scrollinfo via mqtt

This commit is contained in:
starcalc 2019-03-17 18:15:02 +01:00
parent 716ce0c076
commit fd3fb678bf
1 changed files with 11 additions and 8 deletions

View File

@ -141,20 +141,22 @@ bool onSetEffect(const HomieRange& range, const String& value) {
if (sep2 > 0) { if (sep2 > 0) {
// Interval was given // Interval was given
String stext = parameters.substring(0, sep2); String stext = parameters.substring(0, sep2);
String sinterval = parameters.substring(sep2 + 1).toInt(); String sinterval = parameters.substring(sep2 + 1);
int sep3 = sinterval.indexOf("|"); int sep3 = sinterval.indexOf("|");
if (sep3 > 0) { if (sep3 > 0) {
// Color was given // Color was given
int iinterval = sinterval.substring(0, sep3).toInt(); int iinterval = sinterval.substring(0, sep3).toInt();
String scolor = sinterval.substring(sep3 + 1); String scolor = sinterval.substring(sep3 + 1);
homieNode.setProperty("scrollinfo").send("Scroll with interval " + sinterval.substring(0, sep3) + " and color " + sinterval.substring(sep3 + 1));
matrix.ScrollText(stext, iinterval, scolor); matrix.ScrollText(stext, iinterval, scolor);
} else { } else {
homieNode.setProperty("scrollinfo").send("Scroll with interval " + parameters.substring(sep2 + 1));
int iinterval = parameters.substring(sep2 + 1).toInt(); int iinterval = parameters.substring(sep2 + 1).toInt();
matrix.ScrollText(stext, iinterval); matrix.ScrollText(stext, iinterval);
} }
} else { } else {
homieNode.setProperty("scrollinfo").send("Just scroll");
matrix.ScrollText(parameters); matrix.ScrollText(parameters);
} }
} }
@ -252,7 +254,7 @@ void loopHandler() {
void setup() { void setup() {
Serial.begin(115200); Serial.begin(115200);
Homie_setFirmware("pixelbox", "1.1.0"); Homie_setFirmware("pixelboxtest", "1.1.0");
Homie.setLoopFunction(loopHandler); Homie.setLoopFunction(loopHandler);
homieNode.advertiseRange("pixel", 0, NUMPIXELS - 1).settable(onSetPixel); homieNode.advertiseRange("pixel", 0, NUMPIXELS - 1).settable(onSetPixel);
@ -264,18 +266,19 @@ void setup() {
homieNode.advertise("icon").settable(onSetIcon); homieNode.advertise("icon").settable(onSetIcon);
homieNode.advertiseRange("pixels", 0, (NUMPIXELS - 1) * 7).settable(onSetPixels); homieNode.advertiseRange("pixels", 0, (NUMPIXELS - 1) * 7).settable(onSetPixels);
Homie.setup();
strip.begin(); strip.begin();
strip.clear(); strip.clear();
// strip.setBrightness(64); // strip.setBrightness(64);
// strip.setBrightness(255); // HEEELLLLLLL :) strip.setBrightness(255); // HEEELLLLLLL :)
strip.setBrightness(10); // DEBUG! // strip.setBrightness(10); // DEBUG!
strip.show(); strip.show();
stopAfterCompletion = false; // Default stopAfterCompletion = false; // Default
strip.Plasma(); // Default effect strip.Plasma(); // Default effect
ArduinoOTA.setHostname("pixelbox"); Homie.setup();
ArduinoOTA.setHostname("pixelboxtest");
ArduinoOTA.onStart([]() { ArduinoOTA.onStart([]() {
strip.clear(); strip.clear();
strip.setBrightness(64); strip.setBrightness(64);
@ -290,7 +293,7 @@ void setup() {
ArduinoOTA.begin(); ArduinoOTA.begin();
matrix.begin(); matrix.begin();
matrix.setTextWrap(false); matrix.setTextWrap(false);
matrix.setBrightness(32); matrix.setBrightness(255);
} }
void loop() { void loop() {