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