Skip to content

Commit

Permalink
Add udpNotifier2 (JSON+HTTP, closes #1205 )
Browse files Browse the repository at this point in the history
Added Loxone defines
Fix missing timezones (#1201)
  • Loading branch information
Aircoookie committed Sep 27, 2020
1 parent b10ab35 commit 8d3ff16
Show file tree
Hide file tree
Showing 13 changed files with 326 additions and 334 deletions.
26 changes: 25 additions & 1 deletion wled00/colors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,31 @@ void colorHStoRGB(uint16_t hue, byte sat, byte* rgb) //hue, sat to rgb
if (useRGBW && strip.rgbwMode == RGBW_MODE_LEGACY) colorRGBtoRGBW(col);
}

void colorCTtoRGB(uint16_t mired, byte* rgb) //white spectrum to rgb
void colorKtoRGB(uint16_t kelvin, byte* rgb) //white spectrum to rgb, calc
{
float r = 0, g = 0, b = 0;
float temp = kelvin / 100;
if (temp <= 66) {
r = 255;
g = round(99.4708025861 * log(temp) - 161.1195681661);
if (temp <= 19) {
b = 0;
} else {
b = round(138.5177312231 * log((temp - 10)) - 305.0447927307);
}
} else {
r = round(329.698727446 * pow((temp - 60), -0.1332047592));
g = round(288.1221695283 * pow((temp - 60), -0.0755148492));
b = 255;
}
g += 15; //mod by Aircoookie, a bit less accurate but visibly less pinkish
rgb[0] = (uint8_t) constrain(r, 0, 255);
rgb[1] = (uint8_t) constrain(g, 0, 255);
rgb[2] = (uint8_t) constrain(b, 0, 255);
rgb[3] = 0;
}

void colorCTtoRGB(uint16_t mired, byte* rgb) //white spectrum to rgb, bins
{
//this is only an approximation using WS2812B with gamma correction enabled
if (mired > 475) {
Expand Down
6 changes: 2 additions & 4 deletions wled00/data/settings_sync.htm
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@ <h3>Button setup</h3>
<a href="https://github.com/Aircoookie/WLED/wiki/Infrared-Control" target="_blank">IR info</a>
<h3>WLED Broadcast</h3>
UDP Port: <input name="UP" type="number" min="1" max="65535" class="d5" required><br>
2nd Port: <input name="U2" type="number" min="1" max="65535" class="d5" required><br>
Receive <input type="checkbox" name="RB">Brightness, <input type="checkbox" name="RC">Color, and <input type="checkbox" name="RX">Effects<br>
Send notifications on direct change: <input type="checkbox" name="SD"><br>
Send notifications on button press: <input type="checkbox" name="SB"><br>
Send Alexa notifications: <input type="checkbox" name="SA"><br>
Send Philips Hue change notifications: <input type="checkbox" name="SH"><br>
Send Macro notifications: <input type="checkbox" name="SM"><br>
Send notifications twice: <input type="checkbox" name="S2">
<h3>UDP Api</h3>
Enable UDP Api: <input type="checkbox" name="UAE"><br>
Port: <input name="UAP" type="number" min="1" max="65535" class="d5"><br>
Send notifications twice: <input type="checkbox" name="S2"><br>
<i>Reboot required to apply changes. </i>
<h3>Realtime</h3>
Receive UDP realtime: <input type="checkbox" name="RD"><br><br>
Expand Down
6 changes: 5 additions & 1 deletion wled00/data/settings_time.htm
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ <h2>Time setup</h2>
<option value="10">JST(KST)</option>
<option value="11">AEST/AEDT</option>
<option value="12">NZST/NZDT</option>
<option value="13">North Korea</option>
<option value="13">North Korea</option>
<option value="14">IST (India)</option>
<option value="15">CA-Saskatchewan</option>
<option value="16">ACST</option>
<option value="17">ACST/ACDT</option>
</select><br>
UTC offset: <input name="UO" type="number" min="-65500" max="65500" required> seconds (max. 18 hours)<br>
Current local time is <span class="times">unknown</span>.
Expand Down
8 changes: 5 additions & 3 deletions wled00/fcn_declare.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ void colorFromUint32(uint32_t in, bool secondary = false);
void colorFromUint24(uint32_t in, bool secondary = false);
void relativeChangeWhite(int8_t amount, byte lowerBoundary = 0);
void colorHStoRGB(uint16_t hue, byte sat, byte* rgb); //hue, sat to rgb
void colorKtoRGB(uint16_t kelvin, byte* rgb);
void colorCTtoRGB(uint16_t mired, byte* rgb); //white spectrum to rgb

void colorXYtoRGB(float x, float y, byte* rgb); // only defined if huesync disabled TODO
Expand Down Expand Up @@ -102,6 +103,10 @@ void updateInterfaces(uint8_t callMode);
void handleTransitions();
void handleNightlight();

//lx_parser.cpp
bool parseLx(int lxValue, byte* rgbw);
void parseLxJson(int lxValue, byte segId, bool secondary);

//mqtt.cpp
bool initMqtt();
void publishMqtt();
Expand Down Expand Up @@ -223,7 +228,4 @@ void sappend(char stype, const char* key, int val);
void sappends(char stype, const char* key, char* val);
void getSettingsJS(byte subPage, char* dest);

//lx_parser.cpp
bool parseLx(int lxValue, int rgbw[4]);

#endif
Loading

0 comments on commit 8d3ff16

Please sign in to comment.