Apply IR to main or selected segments.

Refactored IR code.
This commit is contained in:
Blaz Kristan 2022-02-07 00:40:45 +01:00
parent 6c943a7158
commit e35ad7551b
9 changed files with 284 additions and 237 deletions

View File

@ -199,6 +199,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;
@ -625,6 +626,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;

View File

@ -11,6 +11,13 @@ void colorFromUint32(uint32_t in, bool secondary)
_col[1] = G(in);
_col[2] = B(in);
_col[3] = W(in);
if (strip.applyToAllSelected) {
for (uint8_t i = 0; i < strip.getMaxSegments(); i++) {
WS2812FX::Segment& seg = strip.getSegment(i);
if (!seg.isActive() || !seg.isSelected()) continue;
seg.colors[secondary?1:0] = in;
}
}
colorChanged = true;
}
@ -21,6 +28,13 @@ void colorFromUint24(uint32_t in, bool secondary)
_col[0] = R(in);
_col[1] = G(in);
_col[2] = B(in);
if (strip.applyToAllSelected) {
for (uint8_t i = 0; i < strip.getMaxSegments(); i++) {
WS2812FX::Segment& seg = strip.getSegment(i);
if (!seg.isActive() || !seg.isSelected()) continue;
seg.colors[secondary?1:0] = in & 0xFFFFFF;
}
}
colorChanged = true;
}

View File

@ -579,6 +579,7 @@ 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')">&nbsp;&#x2715;</span><br>
Apply IR button 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"><button type="button" class="sml" onclick="uploadFile('/ir.json')">Upload</button><br></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')">&nbsp;&#x2715;</span><br>

View File

@ -108,7 +108,7 @@ void sendImprovRPCResponse(uint8_t commandId);
//ir.cpp
//bool decodeIRCustom(uint32_t code);
void applyRepeatActions();
void relativeChange(byte* property, int8_t amount, byte lowerBoundary = 0, byte higherBoundary = 0xFF);
byte relativeChange(byte property, int8_t amount, byte lowerBoundary = 0, byte higherBoundary = 0xFF);
void changeEffectSpeed(int8_t amount);
void changeEffectIntensity(int8_t amount);
void decodeIR(uint32_t code);

View File

@ -195,7 +195,7 @@ const uint8_t PAGE_settings_wifi[] PROGMEM = {
// Autogenerated from wled00/data/settings_leds.htm, do not edit!!
const uint16_t PAGE_settings_leds_length = 6885;
const uint16_t PAGE_settings_leds_length = 6911;
const uint8_t PAGE_settings_leds[] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xdd, 0x3c, 0x6b, 0x57, 0xeb, 0x46,
0x92, 0xdf, 0xfd, 0x2b, 0x9a, 0x4e, 0x42, 0xa4, 0x41, 0x18, 0xc9, 0x0f, 0xc2, 0xb5, 0x2d, 0xb3,
@ -577,57 +577,58 @@ const uint8_t PAGE_settings_leds[] PROGMEM = {
0x13, 0xad, 0xe4, 0x5b, 0x5b, 0x35, 0xe7, 0x35, 0xd6, 0x8e, 0x69, 0xf7, 0x58, 0xd1, 0x13, 0xa5,
0xc4, 0x16, 0x5c, 0x3f, 0xd1, 0xee, 0x3b, 0x01, 0x16, 0x97, 0xc8, 0x22, 0xeb, 0x39, 0x77, 0x45,
0xe5, 0x19, 0x0b, 0xd1, 0x95, 0x44, 0x5c, 0xf4, 0x2b, 0x95, 0xb5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0x9a, 0xca, 0x5e, 0xf7, 0xca,
0x94, 0xf5, 0x52, 0x7c, 0x51, 0x46, 0x8c, 0xc7, 0x98, 0xcd, 0xb0, 0x55, 0x30, 0x8d, 0x1e, 0x60,
0xb0, 0xb9, 0x43, 0xfc, 0x15, 0x3d, 0x84, 0x05, 0x8f, 0x6c, 0x91, 0x10, 0x1c, 0x69, 0xee, 0x58,
0x0b, 0x0d, 0x1e, 0xe2, 0x11, 0xce, 0x35, 0xe8, 0x12, 0x85, 0xc6, 0xc5, 0x2f, 0xf1, 0xc8, 0xe5,
0x0b, 0xa5, 0x0c, 0x3e, 0x96, 0xa7, 0x25, 0xb1, 0x81, 0xc6, 0xdf, 0x26, 0x68, 0xed, 0x50, 0x9c,
0x5a, 0x56, 0x18, 0x7c, 0x84, 0xc2, 0xa0, 0x92, 0x0b, 0xfa, 0xe3, 0x75, 0xff, 0xd5, 0x42, 0xc7,
0x1b, 0x89, 0x2a, 0x2f, 0x1c, 0xf9, 0x63, 0x92, 0xf2, 0xe9, 0x2c, 0x28, 0xd2, 0xaf, 0x94, 0xe7,
0x7c, 0x35, 0x4a, 0xfe, 0xf5, 0x9c, 0x8f, 0xea, 0x7d, 0xe4, 0x6c, 0xbb, 0xb9, 0x06, 0x05, 0x89,
0x08, 0xed, 0x65, 0xf9, 0x1e, 0xb6, 0xef, 0x4b, 0x91, 0x57, 0xde, 0xb0, 0x31, 0xb0, 0x6b, 0x5f,
0xe0, 0x08, 0xf7, 0x3a, 0x0a, 0xe5, 0xaf, 0xfc, 0xdd, 0x36, 0x4d, 0xf6, 0x08, 0x77, 0x49, 0x70,
0xcb, 0x04, 0x7f, 0x37, 0xf0, 0xff, 0x00, 0xba, 0x13, 0xac, 0x29, 0x47, 0x50, 0x00, 0x00
};

View File

@ -77,40 +77,59 @@ void presetFallback(uint8_t presetID, uint8_t effectID, uint8_t paletteID)
effectPalette = paletteID;
}
void relativeChange(byte* property, int8_t amount, byte lowerBoundary, byte higherBoundary)
byte relativeChange(byte property, int8_t amount, byte lowerBoundary, byte higherBoundary)
{
int16_t new_val = (int16_t) *property + amount;
int16_t new_val = (int16_t) property + amount;
if (lowerBoundary >= higherBoundary) return property;
if (new_val > higherBoundary) new_val = higherBoundary;
else if (new_val < lowerBoundary) new_val = lowerBoundary;
*property = (byte)constrain(new_val, 0, 255);
if (new_val < lowerBoundary) new_val = lowerBoundary;
return (byte)constrain(new_val, 0, 255);
}
void changeEffect(uint8_t fx)
{
//byte selectedSeg = strip.getMainSegmentId();
//WS2812FX::Segment& selseg = strip.getSegment(selectedSeg);
if (strip.applyToAllSelected) {
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);
}
} else {
strip.setMode(strip.getMainSegmentId(), fx);
}
effectCurrent = fx;
effectChanged = true;
}
void changePalette(uint8_t pal)
{
byte selectedSeg = strip.getMainSegmentId();
WS2812FX::Segment& selseg = strip.getSegment(selectedSeg);
selseg.palette = pal;
if (strip.applyToAllSelected) {
for (uint8_t i = 0; i < strip.getMaxSegments(); i++) {
WS2812FX::Segment& seg = strip.getSegment(i);
if (!seg.isActive() || !seg.isSelected()) continue;
seg.palette = pal;
}
} else {
strip.getSegment(strip.getMainSegmentId()).palette = pal;
}
effectPalette = pal;
effectChanged = true;
}
void changeEffectSpeed(int8_t amount)
{
byte selectedSeg = strip.getMainSegmentId();
WS2812FX::Segment& selseg = strip.getSegment(selectedSeg);
if (effectCurrent != 0) {
int16_t new_val = (int16_t) effectSpeed + amount;
effectSpeed = (byte)constrain(new_val,0,255);
selseg.speed = effectSpeed;
if (strip.applyToAllSelected) {
for (uint8_t i = 0; i < strip.getMaxSegments(); i++) {
WS2812FX::Segment& seg = strip.getSegment(i);
if (!seg.isActive() || !seg.isSelected()) continue;
seg.speed = effectSpeed;
}
} else {
strip.getSegment(strip.getMainSegmentId()).speed = effectSpeed;
}
effectChanged = true;
} else { // if Effect == "solid Color", change the hue of the primary color
CRGB fastled_col;
@ -126,6 +145,15 @@ void changeEffectSpeed(int8_t amount)
col[0] = fastled_col.red;
col[1] = fastled_col.green;
col[2] = fastled_col.blue;
if (strip.applyToAllSelected) {
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(col[0], col[1], col[2], col[3]);
}
} else {
strip.getSegment(strip.getMainSegmentId()).colors[0] = RGBW32(col[0], col[1], col[2], col[3]);
}
colorChanged = true;
}
@ -136,12 +164,18 @@ void changeEffectSpeed(int8_t amount)
void changeEffectIntensity(int8_t amount)
{
byte selectedSeg = strip.getMainSegmentId();
WS2812FX::Segment& selseg = strip.getSegment(selectedSeg);
if (effectCurrent != 0) {
int16_t new_val = (int16_t) effectIntensity + amount;
effectIntensity = (byte)constrain(new_val,0,255);
selseg.intensity = effectIntensity;
if (strip.applyToAllSelected) {
for (uint8_t i = 0; i < strip.getMaxSegments(); i++) {
WS2812FX::Segment& seg = strip.getSegment(i);
if (!seg.isActive() || !seg.isSelected()) continue;
seg.intensity = effectIntensity;
}
} else {
strip.getSegment(strip.getMainSegmentId()).speed = effectIntensity;
}
effectChanged = true;
} else { // if Effect == "solid Color", change the saturation of the primary color
CRGB fastled_col;
@ -155,6 +189,15 @@ void changeEffectIntensity(int8_t amount)
col[0] = fastled_col.red;
col[1] = fastled_col.green;
col[2] = fastled_col.blue;
if (strip.applyToAllSelected) {
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(col[0], col[1], col[2], col[3]);
}
} else {
strip.getSegment(strip.getMainSegmentId()).colors[0] = RGBW32(col[0], col[1], col[2], col[3]);
}
colorChanged = true;
}
@ -179,6 +222,9 @@ void decodeIR(uint32_t code)
return;
}
if (code > 0xFFFFFF) return; //invalid code
strip.applyToAllSelected = irApplyToAllSelected;
switch (irEnabled) {
case 1:
if (code > 0xF80000) {
@ -196,9 +242,10 @@ void decodeIR(uint32_t code)
// sets bright plain white
case 7: decodeIR9(code); break;
//case 8: return; // ir.json file, handled above switch statement
default: return;
}
strip.applyToAllSelected = false;
if (nightlightActive && bri == 0) nightlightActive = false;
colorUpdated(CALL_MODE_BUTTON); //for notifier, IR is considered a button input
}
@ -411,6 +458,7 @@ void decodeIR40(uint32_t code)
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;
}
@ -462,22 +510,10 @@ void decodeIR44(uint32_t code)
else colorFromUint24(COLOR_COLDWHITE2);
changeEffect(FX_MODE_STATIC);
break;
case IR44_REDPLUS :
relativeChange(&effectCurrent, 1, 0, MODE_COUNT);
changeEffect(effectCurrent);
break;
case IR44_REDMINUS :
relativeChange(&effectCurrent, -1, 0);
changeEffect(effectCurrent);
break;
case IR44_GREENPLUS :
relativeChange(&effectPalette, 1, 0, strip.getPaletteCount() -1);
changePalette(effectPalette);
break;
case IR44_GREENMINUS :
relativeChange(&effectPalette, -1, 0);
changePalette(effectPalette);
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;
@ -494,6 +530,7 @@ void decodeIR44(uint32_t code)
case IR44_JUMP7 : bri = 127; break;
case IR44_FADE3 : bri = 191; break;
case IR44_FADE7 : bri = 255; break;
default: return;
}
lastValidCode = code;
}
@ -533,13 +570,8 @@ void decodeIR6(uint32_t 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); // next effect
changeEffect(effectCurrent);
break;
case IR6_VOLUME_DOWN: // next palette
relativeChange(&effectPalette, 1, 0, strip.getPaletteCount() -1);
changePalette(effectPalette);
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;
@ -559,12 +591,8 @@ void decodeIR6(uint32_t code)
lastIR6ColourIdx++;
if(lastIR6ColourIdx > 12) lastIR6ColourIdx = 0;
break;
case IR6_MUTE:
changeEffect(FX_MODE_STATIC);
changePalette(0);
colorFromUint32(COLOR_WHITE);
bri=255;
break;
case IR6_MUTE: changeEffect(FX_MODE_STATIC); changePalette(0); colorFromUint32(COLOR_WHITE); bri=255; break;
default: return;
}
lastValidCode = code;
}
@ -578,11 +606,9 @@ void decodeIR9(uint32_t code)
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); changeEffect(effectCurrent); break;
case IR9_SELECT : changeEffect(relativeChange(effectCurrent, 1, 0, MODE_COUNT -1)); break;
default: return;
}
lastValidCode = code;
@ -655,7 +681,7 @@ void decodeIRJson(uint32_t code)
decBrightness();
} else if (cmdStr.startsWith(F("!presetF"))) { //!presetFallback
uint8_t p1 = fdo["PL"] | 1;
uint8_t p2 = fdo["FX"] | random8(MODE_COUNT);
uint8_t p2 = fdo["FX"] | random8(MODE_COUNT -1);
uint8_t p3 = fdo["FP"] | 0;
presetFallback(p1, p2, p3);
}

View File

@ -135,6 +135,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)) {

View File

@ -8,7 +8,7 @@
*/
// version code in format yymmddb (b = daily build)
#define VERSION 2202031
#define VERSION 2202061
//uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG
@ -309,6 +309,7 @@ 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
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

View File

@ -418,6 +418,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)