IR rewrite. (#2561)
* IR rewrite. - added CCT (WW/CW) support - support for applying change to main segment or all selected segments * Remove extra setValuesFromFirstSelectedSeg() Co-authored-by: cschwinne <dev.aircoookie@gmail.com>
This commit is contained in:
parent
4d4a20e05e
commit
7beae93441
@ -196,6 +196,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
||||
}
|
||||
}
|
||||
CJSON(irEnabled, hw["ir"]["type"]);
|
||||
CJSON(irApplyToAllSelected, hw["ir"]["sel"]);
|
||||
|
||||
JsonObject relay = hw[F("relay")];
|
||||
int hw_relay_pin = relay["pin"] | -2;
|
||||
@ -399,15 +400,15 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
||||
if (act) timerWeekday[it]++;
|
||||
}
|
||||
if (it<8) {
|
||||
JsonObject start = timer["start"];
|
||||
byte startm = start["mon"];
|
||||
if (startm) timerMonth[it] = (startm << 4);
|
||||
JsonObject start = timer["start"];
|
||||
byte startm = start["mon"];
|
||||
if (startm) timerMonth[it] = (startm << 4);
|
||||
CJSON(timerDay[it], start["day"]);
|
||||
JsonObject end = timer["end"];
|
||||
CJSON(timerDayEnd[it], end["day"]);
|
||||
byte endm = end["mon"];
|
||||
if (startm) timerMonth[it] += endm & 0x0F;
|
||||
if (!(timerMonth[it] & 0x0F)) timerMonth[it] += 12; //default end month to 12
|
||||
JsonObject end = timer["end"];
|
||||
CJSON(timerDayEnd[it], end["day"]);
|
||||
byte endm = end["mon"];
|
||||
if (startm) timerMonth[it] += endm & 0x0F;
|
||||
if (!(timerMonth[it] & 0x0F)) timerMonth[it] += 12; //default end month to 12
|
||||
}
|
||||
it++;
|
||||
}
|
||||
@ -630,6 +631,7 @@ void serializeConfig() {
|
||||
JsonObject hw_ir = hw.createNestedObject("ir");
|
||||
hw_ir["pin"] = irPin;
|
||||
hw_ir["type"] = irEnabled; // the byte 'irEnabled' does contain the IR-Remote Type ( 0=disabled )
|
||||
hw_ir["sel"] = irApplyToAllSelected;
|
||||
|
||||
JsonObject hw_relay = hw.createNestedObject(F("relay"));
|
||||
hw_relay["pin"] = rlyPin;
|
||||
@ -791,11 +793,11 @@ void serializeConfig() {
|
||||
timers_ins0["macro"] = timerMacro[i];
|
||||
timers_ins0[F("dow")] = timerWeekday[i] >> 1;
|
||||
if (i<8) {
|
||||
JsonObject start = timers_ins0.createNestedObject("start");
|
||||
JsonObject start = timers_ins0.createNestedObject("start");
|
||||
start["mon"] = (timerMonth[i] >> 4) & 0xF;
|
||||
start["day"] = timerDay[i];
|
||||
JsonObject end = timers_ins0.createNestedObject("end");
|
||||
end["mon"] = timerMonth[i] & 0xF;
|
||||
JsonObject end = timers_ins0.createNestedObject("end");
|
||||
end["mon"] = timerMonth[i] & 0xF;
|
||||
end["day"] = timerDayEnd[i];
|
||||
}
|
||||
}
|
||||
|
@ -3,22 +3,15 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=500">
|
||||
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"/>
|
||||
<title>LED Settings</title>
|
||||
<script>
|
||||
var d=document,laprev=55,maxB=1,maxM=4000,maxPB=4096,maxL=1333,maxLbquot=0; //maximum bytes for LED allocation: 4kB for 8266, 32kB for 32
|
||||
var customStarts=false,startsDirty=[],maxCOOverrides=5;
|
||||
function H()
|
||||
{
|
||||
window.open("https://kno.wled.ge/features/settings/#led-settings");
|
||||
}
|
||||
function B()
|
||||
{
|
||||
window.open("/settings","_self");
|
||||
}
|
||||
function H(){window.open("https://kno.wled.ge/features/settings/#led-settings");}
|
||||
function B(){window.open("/settings","_self");}
|
||||
function gId(n){return d.getElementById(n);}
|
||||
function off(n){
|
||||
d.getElementsByName(n)[0].value = -1;
|
||||
}
|
||||
function off(n){d.getElementsByName(n)[0].value = -1;}
|
||||
var timeout;
|
||||
function showToast(text, error = false)
|
||||
{
|
||||
@ -71,7 +64,6 @@
|
||||
if (bquot > 100) {var msg = "Too many LEDs for me to handle!"; if (maxM < 10000) msg += "\n\rConsider using an ESP32."; alert(msg);}
|
||||
if (d.Sf.checkValidity()) d.Sf.submit(); //https://stackoverflow.com/q/37323914
|
||||
}
|
||||
function S(){GetV();checkSi();setABL();}
|
||||
function enABL()
|
||||
{
|
||||
var en = gId('able').checked;
|
||||
@ -188,13 +180,13 @@
|
||||
var n = LCs[i].name.substring(2); // bus number
|
||||
// do we have a led count field
|
||||
if (nm=="LC") {
|
||||
var c=parseInt(LCs[i].value,10);
|
||||
if (!customStarts || !startsDirty[n]) gId("ls"+n).value=sLC;
|
||||
gId("ls"+n).disabled = !customStarts;
|
||||
var c=parseInt(LCs[i].value,10); //get LED count
|
||||
if (!customStarts || !startsDirty[n]) gId("ls"+n).value=sLC; //update start value
|
||||
gId("ls"+n).disabled = !customStarts; //enable/disable field editing
|
||||
if(c){
|
||||
var s = parseInt(gId("ls"+n).value);
|
||||
if (s+c > sLC) sLC = s+c;
|
||||
if(c>maxLC)maxLC=c;
|
||||
var s = parseInt(gId("ls"+n).value); //start value
|
||||
if (s+c > sLC) sLC = s+c; //update total count
|
||||
if(c>maxLC)maxLC=c; //max per output
|
||||
var t = parseInt(d.getElementsByName("LT"+n)[0].value); // LED type SELECT
|
||||
if (t<80) sPC+=c; //virtual out busses do not count towards physical LEDs
|
||||
} // increase led count
|
||||
@ -313,7 +305,7 @@ ${i+1}:
|
||||
<option value="80">DDP RGB (network)</option>
|
||||
<!--option value="81">E1.31 RGB (network)</option-->
|
||||
<!--option value="82">ArtNet RGB (network)</option-->
|
||||
</select>
|
||||
</select><br>
|
||||
<div id="co${i}" style="display:inline">Color Order:
|
||||
<select name="CO${i}">
|
||||
<option value="0">GRB</option>
|
||||
@ -322,8 +314,7 @@ ${i+1}:
|
||||
<option value="3">RBG</option>
|
||||
<option value="4">BGR</option>
|
||||
<option value="5">GBR</option>
|
||||
</select></div>
|
||||
<br>
|
||||
</select><br></div>
|
||||
<span id="psd${i}">Start:</span> <input type="number" name="LS${i}" id="ls${i}" class="l starts" min="0" max="8191" value="${lastEnd(i)}" oninput="startsDirty[${i}]=true;UI();" required />
|
||||
<div id="dig${i}c" style="display:inline">Length: <input type="number" name="LC${i}" class="l" min="1" max="${maxPB}" value="1" required oninput="UI()" /></div>
|
||||
<br>
|
||||
@ -369,6 +360,7 @@ Length: <input type="number" name="XC${i}" id="xc${i}" class="l" min="1" max="65
|
||||
gId("com_entries").insertAdjacentHTML("beforeend", b);
|
||||
gId("xo"+i).value = co;
|
||||
btnCOM(i+1);
|
||||
UI();
|
||||
}
|
||||
|
||||
function remCOM() {
|
||||
@ -377,6 +369,7 @@ Length: <input type="number" name="XC${i}" id="xc${i}" class="l" min="1" max="65
|
||||
if (i === 0) return;
|
||||
entries[i-1].remove();
|
||||
btnCOM(i-1);
|
||||
UI();
|
||||
}
|
||||
|
||||
function resetCOM(_newMaxCOOverrides=undefined) {
|
||||
@ -396,8 +389,8 @@ Length: <input type="number" name="XC${i}" id="xc${i}" class="l" min="1" max="65
|
||||
|
||||
function addBtn(i,p,t) {
|
||||
var c = gId("btns").innerHTML;
|
||||
var bt = "BT" + String.fromCharCode((i<10?48:55)+i);;
|
||||
var be = "BE" + String.fromCharCode((i<10?48:55)+i);;
|
||||
var bt = "BT" + String.fromCharCode((i<10?48:55)+i);
|
||||
var be = "BE" + String.fromCharCode((i<10?48:55)+i);
|
||||
c += `Button ${i} GPIO: <input type="number" min="-1" max="40" name="${bt}" onchange="UI()" class="xs" value="${p}">`;
|
||||
c += ` <select name="${be}">`
|
||||
c += `<option value="0" ${t==0?"selected":""}>Disabled</option>`;
|
||||
@ -463,7 +456,7 @@ Length: <input type="number" name="XC${i}" id="xc${i}" class="l" min="1" max="65
|
||||
let lines = e.target.result;
|
||||
var c = JSON.parse(lines);
|
||||
if (c.hw) {
|
||||
if (c.hw.led) {
|
||||
if (c.hw.led) {
|
||||
for (var i=0; i<10; i++) addLEDs(-1);
|
||||
var l = c.hw.led;
|
||||
l.ins.forEach((v,i,a)=>{
|
||||
@ -504,6 +497,7 @@ Length: <input type="number" name="XC${i}" id="xc${i}" class="l" min="1" max="65
|
||||
}
|
||||
}
|
||||
}
|
||||
function S(){GetV();checkSi();setABL();}
|
||||
function GetV()
|
||||
{
|
||||
//values injected by server while sending HTML
|
||||
@ -584,8 +578,8 @@ Length: <input type="number" name="XC${i}" id="xc${i}" class="l" min="1" max="65
|
||||
<option value=7>9-key red</option>
|
||||
<option value=8>JSON remote</option>
|
||||
</select><span style="cursor: pointer;" onclick="off('IR')"> ×</span><br>
|
||||
Apply IR change to main segment only: <input type="checkbox" name="MSO"><br>
|
||||
<div id="json" style="display:none;">JSON file: <input type="file" name="data" accept=".json"> <input type="button" value="Upload" onclick="uploadFile('/ir.json');"><br></div>
|
||||
<div id="toast"></div>
|
||||
<a href="https://kno.wled.ge/interfaces/infrared/" target="_blank">IR info</a><br>
|
||||
Relay GPIO: <input type="number" min="-1" max="33" name="RL" onchange="UI()" class="xs"> Invert <input type="checkbox" name="RM"><span style="cursor: pointer;" onclick="off('RL')"> ×</span><br>
|
||||
<hr style="width:260px">
|
||||
@ -638,5 +632,6 @@ Length: <input type="number" name="XC${i}" id="xc${i}" class="l" min="1" max="65
|
||||
<hr>
|
||||
<button type="button" onclick="B()">Back</button><button type="submit">Save</button>
|
||||
</form>
|
||||
<div id="toast"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -108,11 +108,9 @@ void sendImprovInfoResponse();
|
||||
void sendImprovRPCResponse(uint8_t commandId);
|
||||
|
||||
//ir.cpp
|
||||
bool decodeIRCustom(uint32_t code);
|
||||
//bool decodeIRCustom(uint32_t code);
|
||||
void applyRepeatActions();
|
||||
void relativeChange(byte* property, int8_t amount, byte lowerBoundary = 0, byte higherBoundary = 0xFF);
|
||||
void changeEffectSpeed(int8_t amount);
|
||||
void changeEffectIntensity(int8_t amount);
|
||||
byte relativeChange(byte property, int8_t amount, byte lowerBoundary = 0, byte higherBoundary = 0xFF);
|
||||
void decodeIR(uint32_t code);
|
||||
void decodeIR24(uint32_t code);
|
||||
void decodeIR24OLD(uint32_t code);
|
||||
@ -144,6 +142,8 @@ bool serveLiveLeds(AsyncWebServerRequest* request, uint32_t wsClient = 0);
|
||||
#endif
|
||||
|
||||
//led.cpp
|
||||
void setValuesFromSegment(uint8_t s);
|
||||
void setValuesFromMainSeg();
|
||||
void setValuesFromFirstSelectedSeg();
|
||||
void resetTimebase();
|
||||
void toggleOnOff();
|
||||
|
File diff suppressed because one or more lines are too long
637
wled00/ir.cpp
637
wled00/ir.cpp
@ -73,56 +73,94 @@ void presetFallback(uint8_t presetID, uint8_t effectID, uint8_t paletteID)
|
||||
{
|
||||
byte prevError = errorFlag;
|
||||
if (!applyPreset(presetID, CALL_MODE_BUTTON_PRESET)) {
|
||||
effectCurrent = effectID;
|
||||
effectCurrent = effectID;
|
||||
effectPalette = paletteID;
|
||||
errorFlag = prevError; //clear error 12 from non-existent preset
|
||||
}
|
||||
}
|
||||
|
||||
//Add what your custom IR codes should trigger here. Guide: https://github.com/Aircoookie/WLED/wiki/Infrared-Control
|
||||
//IR codes themselves can be defined directly after "case" or in "ir_codes.h"
|
||||
bool decodeIRCustom(uint32_t code)
|
||||
byte relativeChange(byte property, int8_t amount, byte lowerBoundary, byte higherBoundary)
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
//just examples, feel free to modify or remove
|
||||
case IRCUSTOM_ONOFF : toggleOnOff(); break;
|
||||
case IRCUSTOM_MACRO1 : applyPreset(1, CALL_MODE_BUTTON_PRESET); break;
|
||||
|
||||
default: return false;
|
||||
}
|
||||
if (code != IRCUSTOM_MACRO1) colorUpdated(CALL_MODE_BUTTON); //don't update color again if we apply macro, it already does it
|
||||
return true;
|
||||
int16_t new_val = (int16_t) property + amount;
|
||||
if (lowerBoundary >= higherBoundary) return property;
|
||||
if (new_val > higherBoundary) new_val = higherBoundary;
|
||||
if (new_val < lowerBoundary) new_val = lowerBoundary;
|
||||
return (byte)constrain(new_val, 0, 255);
|
||||
}
|
||||
|
||||
void relativeChange(byte* property, int8_t amount, byte lowerBoundary, byte higherBoundary)
|
||||
void changeEffect(uint8_t fx)
|
||||
{
|
||||
int16_t new_val = (int16_t) *property + amount;
|
||||
if (new_val > higherBoundary) new_val = higherBoundary;
|
||||
else if (new_val < lowerBoundary) new_val = lowerBoundary;
|
||||
*property = (byte)constrain(new_val,0.1,255.1);
|
||||
if (irApplyToAllSelected) {
|
||||
for (uint8_t i = 0; i < strip.getMaxSegments(); i++) {
|
||||
WS2812FX::Segment& seg = strip.getSegment(i);
|
||||
if (!seg.isActive() || !seg.isSelected()) continue;
|
||||
strip.setMode(i, fx);
|
||||
}
|
||||
setValuesFromFirstSelectedSeg();
|
||||
} else {
|
||||
strip.setMode(strip.getMainSegmentId(), fx);
|
||||
setValuesFromMainSeg();
|
||||
}
|
||||
stateChanged = true;
|
||||
}
|
||||
|
||||
void changePalette(uint8_t pal)
|
||||
{
|
||||
if (irApplyToAllSelected) {
|
||||
for (uint8_t i = 0; i < strip.getMaxSegments(); i++) {
|
||||
WS2812FX::Segment& seg = strip.getSegment(i);
|
||||
if (!seg.isActive() || !seg.isSelected()) continue;
|
||||
seg.palette = pal;
|
||||
}
|
||||
setValuesFromFirstSelectedSeg();
|
||||
} else {
|
||||
strip.getMainSegment().palette = pal;
|
||||
setValuesFromMainSeg();
|
||||
}
|
||||
stateChanged = true;
|
||||
}
|
||||
|
||||
void changeEffectSpeed(int8_t amount)
|
||||
{
|
||||
if (effectCurrent != 0) {
|
||||
int16_t new_val = (int16_t) effectSpeed + amount;
|
||||
effectSpeed = (byte)constrain(new_val,0.1,255.1);
|
||||
} else { // if Effect == "solid Color", change the hue of the primary color
|
||||
effectSpeed = (byte)constrain(new_val,0,255);
|
||||
if (irApplyToAllSelected) {
|
||||
for (uint8_t i = 0; i < strip.getMaxSegments(); i++) {
|
||||
WS2812FX::Segment& seg = strip.getSegment(i);
|
||||
if (!seg.isActive() || !seg.isSelected()) continue;
|
||||
seg.speed = effectSpeed;
|
||||
}
|
||||
setValuesFromFirstSelectedSeg();
|
||||
} else {
|
||||
strip.getMainSegment().speed = effectSpeed;
|
||||
setValuesFromMainSeg();
|
||||
}
|
||||
} else { // if Effect == "solid Color", change the hue of the primary color
|
||||
WS2812FX::Segment& sseg = irApplyToAllSelected ? strip.getFirstSelectedSeg() : strip.getMainSegment();
|
||||
CRGB fastled_col;
|
||||
fastled_col.red = col[0];
|
||||
fastled_col.green = col[1];
|
||||
fastled_col.blue = col[2];
|
||||
fastled_col.red = R(sseg.colors[0]);
|
||||
fastled_col.green = G(sseg.colors[0]);
|
||||
fastled_col.blue = B(sseg.colors[0]);
|
||||
CHSV prim_hsv = rgb2hsv_approximate(fastled_col);
|
||||
int16_t new_val = (int16_t) prim_hsv.h + amount;
|
||||
int16_t new_val = (int16_t)prim_hsv.h + amount;
|
||||
if (new_val > 255) new_val -= 255; // roll-over if bigger than 255
|
||||
if (new_val < 0) new_val += 255; // roll-over if smaller than 0
|
||||
prim_hsv.h = (byte)new_val;
|
||||
hsv2rgb_rainbow(prim_hsv, fastled_col);
|
||||
col[0] = fastled_col.red;
|
||||
col[1] = fastled_col.green;
|
||||
col[2] = fastled_col.blue;
|
||||
if (irApplyToAllSelected) {
|
||||
for (uint8_t i = 0; i < strip.getMaxSegments(); i++) {
|
||||
WS2812FX::Segment& seg = strip.getSegment(i);
|
||||
if (!seg.isActive() || !seg.isSelected()) continue;
|
||||
seg.colors[0] = RGBW32(fastled_col.red, fastled_col.green, fastled_col.blue, W(sseg.colors[0]));
|
||||
}
|
||||
setValuesFromFirstSelectedSeg();
|
||||
} else {
|
||||
strip.getMainSegment().colors[0] = RGBW32(fastled_col.red, fastled_col.green, fastled_col.blue, W(sseg.colors[0]));
|
||||
setValuesFromMainSeg();
|
||||
}
|
||||
}
|
||||
stateChanged = true;
|
||||
|
||||
if(amount > 0) lastRepeatableAction = ACTION_SPEED_UP;
|
||||
if(amount < 0) lastRepeatableAction = ACTION_SPEED_DOWN;
|
||||
@ -133,26 +171,86 @@ void changeEffectIntensity(int8_t amount)
|
||||
{
|
||||
if (effectCurrent != 0) {
|
||||
int16_t new_val = (int16_t) effectIntensity + amount;
|
||||
effectIntensity = (byte)constrain(new_val,0.1,255.1);
|
||||
} else { // if Effect == "solid Color", change the saturation of the primary color
|
||||
effectIntensity = (byte)constrain(new_val,0,255);
|
||||
if (irApplyToAllSelected) {
|
||||
for (uint8_t i = 0; i < strip.getMaxSegments(); i++) {
|
||||
WS2812FX::Segment& seg = strip.getSegment(i);
|
||||
if (!seg.isActive() || !seg.isSelected()) continue;
|
||||
seg.intensity = effectIntensity;
|
||||
}
|
||||
setValuesFromFirstSelectedSeg();
|
||||
} else {
|
||||
strip.getMainSegment().speed = effectIntensity;
|
||||
setValuesFromMainSeg();
|
||||
}
|
||||
} else { // if Effect == "solid Color", change the saturation of the primary color
|
||||
WS2812FX::Segment& sseg = irApplyToAllSelected ? strip.getFirstSelectedSeg() : strip.getMainSegment();
|
||||
CRGB fastled_col;
|
||||
fastled_col.red = col[0];
|
||||
fastled_col.green = col[1];
|
||||
fastled_col.blue = col[2];
|
||||
fastled_col.red = R(sseg.colors[0]);
|
||||
fastled_col.green = G(sseg.colors[0]);
|
||||
fastled_col.blue = B(sseg.colors[0]);
|
||||
CHSV prim_hsv = rgb2hsv_approximate(fastled_col);
|
||||
int16_t new_val = (int16_t) prim_hsv.s + amount;
|
||||
prim_hsv.s = (byte)constrain(new_val,0.1,255.1); // constrain to 0-255
|
||||
prim_hsv.s = (byte)constrain(new_val,0,255); // constrain to 0-255
|
||||
hsv2rgb_rainbow(prim_hsv, fastled_col);
|
||||
col[0] = fastled_col.red;
|
||||
col[1] = fastled_col.green;
|
||||
col[2] = fastled_col.blue;
|
||||
if (irApplyToAllSelected) {
|
||||
for (uint8_t i = 0; i < strip.getMaxSegments(); i++) {
|
||||
WS2812FX::Segment& seg = strip.getSegment(i);
|
||||
if (!seg.isActive() || !seg.isSelected()) continue;
|
||||
seg.colors[0] = RGBW32(fastled_col.red, fastled_col.green, fastled_col.blue, W(sseg.colors[0]));
|
||||
}
|
||||
setValuesFromFirstSelectedSeg();
|
||||
} else {
|
||||
strip.getMainSegment().colors[0] = RGBW32(fastled_col.red, fastled_col.green, fastled_col.blue, W(sseg.colors[0]));
|
||||
setValuesFromMainSeg();
|
||||
}
|
||||
}
|
||||
stateChanged = true;
|
||||
|
||||
if(amount > 0) lastRepeatableAction = ACTION_INTENSITY_UP;
|
||||
if(amount < 0) lastRepeatableAction = ACTION_INTENSITY_DOWN;
|
||||
lastRepeatableValue = amount;
|
||||
}
|
||||
|
||||
void changeColor(uint32_t c, int16_t cct=-1)
|
||||
{
|
||||
if (irApplyToAllSelected) {
|
||||
// main segment may not be selected!
|
||||
for (uint8_t i = 0; i < strip.getMaxSegments(); i++) {
|
||||
WS2812FX::Segment& seg = strip.getSegment(i);
|
||||
if (!seg.isActive() || !seg.isSelected()) continue;
|
||||
byte capabilities = seg.getLightCapabilities();
|
||||
uint32_t mask = 0;
|
||||
bool isRGB = GET_BIT(capabilities, 0); // when RGBW_MODE_AUTO_ACCURATE this is always true
|
||||
bool hasW = GET_BIT(capabilities, 1);
|
||||
bool isCCT = GET_BIT(capabilities, 2);
|
||||
if (isRGB) mask |= 0x00FFFFFF; // RGB
|
||||
if (hasW) mask |= 0xFF000000; // white
|
||||
if (hasW && (Bus::getAutoWhiteMode() == RGBW_MODE_AUTO_ACCURATE) && (c & 0xFF000000)) { // white channel & white specified
|
||||
seg.setColor(0, c | 0xFFFFFF, i); // for accurate mode we fake white
|
||||
} else if (c & mask) seg.setColor(0, c & mask, i); // only apply if not black
|
||||
if (isCCT && cct >= 0) seg.setCCT(cct, i);
|
||||
}
|
||||
setValuesFromFirstSelectedSeg();
|
||||
} else {
|
||||
byte i = strip.getMainSegmentId();
|
||||
WS2812FX::Segment& seg = strip.getSegment(i);
|
||||
byte capabilities = seg.getLightCapabilities();
|
||||
uint32_t mask = 0;
|
||||
bool isRGB = GET_BIT(capabilities, 0);
|
||||
bool hasW = GET_BIT(capabilities, 1);
|
||||
bool isCCT = GET_BIT(capabilities, 2);
|
||||
if (isRGB) mask |= 0x00FFFFFF; // RGB
|
||||
if (hasW) mask |= 0xFF000000; // white
|
||||
if (hasW && (Bus::getAutoWhiteMode() == RGBW_MODE_AUTO_ACCURATE) && (c & 0xFF000000)) { // white channel & white specified
|
||||
seg.setColor(0, c | 0xFFFFFF, i); // for accurate mode we fake white
|
||||
} else if (c & mask) seg.setColor(0, c & mask, i); // only apply if not black
|
||||
if (isCCT && cct >= 0) seg.setCCT(cct, i);
|
||||
setValuesFromMainSeg();
|
||||
}
|
||||
stateChanged = true;
|
||||
}
|
||||
|
||||
void decodeIR(uint32_t code)
|
||||
{
|
||||
if (code == 0xFFFFFFFF) //repeated code, continue brightness up/down
|
||||
@ -162,14 +260,15 @@ void decodeIR(uint32_t code)
|
||||
return;
|
||||
}
|
||||
lastValidCode = 0; irTimesRepeated = 0;
|
||||
//if (decodeIRCustom(code)) return;
|
||||
lastRepeatableAction = ACTION_NONE;
|
||||
if (decodeIRCustom(code)) return;
|
||||
if (irEnabled == 8) { // any remote configurable with ir.json file
|
||||
decodeIRJson(code);
|
||||
colorUpdated(CALL_MODE_BUTTON);
|
||||
stateUpdated(CALL_MODE_BUTTON);
|
||||
return;
|
||||
}
|
||||
if (code > 0xFFFFFF) return; //invalid code
|
||||
|
||||
switch (irEnabled) {
|
||||
case 1:
|
||||
if (code > 0xF80000) {
|
||||
@ -178,16 +277,15 @@ void decodeIR(uint32_t code)
|
||||
decodeIR24(code); // 24-key remote - 0xF70000 to 0xF80000
|
||||
}
|
||||
break;
|
||||
case 2: decodeIR24CT(code); break; // white 24-key remote with CW, WW, CT+ and CT- keys
|
||||
case 3: decodeIR40(code); break; // blue 40-key remote with 25%, 50%, 75% and 100% keys
|
||||
case 4: decodeIR44(code); break; // white 44-key remote with color-up/down keys and DIY1 to 6 keys
|
||||
case 5: decodeIR21(code); break; // white 21-key remote
|
||||
case 6: decodeIR6(code); break; // black 6-key learning remote defaults: "CH" controls brightness,
|
||||
// "VOL +" controls effect, "VOL -" controls colour/palette, "MUTE"
|
||||
// sets bright plain white
|
||||
case 7: decodeIR9(code); break;
|
||||
case 2: decodeIR24CT(code); break; // white 24-key remote with CW, WW, CT+ and CT- keys
|
||||
case 3: decodeIR40(code); break; // blue 40-key remote with 25%, 50%, 75% and 100% keys
|
||||
case 4: decodeIR44(code); break; // white 44-key remote with color-up/down keys and DIY1 to 6 keys
|
||||
case 5: decodeIR21(code); break; // white 21-key remote
|
||||
case 6: decodeIR6(code); break; // black 6-key learning remote defaults: "CH" controls brightness,
|
||||
// "VOL +" controls effect, "VOL -" controls colour/palette, "MUTE"
|
||||
// sets bright plain white
|
||||
case 7: decodeIR9(code); break;
|
||||
//case 8: return; // ir.json file, handled above switch statement
|
||||
default: return;
|
||||
}
|
||||
|
||||
if (nightlightActive && bri == 0) nightlightActive = false;
|
||||
@ -224,26 +322,26 @@ void applyRepeatActions()
|
||||
void decodeIR24(uint32_t code)
|
||||
{
|
||||
switch (code) {
|
||||
case IR24_BRIGHTER : incBrightness(); break;
|
||||
case IR24_DARKER : decBrightness(); break;
|
||||
case IR24_OFF : if (bri > 0) briLast = bri; bri = 0; break;
|
||||
case IR24_ON : bri = briLast; break;
|
||||
case IR24_RED : colorFromUint32(COLOR_RED); break;
|
||||
case IR24_REDDISH : colorFromUint32(COLOR_REDDISH); break;
|
||||
case IR24_ORANGE : colorFromUint32(COLOR_ORANGE); break;
|
||||
case IR24_YELLOWISH : colorFromUint32(COLOR_YELLOWISH); break;
|
||||
case IR24_YELLOW : colorFromUint32(COLOR_YELLOW); break;
|
||||
case IR24_GREEN : colorFromUint32(COLOR_GREEN); break;
|
||||
case IR24_GREENISH : colorFromUint32(COLOR_GREENISH); break;
|
||||
case IR24_TURQUOISE : colorFromUint32(COLOR_TURQUOISE); break;
|
||||
case IR24_CYAN : colorFromUint32(COLOR_CYAN); break;
|
||||
case IR24_AQUA : colorFromUint32(COLOR_AQUA); break;
|
||||
case IR24_BLUE : colorFromUint32(COLOR_BLUE); break;
|
||||
case IR24_DEEPBLUE : colorFromUint32(COLOR_DEEPBLUE); break;
|
||||
case IR24_PURPLE : colorFromUint32(COLOR_PURPLE); break;
|
||||
case IR24_MAGENTA : colorFromUint32(COLOR_MAGENTA); break;
|
||||
case IR24_PINK : colorFromUint32(COLOR_PINK); break;
|
||||
case IR24_WHITE : colorFromUint32(COLOR_WHITE); effectCurrent = 0; break;
|
||||
case IR24_BRIGHTER : incBrightness(); break;
|
||||
case IR24_DARKER : decBrightness(); break;
|
||||
case IR24_OFF : if (bri > 0) briLast = bri; bri = 0; break;
|
||||
case IR24_ON : bri = briLast; break;
|
||||
case IR24_RED : changeColor(COLOR_RED); break;
|
||||
case IR24_REDDISH : changeColor(COLOR_REDDISH); break;
|
||||
case IR24_ORANGE : changeColor(COLOR_ORANGE); break;
|
||||
case IR24_YELLOWISH : changeColor(COLOR_YELLOWISH); break;
|
||||
case IR24_YELLOW : changeColor(COLOR_YELLOW); break;
|
||||
case IR24_GREEN : changeColor(COLOR_GREEN); break;
|
||||
case IR24_GREENISH : changeColor(COLOR_GREENISH); break;
|
||||
case IR24_TURQUOISE : changeColor(COLOR_TURQUOISE); break;
|
||||
case IR24_CYAN : changeColor(COLOR_CYAN); break;
|
||||
case IR24_AQUA : changeColor(COLOR_AQUA); break;
|
||||
case IR24_BLUE : changeColor(COLOR_BLUE); break;
|
||||
case IR24_DEEPBLUE : changeColor(COLOR_DEEPBLUE); break;
|
||||
case IR24_PURPLE : changeColor(COLOR_PURPLE); break;
|
||||
case IR24_MAGENTA : changeColor(COLOR_MAGENTA); break;
|
||||
case IR24_PINK : changeColor(COLOR_PINK); break;
|
||||
case IR24_WHITE : changeColor(COLOR_WHITE); changeEffect(FX_MODE_STATIC); break;
|
||||
case IR24_FLASH : presetFallback(1, FX_MODE_COLORTWINKLE, effectPalette); break;
|
||||
case IR24_STROBE : presetFallback(2, FX_MODE_RAINBOW_CYCLE, effectPalette); break;
|
||||
case IR24_FADE : presetFallback(3, FX_MODE_BREATH, effectPalette); break;
|
||||
@ -256,30 +354,30 @@ void decodeIR24(uint32_t code)
|
||||
void decodeIR24OLD(uint32_t code)
|
||||
{
|
||||
switch (code) {
|
||||
case IR24_OLD_BRIGHTER : incBrightness(); break;
|
||||
case IR24_OLD_DARKER : decBrightness(); break;
|
||||
case IR24_OLD_OFF : if (bri > 0) briLast = bri; bri = 0; break;
|
||||
case IR24_OLD_ON : bri = briLast; break;
|
||||
case IR24_OLD_RED : colorFromUint32(COLOR_RED); break;
|
||||
case IR24_OLD_REDDISH : colorFromUint32(COLOR_REDDISH); break;
|
||||
case IR24_OLD_ORANGE : colorFromUint32(COLOR_ORANGE); break;
|
||||
case IR24_OLD_YELLOWISH : colorFromUint32(COLOR_YELLOWISH); break;
|
||||
case IR24_OLD_YELLOW : colorFromUint32(COLOR_YELLOW); break;
|
||||
case IR24_OLD_GREEN : colorFromUint32(COLOR_GREEN); break;
|
||||
case IR24_OLD_GREENISH : colorFromUint32(COLOR_GREENISH); break;
|
||||
case IR24_OLD_TURQUOISE : colorFromUint32(COLOR_TURQUOISE); break;
|
||||
case IR24_OLD_CYAN : colorFromUint32(COLOR_CYAN); break;
|
||||
case IR24_OLD_AQUA : colorFromUint32(COLOR_AQUA); break;
|
||||
case IR24_OLD_BLUE : colorFromUint32(COLOR_BLUE); break;
|
||||
case IR24_OLD_DEEPBLUE : colorFromUint32(COLOR_DEEPBLUE); break;
|
||||
case IR24_OLD_PURPLE : colorFromUint32(COLOR_PURPLE); break;
|
||||
case IR24_OLD_MAGENTA : colorFromUint32(COLOR_MAGENTA); break;
|
||||
case IR24_OLD_PINK : colorFromUint32(COLOR_PINK); break;
|
||||
case IR24_OLD_WHITE : colorFromUint32(COLOR_WHITE); effectCurrent = 0; break;
|
||||
case IR24_OLD_FLASH : presetFallback(1, FX_MODE_COLORTWINKLE, 0); break;
|
||||
case IR24_OLD_STROBE : presetFallback(2, FX_MODE_RAINBOW_CYCLE, 0); break;
|
||||
case IR24_OLD_FADE : presetFallback(3, FX_MODE_BREATH, 0); break;
|
||||
case IR24_OLD_SMOOTH : presetFallback(4, FX_MODE_RAINBOW, 0); break;
|
||||
case IR24_OLD_BRIGHTER : incBrightness(); break;
|
||||
case IR24_OLD_DARKER : decBrightness(); break;
|
||||
case IR24_OLD_OFF : if (bri > 0) briLast = bri; bri = 0; break;
|
||||
case IR24_OLD_ON : bri = briLast; break;
|
||||
case IR24_OLD_RED : changeColor(COLOR_RED); break;
|
||||
case IR24_OLD_REDDISH : changeColor(COLOR_REDDISH); break;
|
||||
case IR24_OLD_ORANGE : changeColor(COLOR_ORANGE); break;
|
||||
case IR24_OLD_YELLOWISH : changeColor(COLOR_YELLOWISH); break;
|
||||
case IR24_OLD_YELLOW : changeColor(COLOR_YELLOW); break;
|
||||
case IR24_OLD_GREEN : changeColor(COLOR_GREEN); break;
|
||||
case IR24_OLD_GREENISH : changeColor(COLOR_GREENISH); break;
|
||||
case IR24_OLD_TURQUOISE : changeColor(COLOR_TURQUOISE); break;
|
||||
case IR24_OLD_CYAN : changeColor(COLOR_CYAN); break;
|
||||
case IR24_OLD_AQUA : changeColor(COLOR_AQUA); break;
|
||||
case IR24_OLD_BLUE : changeColor(COLOR_BLUE); break;
|
||||
case IR24_OLD_DEEPBLUE : changeColor(COLOR_DEEPBLUE); break;
|
||||
case IR24_OLD_PURPLE : changeColor(COLOR_PURPLE); break;
|
||||
case IR24_OLD_MAGENTA : changeColor(COLOR_MAGENTA); break;
|
||||
case IR24_OLD_PINK : changeColor(COLOR_PINK); break;
|
||||
case IR24_OLD_WHITE : changeColor(COLOR_WHITE); changeEffect(FX_MODE_STATIC); break;
|
||||
case IR24_OLD_FLASH : presetFallback(1, FX_MODE_COLORTWINKLE, 0); break;
|
||||
case IR24_OLD_STROBE : presetFallback(2, FX_MODE_RAINBOW_CYCLE, 0); break;
|
||||
case IR24_OLD_FADE : presetFallback(3, FX_MODE_BREATH, 0); break;
|
||||
case IR24_OLD_SMOOTH : presetFallback(4, FX_MODE_RAINBOW, 0); break;
|
||||
default: return;
|
||||
}
|
||||
lastValidCode = code;
|
||||
@ -292,28 +390,26 @@ void decodeIR24CT(uint32_t code)
|
||||
case IR24_CT_DARKER : decBrightness(); break;
|
||||
case IR24_CT_OFF : if (bri > 0) briLast = bri; bri = 0; break;
|
||||
case IR24_CT_ON : bri = briLast; break;
|
||||
case IR24_CT_RED : colorFromUint32(COLOR_RED); break;
|
||||
case IR24_CT_REDDISH : colorFromUint32(COLOR_REDDISH); break;
|
||||
case IR24_CT_ORANGE : colorFromUint32(COLOR_ORANGE); break;
|
||||
case IR24_CT_YELLOWISH : colorFromUint32(COLOR_YELLOWISH); break;
|
||||
case IR24_CT_YELLOW : colorFromUint32(COLOR_YELLOW); break;
|
||||
case IR24_CT_GREEN : colorFromUint32(COLOR_GREEN); break;
|
||||
case IR24_CT_GREENISH : colorFromUint32(COLOR_GREENISH); break;
|
||||
case IR24_CT_TURQUOISE : colorFromUint32(COLOR_TURQUOISE); break;
|
||||
case IR24_CT_CYAN : colorFromUint32(COLOR_CYAN); break;
|
||||
case IR24_CT_AQUA : colorFromUint32(COLOR_AQUA); break;
|
||||
case IR24_CT_BLUE : colorFromUint32(COLOR_BLUE); break;
|
||||
case IR24_CT_DEEPBLUE : colorFromUint32(COLOR_DEEPBLUE); break;
|
||||
case IR24_CT_PURPLE : colorFromUint32(COLOR_PURPLE); break;
|
||||
case IR24_CT_MAGENTA : colorFromUint32(COLOR_MAGENTA); break;
|
||||
case IR24_CT_PINK : colorFromUint32(COLOR_PINK); break;
|
||||
case IR24_CT_COLDWHITE : colorFromUint32(COLOR2_COLDWHITE); effectCurrent = 0; break;
|
||||
case IR24_CT_WARMWHITE : colorFromUint32(COLOR2_WARMWHITE); effectCurrent = 0; break;
|
||||
case IR24_CT_CTPLUS : colorFromUint32(COLOR2_COLDWHITE2); effectCurrent = 0; break;
|
||||
case IR24_CT_CTMINUS : colorFromUint32(COLOR2_WARMWHITE2); effectCurrent = 0; break;
|
||||
case IR24_CT_MEMORY : {
|
||||
if (col[3] > 0) col[3] = 0;
|
||||
else colorFromUint32(COLOR2_NEUTRALWHITE); effectCurrent = 0; } break;
|
||||
case IR24_CT_RED : changeColor(COLOR_RED); break;
|
||||
case IR24_CT_REDDISH : changeColor(COLOR_REDDISH); break;
|
||||
case IR24_CT_ORANGE : changeColor(COLOR_ORANGE); break;
|
||||
case IR24_CT_YELLOWISH : changeColor(COLOR_YELLOWISH); break;
|
||||
case IR24_CT_YELLOW : changeColor(COLOR_YELLOW); break;
|
||||
case IR24_CT_GREEN : changeColor(COLOR_GREEN); break;
|
||||
case IR24_CT_GREENISH : changeColor(COLOR_GREENISH); break;
|
||||
case IR24_CT_TURQUOISE : changeColor(COLOR_TURQUOISE); break;
|
||||
case IR24_CT_CYAN : changeColor(COLOR_CYAN); break;
|
||||
case IR24_CT_AQUA : changeColor(COLOR_AQUA); break;
|
||||
case IR24_CT_BLUE : changeColor(COLOR_BLUE); break;
|
||||
case IR24_CT_DEEPBLUE : changeColor(COLOR_DEEPBLUE); break;
|
||||
case IR24_CT_PURPLE : changeColor(COLOR_PURPLE); break;
|
||||
case IR24_CT_MAGENTA : changeColor(COLOR_MAGENTA); break;
|
||||
case IR24_CT_PINK : changeColor(COLOR_PINK); break;
|
||||
case IR24_CT_COLDWHITE : changeColor(COLOR_COLDWHITE2, 255); changeEffect(FX_MODE_STATIC); break;
|
||||
case IR24_CT_WARMWHITE : changeColor(COLOR_WARMWHITE2, 0); changeEffect(FX_MODE_STATIC); break;
|
||||
case IR24_CT_CTPLUS : changeColor(COLOR_COLDWHITE, strip.getSegment(strip.getMainSegmentId()).cct+1); changeEffect(FX_MODE_STATIC); break;
|
||||
case IR24_CT_CTMINUS : changeColor(COLOR_WARMWHITE, strip.getSegment(strip.getMainSegmentId()).cct-1); changeEffect(FX_MODE_STATIC); break;
|
||||
case IR24_CT_MEMORY : changeColor(COLOR_NEUTRALWHITE, 127); changeEffect(FX_MODE_STATIC); break;
|
||||
default: return;
|
||||
}
|
||||
lastValidCode = code;
|
||||
@ -322,56 +418,47 @@ void decodeIR24CT(uint32_t code)
|
||||
void decodeIR40(uint32_t code)
|
||||
{
|
||||
switch (code) {
|
||||
case IR40_BPLUS : incBrightness(); break;
|
||||
case IR40_BMINUS : decBrightness(); break;
|
||||
case IR40_OFF : if (bri > 0) briLast = bri; bri = 0; break;
|
||||
case IR40_ON : bri = briLast; break;
|
||||
case IR40_RED : colorFromUint24(COLOR_RED); break;
|
||||
case IR40_REDDISH : colorFromUint24(COLOR_REDDISH); break;
|
||||
case IR40_ORANGE : colorFromUint24(COLOR_ORANGE); break;
|
||||
case IR40_YELLOWISH : colorFromUint24(COLOR_YELLOWISH); break;
|
||||
case IR40_YELLOW : colorFromUint24(COLOR_YELLOW); break;
|
||||
case IR40_GREEN : colorFromUint24(COLOR_GREEN); break;
|
||||
case IR40_GREENISH : colorFromUint24(COLOR_GREENISH); break;
|
||||
case IR40_TURQUOISE : colorFromUint24(COLOR_TURQUOISE); break;
|
||||
case IR40_CYAN : colorFromUint24(COLOR_CYAN); break;
|
||||
case IR40_AQUA : colorFromUint24(COLOR_AQUA); break;
|
||||
case IR40_BLUE : colorFromUint24(COLOR_BLUE); break;
|
||||
case IR40_DEEPBLUE : colorFromUint24(COLOR_DEEPBLUE); break;
|
||||
case IR40_PURPLE : colorFromUint24(COLOR_PURPLE); break;
|
||||
case IR40_MAGENTA : colorFromUint24(COLOR_MAGENTA); break;
|
||||
case IR40_PINK : colorFromUint24(COLOR_PINK); break;
|
||||
case IR40_WARMWHITE2 : {
|
||||
if (strip.hasWhiteChannel()) {colorFromUint32(COLOR2_WARMWHITE2); effectCurrent = 0; }
|
||||
else colorFromUint24(COLOR_WARMWHITE2); } break;
|
||||
case IR40_WARMWHITE : {
|
||||
if (strip.hasWhiteChannel()) {colorFromUint32(COLOR2_WARMWHITE); effectCurrent = 0; }
|
||||
else colorFromUint24(COLOR_WARMWHITE); } break;
|
||||
case IR40_WHITE : {
|
||||
if (strip.hasWhiteChannel()) {colorFromUint32(COLOR2_NEUTRALWHITE); effectCurrent = 0; }
|
||||
else colorFromUint24(COLOR_NEUTRALWHITE); } break;
|
||||
case IR40_COLDWHITE : {
|
||||
if (strip.hasWhiteChannel()) {colorFromUint32(COLOR2_COLDWHITE); effectCurrent = 0; }
|
||||
else colorFromUint24(COLOR_COLDWHITE); } break;
|
||||
case IR40_COLDWHITE2 : {
|
||||
if (strip.hasWhiteChannel()) {colorFromUint32(COLOR2_COLDWHITE2); effectCurrent = 0; }
|
||||
else colorFromUint24(COLOR_COLDWHITE2); } break;
|
||||
case IR40_WPLUS : relativeChangeWhite(10); break;
|
||||
case IR40_WMINUS : relativeChangeWhite(-10, 5); break;
|
||||
case IR40_WOFF : whiteLast = col[3]; col[3] = 0; break;
|
||||
case IR40_WON : col[3] = whiteLast; break;
|
||||
case IR40_W25 : bri = 63; break;
|
||||
case IR40_W50 : bri = 127; break;
|
||||
case IR40_W75 : bri = 191; break;
|
||||
case IR40_W100 : bri = 255; break;
|
||||
case IR40_QUICK : changeEffectSpeed( 16); break;
|
||||
case IR40_SLOW : changeEffectSpeed(-16); break;
|
||||
case IR40_JUMP7 : changeEffectIntensity( 16); break;
|
||||
case IR40_AUTO : changeEffectIntensity(-16); break;
|
||||
case IR40_BPLUS : incBrightness(); break;
|
||||
case IR40_BMINUS : decBrightness(); break;
|
||||
case IR40_OFF : if (bri > 0) briLast = bri; bri = 0; break;
|
||||
case IR40_ON : bri = briLast; break;
|
||||
case IR40_RED : changeColor(COLOR_RED); break;
|
||||
case IR40_REDDISH : changeColor(COLOR_REDDISH); break;
|
||||
case IR40_ORANGE : changeColor(COLOR_ORANGE); break;
|
||||
case IR40_YELLOWISH : changeColor(COLOR_YELLOWISH); break;
|
||||
case IR40_YELLOW : changeColor(COLOR_YELLOW); break;
|
||||
case IR40_GREEN : changeColor(COLOR_GREEN); break;
|
||||
case IR40_GREENISH : changeColor(COLOR_GREENISH); break;
|
||||
case IR40_TURQUOISE : changeColor(COLOR_TURQUOISE); break;
|
||||
case IR40_CYAN : changeColor(COLOR_CYAN); break;
|
||||
case IR40_AQUA : changeColor(COLOR_AQUA); break;
|
||||
case IR40_BLUE : changeColor(COLOR_BLUE); break;
|
||||
case IR40_DEEPBLUE : changeColor(COLOR_DEEPBLUE); break;
|
||||
case IR40_PURPLE : changeColor(COLOR_PURPLE); break;
|
||||
case IR40_MAGENTA : changeColor(COLOR_MAGENTA); break;
|
||||
case IR40_PINK : changeColor(COLOR_PINK); break;
|
||||
case IR40_WARMWHITE2 : changeColor(COLOR_WARMWHITE2, 0); changeEffect(FX_MODE_STATIC); break;
|
||||
case IR40_WARMWHITE : changeColor(COLOR_WARMWHITE, 63); changeEffect(FX_MODE_STATIC); break;
|
||||
case IR40_WHITE : changeColor(COLOR_NEUTRALWHITE, 127); changeEffect(FX_MODE_STATIC); break;
|
||||
case IR40_COLDWHITE : changeColor(COLOR_COLDWHITE, 191); changeEffect(FX_MODE_STATIC); break;
|
||||
case IR40_COLDWHITE2 : changeColor(COLOR_COLDWHITE2, 255); changeEffect(FX_MODE_STATIC); break;
|
||||
case IR40_WPLUS : relativeChangeWhite(10); break;
|
||||
case IR40_WMINUS : relativeChangeWhite(-10, 5); break;
|
||||
case IR40_WOFF : whiteLast = col[3]; col[3] = 0; break;
|
||||
case IR40_WON : col[3] = whiteLast; break;
|
||||
case IR40_W25 : bri = 63; break;
|
||||
case IR40_W50 : bri = 127; break;
|
||||
case IR40_W75 : bri = 191; break;
|
||||
case IR40_W100 : bri = 255; break;
|
||||
case IR40_QUICK : changeEffectSpeed( 16); break;
|
||||
case IR40_SLOW : changeEffectSpeed(-16); break;
|
||||
case IR40_JUMP7 : changeEffectIntensity( 16); break;
|
||||
case IR40_AUTO : changeEffectIntensity(-16); break;
|
||||
case IR40_JUMP3 : presetFallback(1, FX_MODE_STATIC, 0); break;
|
||||
case IR40_FADE3 : presetFallback(2, FX_MODE_BREATH, 0); break;
|
||||
case IR40_FADE7 : presetFallback(3, FX_MODE_FIRE_FLICKER, 0); break;
|
||||
case IR40_FLASH : presetFallback(4, FX_MODE_RAINBOW, 0); break;
|
||||
default: return;
|
||||
}
|
||||
lastValidCode = code;
|
||||
}
|
||||
@ -379,62 +466,51 @@ void decodeIR40(uint32_t code)
|
||||
void decodeIR44(uint32_t code)
|
||||
{
|
||||
switch (code) {
|
||||
case IR44_BPLUS : incBrightness(); break;
|
||||
case IR44_BMINUS : decBrightness(); break;
|
||||
case IR44_OFF : if (bri > 0) briLast = bri; bri = 0; break;
|
||||
case IR44_ON : bri = briLast; break;
|
||||
case IR44_RED : colorFromUint24(COLOR_RED); break;
|
||||
case IR44_REDDISH : colorFromUint24(COLOR_REDDISH); break;
|
||||
case IR44_ORANGE : colorFromUint24(COLOR_ORANGE); break;
|
||||
case IR44_YELLOWISH : colorFromUint24(COLOR_YELLOWISH); break;
|
||||
case IR44_YELLOW : colorFromUint24(COLOR_YELLOW); break;
|
||||
case IR44_GREEN : colorFromUint24(COLOR_GREEN); break;
|
||||
case IR44_GREENISH : colorFromUint24(COLOR_GREENISH); break;
|
||||
case IR44_TURQUOISE : colorFromUint24(COLOR_TURQUOISE); break;
|
||||
case IR44_CYAN : colorFromUint24(COLOR_CYAN); break;
|
||||
case IR44_AQUA : colorFromUint24(COLOR_AQUA); break;
|
||||
case IR44_BLUE : colorFromUint24(COLOR_BLUE); break;
|
||||
case IR44_DEEPBLUE : colorFromUint24(COLOR_DEEPBLUE); break;
|
||||
case IR44_PURPLE : colorFromUint24(COLOR_PURPLE); break;
|
||||
case IR44_MAGENTA : colorFromUint24(COLOR_MAGENTA); break;
|
||||
case IR44_PINK : colorFromUint24(COLOR_PINK); break;
|
||||
case IR44_WHITE : {
|
||||
if (strip.hasWhiteChannel()) {
|
||||
if (col[3] > 0) col[3] = 0;
|
||||
else { colorFromUint32(COLOR2_NEUTRALWHITE); effectCurrent = 0; }
|
||||
} else colorFromUint24(COLOR_NEUTRALWHITE); } break;
|
||||
case IR44_WARMWHITE2 : {
|
||||
if (strip.hasWhiteChannel()) {colorFromUint32(COLOR2_WARMWHITE2); effectCurrent = 0; }
|
||||
else colorFromUint24(COLOR_WARMWHITE2); } break;
|
||||
case IR44_WARMWHITE : {
|
||||
if (strip.hasWhiteChannel()) {colorFromUint32(COLOR2_WARMWHITE); effectCurrent = 0; }
|
||||
else colorFromUint24(COLOR_WARMWHITE); } break;
|
||||
case IR44_COLDWHITE : {
|
||||
if (strip.hasWhiteChannel()) {colorFromUint32(COLOR2_COLDWHITE); effectCurrent = 0; }
|
||||
else colorFromUint24(COLOR_COLDWHITE); } break;
|
||||
case IR44_COLDWHITE2 : {
|
||||
if (strip.hasWhiteChannel()) {colorFromUint32(COLOR2_COLDWHITE2); effectCurrent = 0; }
|
||||
else colorFromUint24(COLOR_COLDWHITE2); } break;
|
||||
case IR44_REDPLUS : relativeChange(&effectCurrent, 1, 0, MODE_COUNT); break;
|
||||
case IR44_REDMINUS : relativeChange(&effectCurrent, -1, 0); break;
|
||||
case IR44_GREENPLUS : relativeChange(&effectPalette, 1, 0, strip.getPaletteCount() -1); break;
|
||||
case IR44_GREENMINUS : relativeChange(&effectPalette, -1, 0); break;
|
||||
case IR44_BLUEPLUS : changeEffectIntensity( 16); break;
|
||||
case IR44_BLUEMINUS : changeEffectIntensity(-16); break;
|
||||
case IR44_QUICK : changeEffectSpeed( 16); break;
|
||||
case IR44_SLOW : changeEffectSpeed(-16); break;
|
||||
case IR44_BPLUS : incBrightness(); break;
|
||||
case IR44_BMINUS : decBrightness(); break;
|
||||
case IR44_OFF : if (bri > 0) briLast = bri; bri = 0; break;
|
||||
case IR44_ON : bri = briLast; break;
|
||||
case IR44_RED : changeColor(COLOR_RED); break;
|
||||
case IR44_REDDISH : changeColor(COLOR_REDDISH); break;
|
||||
case IR44_ORANGE : changeColor(COLOR_ORANGE); break;
|
||||
case IR44_YELLOWISH : changeColor(COLOR_YELLOWISH); break;
|
||||
case IR44_YELLOW : changeColor(COLOR_YELLOW); break;
|
||||
case IR44_GREEN : changeColor(COLOR_GREEN); break;
|
||||
case IR44_GREENISH : changeColor(COLOR_GREENISH); break;
|
||||
case IR44_TURQUOISE : changeColor(COLOR_TURQUOISE); break;
|
||||
case IR44_CYAN : changeColor(COLOR_CYAN); break;
|
||||
case IR44_AQUA : changeColor(COLOR_AQUA); break;
|
||||
case IR44_BLUE : changeColor(COLOR_BLUE); break;
|
||||
case IR44_DEEPBLUE : changeColor(COLOR_DEEPBLUE); break;
|
||||
case IR44_PURPLE : changeColor(COLOR_PURPLE); break;
|
||||
case IR44_MAGENTA : changeColor(COLOR_MAGENTA); break;
|
||||
case IR44_PINK : changeColor(COLOR_PINK); break;
|
||||
case IR44_WHITE : changeColor(COLOR_NEUTRALWHITE, 127); changeEffect(FX_MODE_STATIC); break;
|
||||
case IR44_WARMWHITE2 : changeColor(COLOR_WARMWHITE2, 0); changeEffect(FX_MODE_STATIC); break;
|
||||
case IR44_WARMWHITE : changeColor(COLOR_WARMWHITE, 63); changeEffect(FX_MODE_STATIC); break;
|
||||
case IR44_COLDWHITE : changeColor(COLOR_COLDWHITE, 191); changeEffect(FX_MODE_STATIC); break;
|
||||
case IR44_COLDWHITE2 : changeColor(COLOR_COLDWHITE2, 255); changeEffect(FX_MODE_STATIC); break;
|
||||
case IR44_REDPLUS : changeEffect(relativeChange(effectCurrent, 1, 0, MODE_COUNT -1)); break;
|
||||
case IR44_REDMINUS : changeEffect(relativeChange(effectCurrent, -1, 0, MODE_COUNT -1)); break;
|
||||
case IR44_GREENPLUS : changePalette(relativeChange(effectPalette, 1, 0, strip.getPaletteCount() -1)); break;
|
||||
case IR44_GREENMINUS : changePalette(relativeChange(effectPalette, -1, 0, strip.getPaletteCount() -1)); break;
|
||||
case IR44_BLUEPLUS : changeEffectIntensity( 16); break;
|
||||
case IR44_BLUEMINUS : changeEffectIntensity(-16); break;
|
||||
case IR44_QUICK : changeEffectSpeed( 16); break;
|
||||
case IR44_SLOW : changeEffectSpeed(-16); break;
|
||||
case IR44_DIY1 : presetFallback(1, FX_MODE_STATIC, 0); break;
|
||||
case IR44_DIY2 : presetFallback(2, FX_MODE_BREATH, 0); break;
|
||||
case IR44_DIY3 : presetFallback(3, FX_MODE_FIRE_FLICKER, 0); break;
|
||||
case IR44_DIY4 : presetFallback(4, FX_MODE_RAINBOW, 0); break;
|
||||
case IR44_DIY5 : presetFallback(5, FX_MODE_METEOR_SMOOTH, 0); break;
|
||||
case IR44_DIY6 : presetFallback(6, FX_MODE_RAIN, 0); break;
|
||||
case IR44_AUTO : effectCurrent = FX_MODE_STATIC; break;
|
||||
case IR44_FLASH : effectCurrent = FX_MODE_PALETTE; break;
|
||||
case IR44_JUMP3 : bri = 63; break;
|
||||
case IR44_JUMP7 : bri = 127; break;
|
||||
case IR44_FADE3 : bri = 191; break;
|
||||
case IR44_FADE7 : bri = 255; break;
|
||||
case IR44_AUTO : changeEffect(FX_MODE_STATIC); break;
|
||||
case IR44_FLASH : changeEffect(FX_MODE_PALETTE); break;
|
||||
case IR44_JUMP3 : bri = 63; break;
|
||||
case IR44_JUMP7 : bri = 127; break;
|
||||
case IR44_FADE3 : bri = 191; break;
|
||||
case IR44_FADE7 : bri = 255; break;
|
||||
default: return;
|
||||
}
|
||||
lastValidCode = code;
|
||||
}
|
||||
@ -442,28 +518,28 @@ void decodeIR44(uint32_t code)
|
||||
void decodeIR21(uint32_t code)
|
||||
{
|
||||
switch (code) {
|
||||
case IR21_BRIGHTER: incBrightness(); break;
|
||||
case IR21_DARKER: decBrightness(); break;
|
||||
case IR21_OFF: if (bri > 0) briLast = bri; bri = 0; break;
|
||||
case IR21_ON: bri = briLast; break;
|
||||
case IR21_RED: colorFromUint32(COLOR_RED); break;
|
||||
case IR21_REDDISH: colorFromUint32(COLOR_REDDISH); break;
|
||||
case IR21_ORANGE: colorFromUint32(COLOR_ORANGE); break;
|
||||
case IR21_YELLOWISH: colorFromUint32(COLOR_YELLOWISH); break;
|
||||
case IR21_GREEN: colorFromUint32(COLOR_GREEN); break;
|
||||
case IR21_GREENISH: colorFromUint32(COLOR_GREENISH); break;
|
||||
case IR21_TURQUOISE: colorFromUint32(COLOR_TURQUOISE); break;
|
||||
case IR21_CYAN: colorFromUint32(COLOR_CYAN); break;
|
||||
case IR21_BLUE: colorFromUint32(COLOR_BLUE); break;
|
||||
case IR21_DEEPBLUE: colorFromUint32(COLOR_DEEPBLUE); break;
|
||||
case IR21_PURPLE: colorFromUint32(COLOR_PURPLE); break;
|
||||
case IR21_PINK: colorFromUint32(COLOR_PINK); break;
|
||||
case IR21_WHITE: colorFromUint32(COLOR_WHITE); effectCurrent = 0; break;
|
||||
case IR21_FLASH: presetFallback(1, FX_MODE_COLORTWINKLE, 0); break;
|
||||
case IR21_STROBE: presetFallback(2, FX_MODE_RAINBOW_CYCLE, 0); break;
|
||||
case IR21_FADE: presetFallback(3, FX_MODE_BREATH, 0); break;
|
||||
case IR21_SMOOTH: presetFallback(4, FX_MODE_RAINBOW, 0); break;
|
||||
default: return;
|
||||
case IR21_BRIGHTER: incBrightness(); break;
|
||||
case IR21_DARKER: decBrightness(); break;
|
||||
case IR21_OFF: if (bri > 0) briLast = bri; bri = 0; break;
|
||||
case IR21_ON: bri = briLast; break;
|
||||
case IR21_RED: changeColor(COLOR_RED); break;
|
||||
case IR21_REDDISH: changeColor(COLOR_REDDISH); break;
|
||||
case IR21_ORANGE: changeColor(COLOR_ORANGE); break;
|
||||
case IR21_YELLOWISH: changeColor(COLOR_YELLOWISH); break;
|
||||
case IR21_GREEN: changeColor(COLOR_GREEN); break;
|
||||
case IR21_GREENISH: changeColor(COLOR_GREENISH); break;
|
||||
case IR21_TURQUOISE: changeColor(COLOR_TURQUOISE); break;
|
||||
case IR21_CYAN: changeColor(COLOR_CYAN); break;
|
||||
case IR21_BLUE: changeColor(COLOR_BLUE); break;
|
||||
case IR21_DEEPBLUE: changeColor(COLOR_DEEPBLUE); break;
|
||||
case IR21_PURPLE: changeColor(COLOR_PURPLE); break;
|
||||
case IR21_PINK: changeColor(COLOR_PINK); break;
|
||||
case IR21_WHITE: changeColor(COLOR_WHITE); changeEffect(FX_MODE_STATIC); break;
|
||||
case IR21_FLASH: presetFallback(1, FX_MODE_COLORTWINKLE, 0); break;
|
||||
case IR21_STROBE: presetFallback(2, FX_MODE_RAINBOW_CYCLE, 0); break;
|
||||
case IR21_FADE: presetFallback(3, FX_MODE_BREATH, 0); break;
|
||||
case IR21_SMOOTH: presetFallback(4, FX_MODE_RAINBOW, 0); break;
|
||||
default: return;
|
||||
}
|
||||
lastValidCode = code;
|
||||
}
|
||||
@ -471,31 +547,32 @@ void decodeIR21(uint32_t code)
|
||||
void decodeIR6(uint32_t code)
|
||||
{
|
||||
switch (code) {
|
||||
case IR6_POWER: toggleOnOff(); break;
|
||||
case IR6_CHANNEL_UP: incBrightness(); break;
|
||||
case IR6_CHANNEL_DOWN: decBrightness(); break;
|
||||
case IR6_VOLUME_UP: relativeChange(&effectCurrent, 1, 0, MODE_COUNT); break; // next effect
|
||||
case IR6_VOLUME_DOWN: // next palette
|
||||
relativeChange(&effectPalette, 1, 0, strip.getPaletteCount() -1);
|
||||
case IR6_POWER: toggleOnOff(); break;
|
||||
case IR6_CHANNEL_UP: incBrightness(); break;
|
||||
case IR6_CHANNEL_DOWN: decBrightness(); break;
|
||||
case IR6_VOLUME_UP: changeEffect(relativeChange(effectCurrent, 1, 0, MODE_COUNT -1)); break;
|
||||
case IR6_VOLUME_DOWN: changePalette(relativeChange(effectPalette, 1, 0, strip.getPaletteCount() -1));
|
||||
switch(lastIR6ColourIdx) {
|
||||
case 0: colorFromUint32(COLOR_RED); break;
|
||||
case 1: colorFromUint32(COLOR_REDDISH); break;
|
||||
case 2: colorFromUint32(COLOR_ORANGE); break;
|
||||
case 3: colorFromUint32(COLOR_YELLOWISH); break;
|
||||
case 4: colorFromUint32(COLOR_GREEN); break;
|
||||
case 5: colorFromUint32(COLOR_GREENISH); break;
|
||||
case 6: colorFromUint32(COLOR_TURQUOISE); break;
|
||||
case 7: colorFromUint32(COLOR_CYAN); break;
|
||||
case 8: colorFromUint32(COLOR_BLUE); break;
|
||||
case 9: colorFromUint32(COLOR_DEEPBLUE); break;
|
||||
case 10:colorFromUint32(COLOR_PURPLE); break;
|
||||
case 11:colorFromUint32(COLOR_PINK); break;
|
||||
case 12:colorFromUint32(COLOR_WHITE); break;
|
||||
default: break;
|
||||
case 0: changeColor(COLOR_RED); break;
|
||||
case 1: changeColor(COLOR_REDDISH); break;
|
||||
case 2: changeColor(COLOR_ORANGE); break;
|
||||
case 3: changeColor(COLOR_YELLOWISH); break;
|
||||
case 4: changeColor(COLOR_GREEN); break;
|
||||
case 5: changeColor(COLOR_GREENISH); break;
|
||||
case 6: changeColor(COLOR_TURQUOISE); break;
|
||||
case 7: changeColor(COLOR_CYAN); break;
|
||||
case 8: changeColor(COLOR_BLUE); break;
|
||||
case 9: changeColor(COLOR_DEEPBLUE); break;
|
||||
case 10:changeColor(COLOR_PURPLE); break;
|
||||
case 11:changeColor(COLOR_PINK); break;
|
||||
case 12:changeColor(COLOR_WHITE); break;
|
||||
default: break;
|
||||
}
|
||||
lastIR6ColourIdx++;
|
||||
if(lastIR6ColourIdx > 12) lastIR6ColourIdx = 0; break;
|
||||
case IR6_MUTE: effectCurrent = 0; effectPalette = 0; colorFromUint32(COLOR_WHITE); bri=255; break;
|
||||
if(lastIR6ColourIdx > 12) lastIR6ColourIdx = 0;
|
||||
break;
|
||||
case IR6_MUTE: changeEffect(FX_MODE_STATIC); changePalette(0); changeColor(COLOR_WHITE); bri=255; break;
|
||||
default: return;
|
||||
}
|
||||
lastValidCode = code;
|
||||
}
|
||||
@ -503,17 +580,15 @@ void decodeIR6(uint32_t code)
|
||||
void decodeIR9(uint32_t code)
|
||||
{
|
||||
switch (code) {
|
||||
case IR9_POWER : toggleOnOff(); break;
|
||||
case IR9_A : presetFallback(1, FX_MODE_COLORTWINKLE, effectPalette); break;
|
||||
case IR9_B : presetFallback(2, FX_MODE_RAINBOW_CYCLE, effectPalette); break;
|
||||
case IR9_C : presetFallback(3, FX_MODE_BREATH, effectPalette); break;
|
||||
case IR9_UP : incBrightness(); break;
|
||||
case IR9_DOWN : decBrightness(); break;
|
||||
//case IR9_UP : changeEffectIntensity(16); break;
|
||||
//case IR9_DOWN : changeEffectIntensity(-16); break;
|
||||
case IR9_LEFT : changeEffectSpeed(-16); break;
|
||||
case IR9_RIGHT : changeEffectSpeed(16); break;
|
||||
case IR9_SELECT : relativeChange(&effectCurrent, 1, 0, MODE_COUNT); break;
|
||||
case IR9_POWER : toggleOnOff(); break;
|
||||
case IR9_A : presetFallback(1, FX_MODE_COLORTWINKLE, effectPalette); break;
|
||||
case IR9_B : presetFallback(2, FX_MODE_RAINBOW_CYCLE, effectPalette); break;
|
||||
case IR9_C : presetFallback(3, FX_MODE_BREATH, effectPalette); break;
|
||||
case IR9_UP : incBrightness(); break;
|
||||
case IR9_DOWN : decBrightness(); break;
|
||||
case IR9_LEFT : changeEffectSpeed(-16); break;
|
||||
case IR9_RIGHT : changeEffectSpeed(16); break;
|
||||
case IR9_SELECT : changeEffect(relativeChange(effectCurrent, 1, 0, MODE_COUNT -1)); break;
|
||||
default: return;
|
||||
}
|
||||
lastValidCode = code;
|
||||
@ -575,7 +650,7 @@ void decodeIRJson(uint32_t code)
|
||||
cmdStr = fdo["cmd"].as<String>();
|
||||
jsonCmdObj = fdo["cmd"]; //object
|
||||
|
||||
if (jsonCmdObj.isNull())
|
||||
if (jsonCmdObj.isNull()) // we could also use: fdo["cmd"].is<String>()
|
||||
{
|
||||
if (cmdStr.startsWith("!")) {
|
||||
// call limited set of C functions
|
||||
@ -586,30 +661,26 @@ void decodeIRJson(uint32_t code)
|
||||
lastValidCode = code;
|
||||
decBrightness();
|
||||
} else if (cmdStr.startsWith(F("!presetF"))) { //!presetFallback
|
||||
uint8_t p1 = fdo["PL"] ? fdo["PL"] : 1;
|
||||
uint8_t p2 = fdo["FX"] ? fdo["FX"] : random8(MODE_COUNT);
|
||||
uint8_t p3 = fdo["FP"] ? fdo["FP"] : 0;
|
||||
uint8_t p1 = fdo["PL"] | 1;
|
||||
uint8_t p2 = fdo["FX"] | random8(MODE_COUNT -1);
|
||||
uint8_t p3 = fdo["FP"] | 0;
|
||||
presetFallback(p1, p2, p3);
|
||||
}
|
||||
} else {
|
||||
// HTTP API command
|
||||
if (cmdStr.indexOf("~") || fdo["rpt"])
|
||||
{
|
||||
// repeatable action
|
||||
lastValidCode = code;
|
||||
String apireq = "win"; apireq += '&'; // reduce flash string usage
|
||||
if (cmdStr.indexOf("~") || fdo["rpt"]) lastValidCode = code; // repeatable action
|
||||
if (!cmdStr.startsWith(apireq)) cmdStr = apireq + cmdStr; // if no "win&" prefix
|
||||
if (!irApplyToAllSelected && cmdStr.indexOf(F("SS="))<0) {
|
||||
char tmp[10];
|
||||
sprintf_P(tmp, PSTR("&SS=%d"), strip.getMainSegmentId());
|
||||
cmdStr += tmp;
|
||||
}
|
||||
if (effectCurrent == 0 && cmdStr.indexOf("FP=") > -1) {
|
||||
// setting palette but it wont show because effect is solid
|
||||
effectCurrent = FX_MODE_GRADIENT;
|
||||
}
|
||||
if (!cmdStr.startsWith("win&")) {
|
||||
cmdStr = "win&" + cmdStr;
|
||||
}
|
||||
fdo.clear(); //clear JSON buffer (it is no longer needed)
|
||||
handleSet(nullptr, cmdStr, false); // no colorUpdated() call here
|
||||
fdo.clear(); // clear JSON buffer (it is no longer needed)
|
||||
handleSet(nullptr, cmdStr, false); // no stateUpdated() call here
|
||||
}
|
||||
} else {
|
||||
// command is JSON object
|
||||
// command is JSON object (TODO: currently will not handle irApplyToAllSelected correctly)
|
||||
if (jsonCmdObj[F("psave")].isNull()) deserializeState(jsonCmdObj, CALL_MODE_BUTTON_PRESET);
|
||||
else {
|
||||
uint8_t psave = jsonCmdObj[F("psave")].as<int>();
|
||||
|
@ -26,7 +26,7 @@
|
||||
//Infrared codes for 24-key remote from http://woodsgood.ca/projects/2015/02/13/rgb-led-strip-controllers-ir-codes/
|
||||
#define IR24_BRIGHTER 0xF700FF
|
||||
#define IR24_DARKER 0xF7807F
|
||||
#define IR24_OFF 0xF740BF
|
||||
#define IR24_OFF 0xF740BF
|
||||
#define IR24_ON 0xF7C03F
|
||||
#define IR24_RED 0xF720DF
|
||||
#define IR24_REDDISH 0xF710EF
|
||||
@ -35,7 +35,7 @@
|
||||
#define IR24_YELLOW 0xF728D7
|
||||
#define IR24_GREEN 0xF7A05F
|
||||
#define IR24_GREENISH 0xF7906F
|
||||
#define IR24_TURQUOISE 0xF7B04F
|
||||
#define IR24_TURQUOISE 0xF7B04F
|
||||
#define IR24_CYAN 0xF78877
|
||||
#define IR24_AQUA 0xF7A857
|
||||
#define IR24_BLUE 0xF7609F
|
||||
@ -76,30 +76,30 @@
|
||||
#define IR24_CT_MEMORY 0xF7E817 // MEMORY
|
||||
|
||||
// 24-key defs for old remote control
|
||||
#define IR24_OLD_BRIGHTER 0xFF906F // Brightness Up
|
||||
#define IR24_OLD_DARKER 0xFFB847 // Brightness Down
|
||||
#define IR24_OLD_OFF 0xFFF807 // Power OFF
|
||||
#define IR24_OLD_ON 0xFFB04F // Power On
|
||||
#define IR24_OLD_RED 0xFF9867 // RED
|
||||
#define IR24_OLD_REDDISH 0xFFE817 // Light RED
|
||||
#define IR24_OLD_ORANGE 0xFF02FD // Orange
|
||||
#define IR24_OLD_YELLOWISH 0xFF50AF // Light Orange
|
||||
#define IR24_OLD_YELLOW 0xFF38C7 // YELLOW
|
||||
#define IR24_OLD_GREEN 0xFFD827 // GREEN
|
||||
#define IR24_OLD_GREENISH 0xFF48B7 // Light GREEN
|
||||
#define IR24_OLD_TURQUOISE 0xFF32CD // TURQUOISE
|
||||
#define IR24_OLD_BRIGHTER 0xFF906F // Brightness Up
|
||||
#define IR24_OLD_DARKER 0xFFB847 // Brightness Down
|
||||
#define IR24_OLD_OFF 0xFFF807 // Power OFF
|
||||
#define IR24_OLD_ON 0xFFB04F // Power On
|
||||
#define IR24_OLD_RED 0xFF9867 // RED
|
||||
#define IR24_OLD_REDDISH 0xFFE817 // Light RED
|
||||
#define IR24_OLD_ORANGE 0xFF02FD // Orange
|
||||
#define IR24_OLD_YELLOWISH 0xFF50AF // Light Orange
|
||||
#define IR24_OLD_YELLOW 0xFF38C7 // YELLOW
|
||||
#define IR24_OLD_GREEN 0xFFD827 // GREEN
|
||||
#define IR24_OLD_GREENISH 0xFF48B7 // Light GREEN
|
||||
#define IR24_OLD_TURQUOISE 0xFF32CD // TURQUOISE
|
||||
#define IR24_OLD_CYAN 0xFF7887 // CYAN
|
||||
#define IR24_OLD_AQUA 0xFF28D7 // AQUA
|
||||
#define IR24_OLD_BLUE 0xFF8877 // BLUE
|
||||
#define IR24_OLD_AQUA 0xFF28D7 // AQUA
|
||||
#define IR24_OLD_BLUE 0xFF8877 // BLUE
|
||||
#define IR24_OLD_DEEPBLUE 0xFF6897 // Dark BLUE
|
||||
#define IR24_OLD_PURPLE 0xFF20DF // PURPLE
|
||||
#define IR24_OLD_MAGENTA 0xFF708F // MAGENTA
|
||||
#define IR24_OLD_PINK 0xFFF00F // PINK
|
||||
#define IR24_OLD_WHITE 0xFFA857 // WHITE
|
||||
#define IR24_OLD_FLASH 0xFFB24D // FLASH Mode
|
||||
#define IR24_OLD_STROBE 0xFF00FF // STROBE Mode
|
||||
#define IR24_OLD_FADE 0xFF58A7 // FADE Mode
|
||||
#define IR24_OLD_SMOOTH 0xFF30CF // SMOOTH Mode
|
||||
#define IR24_OLD_PURPLE 0xFF20DF // PURPLE
|
||||
#define IR24_OLD_MAGENTA 0xFF708F // MAGENTA
|
||||
#define IR24_OLD_PINK 0xFFF00F // PINK
|
||||
#define IR24_OLD_WHITE 0xFFA857 // WHITE
|
||||
#define IR24_OLD_FLASH 0xFFB24D // FLASH Mode
|
||||
#define IR24_OLD_STROBE 0xFF00FF // STROBE Mode
|
||||
#define IR24_OLD_FADE 0xFF58A7 // FADE Mode
|
||||
#define IR24_OLD_SMOOTH 0xFF30CF // SMOOTH Mode
|
||||
|
||||
// 40-key defs for blue remote control
|
||||
#define IR40_BPLUS 0xFF3AC5 //
|
||||
@ -212,32 +212,27 @@
|
||||
#define IR21_FADE 0xFF02FD
|
||||
#define IR21_SMOOTH 0xFFC23D
|
||||
|
||||
#define COLOR_RED 0xFF0000
|
||||
#define COLOR_REDDISH 0xFF7800
|
||||
#define COLOR_ORANGE 0xFFA000
|
||||
#define COLOR_YELLOWISH 0xFFC800
|
||||
#define COLOR_YELLOW 0xFFFF00
|
||||
#define COLOR_GREEN 0x00FF00
|
||||
#define COLOR_GREENISH 0x00FF78
|
||||
#define COLOR_TURQUOISE 0x00FFA0
|
||||
#define COLOR_CYAN 0x00FFDC
|
||||
#define COLOR_AQUA 0x00C8FF
|
||||
#define COLOR_BLUE 0x00A0FF
|
||||
#define COLOR_DEEPBLUE 0x0000FF
|
||||
#define COLOR_PURPLE 0xAA00FF
|
||||
#define COLOR_MAGENTA 0xFF00DC
|
||||
#define COLOR_PINK 0xFF00A0
|
||||
#define COLOR_WHITE 0xFFFFDC
|
||||
#define COLOR_WARMWHITE2 0xFFAA69
|
||||
#define COLOR_WARMWHITE 0xFFBF8E
|
||||
#define COLOR_NEUTRALWHITE 0xFFD4B4
|
||||
#define COLOR_COLDWHITE 0xFFE9D9
|
||||
#define COLOR_COLDWHITE2 0xFFFFFF
|
||||
#define COLOR2_WARMWHITE2 0xFFFF9900
|
||||
#define COLOR2_WARMWHITE 0xFF825A00
|
||||
#define COLOR2_NEUTRALWHITE 0xFF000000
|
||||
#define COLOR2_COLDWHITE 0xFF7F7F7F
|
||||
#define COLOR2_COLDWHITE2 0xFFFFFFFF
|
||||
#define COLOR_RED 0xFF0000
|
||||
#define COLOR_REDDISH 0xFF7800
|
||||
#define COLOR_ORANGE 0xFFA000
|
||||
#define COLOR_YELLOWISH 0xFFC800
|
||||
#define COLOR_YELLOW 0xFFFF00
|
||||
#define COLOR_GREEN 0x00FF00
|
||||
#define COLOR_GREENISH 0x00FF78
|
||||
#define COLOR_TURQUOISE 0x00FFA0
|
||||
#define COLOR_CYAN 0x00FFDC
|
||||
#define COLOR_AQUA 0x00C8FF
|
||||
#define COLOR_BLUE 0x00A0FF
|
||||
#define COLOR_DEEPBLUE 0x0000FF
|
||||
#define COLOR_PURPLE 0xAA00FF
|
||||
#define COLOR_MAGENTA 0xFF00DC
|
||||
#define COLOR_PINK 0xFF00A0
|
||||
#define COLOR_WHITE 0xFFFFFFFF
|
||||
#define COLOR_WARMWHITE2 0xFFFFAA69
|
||||
#define COLOR_WARMWHITE 0xFFFFBF8E
|
||||
#define COLOR_NEUTRALWHITE 0xFFFFD4B4
|
||||
#define COLOR_COLDWHITE 0xFFFFE9D9
|
||||
#define COLOR_COLDWHITE2 0xFFFFFFFF
|
||||
|
||||
#define ACTION_NONE 0
|
||||
#define ACTION_BRIGHT_UP 1
|
||||
@ -246,4 +241,4 @@
|
||||
#define ACTION_SPEED_DOWN 4
|
||||
#define ACTION_INTENSITY_UP 5
|
||||
#define ACTION_INTENSITY_DOWN 6
|
||||
#define ACTION_POWER 7
|
||||
#define ACTION_POWER 7
|
||||
|
@ -3,15 +3,24 @@
|
||||
/*
|
||||
* LED methods
|
||||
*/
|
||||
void setValuesFromFirstSelectedSeg()
|
||||
|
||||
void setValuesFromMainSeg() { setValuesFromSegment(strip.getMainSegmentId()); }
|
||||
void setValuesFromFirstSelectedSeg() { setValuesFromSegment(strip.getFirstSelectedSegId()); }
|
||||
void setValuesFromSegment(uint8_t s)
|
||||
{
|
||||
WS2812FX::Segment& seg = strip.getFirstSelectedSeg();
|
||||
colorFromUint32(seg.colors[0]);
|
||||
colorFromUint32(seg.colors[1], true);
|
||||
effectCurrent = seg.mode;
|
||||
effectSpeed = seg.speed;
|
||||
WS2812FX::Segment& seg = strip.getSegment(s);
|
||||
col[0] = R(seg.colors[0]);
|
||||
col[1] = G(seg.colors[0]);
|
||||
col[2] = B(seg.colors[0]);
|
||||
col[3] = W(seg.colors[0]);
|
||||
colSec[0] = R(seg.colors[1]);
|
||||
colSec[1] = G(seg.colors[1]);
|
||||
colSec[2] = B(seg.colors[1]);
|
||||
colSec[3] = W(seg.colors[1]);
|
||||
effectCurrent = seg.mode;
|
||||
effectSpeed = seg.speed;
|
||||
effectIntensity = seg.intensity;
|
||||
effectPalette = seg.palette;
|
||||
effectPalette = seg.palette;
|
||||
}
|
||||
|
||||
|
||||
@ -26,20 +35,14 @@ void applyValuesToSelectedSegs()
|
||||
WS2812FX::Segment& seg = strip.getSegment(i);
|
||||
if (i != firstSel && (!seg.isActive() || !seg.isSelected())) continue;
|
||||
|
||||
if (effectSpeed != selsegPrev.speed) {
|
||||
seg.speed = effectSpeed; stateChanged = true;}
|
||||
if (effectIntensity != selsegPrev.intensity) {
|
||||
seg.intensity = effectIntensity; stateChanged = true;}
|
||||
if (effectPalette != selsegPrev.palette) {
|
||||
seg.palette = effectPalette; stateChanged = true;}
|
||||
if (effectCurrent != selsegPrev.mode) {
|
||||
strip.setMode(i, effectCurrent); stateChanged = true;}
|
||||
uint32_t col0 = RGBW32(col[0],col[1],col[2],col[3]);
|
||||
if (effectSpeed != selsegPrev.speed) {seg.speed = effectSpeed; stateChanged = true;}
|
||||
if (effectIntensity != selsegPrev.intensity) {seg.intensity = effectIntensity; stateChanged = true;}
|
||||
if (effectPalette != selsegPrev.palette) {seg.palette = effectPalette; stateChanged = true;}
|
||||
if (effectCurrent != selsegPrev.mode) {strip.setMode(i, effectCurrent); stateChanged = true;}
|
||||
uint32_t col0 = RGBW32( col[0], col[1], col[2], col[3]);
|
||||
uint32_t col1 = RGBW32(colSec[0], colSec[1], colSec[2], colSec[3]);
|
||||
if (col0 != selsegPrev.colors[0]) {
|
||||
seg.setColor(0, col0, i); stateChanged = true;}
|
||||
if (col1 != selsegPrev.colors[1]) {
|
||||
seg.setColor(1, col1, i); stateChanged = true;}
|
||||
if (col0 != selsegPrev.colors[0]) {seg.setColor(0, col0, i); stateChanged = true;}
|
||||
if (col1 != selsegPrev.colors[1]) {seg.setColor(1, col1, i); stateChanged = true;}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,6 +145,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
irPin = -1;
|
||||
}
|
||||
irEnabled = request->arg(F("IT")).toInt();
|
||||
irApplyToAllSelected = !request->hasArg(F("MSO"));
|
||||
|
||||
int hw_rly_pin = request->arg(F("RL")).toInt();
|
||||
if (pinManager.allocatePin(hw_rly_pin,true, PinOwner::Relay)) {
|
||||
@ -795,7 +796,7 @@ bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply)
|
||||
if (pos > 0) {
|
||||
byte temp;
|
||||
for (uint8_t i=0; i<4; i++) {
|
||||
temp = colIn[i];
|
||||
temp = colIn[i];
|
||||
colIn[i] = colInSec[i];
|
||||
colInSec[i] = temp;
|
||||
}
|
||||
@ -829,13 +830,14 @@ bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply)
|
||||
|
||||
stateChanged |= (fxModeChanged || speedChanged || intensityChanged || paletteChanged);
|
||||
|
||||
// apply to main and all selected segments to prevent #1618.
|
||||
for (uint8_t i = 0; i < strip.getMaxSegments(); i++) {
|
||||
WS2812FX::Segment& seg = strip.getSegment(i);
|
||||
if (i != selectedSeg && (singleSegment || !seg.isActive() || !seg.isSelected())) continue;
|
||||
if (i != selectedSeg && (singleSegment || !seg.isActive() || !seg.isSelected())) continue; // skip non main segments if not applying to all
|
||||
if (fxModeChanged) strip.setMode(i, effectIn);
|
||||
if (speedChanged) seg.speed = speedIn;
|
||||
if (speedChanged) seg.speed = speedIn;
|
||||
if (intensityChanged) seg.intensity = intensityIn;
|
||||
if (paletteChanged) seg.palette = paletteIn;
|
||||
if (paletteChanged) seg.palette = paletteIn;
|
||||
}
|
||||
|
||||
//set advanced overlay
|
||||
|
@ -303,7 +303,12 @@ WLED_GLOBAL bool nodeListEnabled _INIT(true);
|
||||
WLED_GLOBAL bool nodeBroadcastEnabled _INIT(true);
|
||||
|
||||
WLED_GLOBAL byte buttonType[WLED_MAX_BUTTONS] _INIT({BTN_TYPE_PUSH});
|
||||
WLED_GLOBAL byte irEnabled _INIT(0); // Infrared receiver
|
||||
#if defined(IRTYPE) && defined(IRPIN)
|
||||
WLED_GLOBAL byte irEnabled _INIT(IRTYPE); // Infrared receiver
|
||||
#else
|
||||
WLED_GLOBAL byte irEnabled _INIT(0); // Infrared receiver disabled
|
||||
#endif
|
||||
WLED_GLOBAL bool irApplyToAllSelected _INIT(true); //apply IR to all selected segments
|
||||
|
||||
WLED_GLOBAL uint16_t udpPort _INIT(21324); // WLED notifier default port
|
||||
WLED_GLOBAL uint16_t udpPort2 _INIT(65506); // WLED notifier supplemental port
|
||||
|
@ -462,6 +462,7 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
sappend('v',SET_F("TT"),touchThreshold);
|
||||
sappend('v',SET_F("IR"),irPin);
|
||||
sappend('v',SET_F("IT"),irEnabled);
|
||||
sappend('c',SET_F("MSO"),!irApplyToAllSelected);
|
||||
}
|
||||
|
||||
if (subPage == 3)
|
||||
|
Loading…
Reference in New Issue
Block a user