Loxone support added (#1185)

* A separate socket for UDP api has been added. This uses the same API as HTML. Commands for Loxone were added to the API.

* html files for udp api newly generated

* codm pixel controller board configurations added to platformio.ini file

* Parser for LX/LY commands adapted. Calculation of the values corrected. Segment handling for LX/LY removed.

* Lox parser moved to own file. Lox parser added to the JSON api. Within a segment LX and LY are now supported.

* serial port removed

* F() macro added

Co-authored-by: Marius Groos <marius.groos@codm.de>
This commit is contained in:
m0fa 2020-09-27 11:37:16 +02:00 committed by GitHub
parent cac974b8e1
commit b10ab358da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 1910 additions and 1660 deletions

View file

@ -55,6 +55,58 @@ void deserializeSegment(JsonObject elem, byte it)
}
}
}
// lx parser
int lx = elem[F("lx")] | -1;
if (lx > 0) {
DEBUG_PRINT(F("LX: Lox primary = "));
DEBUG_PRINTLN(lx);
int rgbw[] = {0,0,0,0};
if (parseLx(lx, rgbw)) {
if (bri == 0) {
DEBUG_PRINTLN(F("LX: turn on"));
toggleOnOff();
}
bri = 255;
nightlightActive = false; //always disable nightlight when toggling
if (id == strip.getMainSegmentId()) {
DEBUG_PRINTLN(F("LX: main segment"));
col[0] = rgbw[0];
col[1] = rgbw[1];
col[2] = rgbw[2];
col[3] = rgbw[3];
} else {
DEBUG_PRINT(F("LX: segment "));
DEBUG_PRINTLN(id);
seg.colors[0] = ((rgbw[3] << 24) | ((rgbw[0]&0xFF) << 16) | ((rgbw[1]&0xFF) << 8) | ((rgbw[2]&0xFF)));
}
}
}
int ly = elem[F("ly")] | -1;
if (ly > 0) {
DEBUG_PRINT(F("LY: Lox secondary = "));
Serial.println(ly);
int rgbw[] = {0,0,0,0};
if (parseLx(ly, rgbw)) {
if (bri == 0) {
DEBUG_PRINTLN(F("LY: turn on"));
toggleOnOff();
}
bri = 255;
nightlightActive = false; //always disable nightlight when toggling
if (id == strip.getMainSegmentId()) {
DEBUG_PRINTLN(F("LY: main segment"));
colSec[0] = rgbw[0];
colSec[1] = rgbw[1];
colSec[2] = rgbw[2];
colSec[3] = rgbw[3];
} else {
DEBUG_PRINT(F("LY: segment "));
DEBUG_PRINTLN(id);
seg.colors[1] = ((rgbw[3] << 24) | ((rgbw[0]&0xFF) << 16) | ((rgbw[1]&0xFF) << 8) | ((rgbw[2]&0xFF)));
}
}
}
//if (pal != seg.palette && pal < strip.getPaletteCount()) strip.setPalette(pal);
seg.setOption(SEG_OPTION_SELECTED, elem[F("sel")] | seg.getOption(SEG_OPTION_SELECTED));