Skip to content

Commit 0ba80ce

Browse files
committed
Merge branch 'main' into usermod-libs
2 parents 18a118b + 7c23872 commit 0ba80ce

32 files changed

+850
-2124
lines changed

.github/workflows/pr-merge.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Send Discord notification
11+
shell: bash
12+
env:
13+
DISCORD_WEBHOOK_BETA_TESTERS: ${{ secrets.DISCORD_WEBHOOK_BETA_TESTERS }}
1114
if: github.event.pull_request.merged == true
1215
run: |
13-
curl -H "Content-Type: application/json" -d '{"content": "Pull Request #{{ github.event.pull_request.number }} merged by {{ github.actor }}"}' ${{ secrets.DISCORD_WEBHOOK_BETA_TESTERS }}
16+
curl -H "Content-Type: application/json" -d '{"content": "Pull Request #{{ github.event.pull_request.number }} merged by {{ github.actor }}"}' $DISCORD_WEBHOOK_BETA_TESTERS

package-lock.json

Lines changed: 229 additions & 1654 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
"dependencies": {
2626
"clean-css": "^5.3.3",
2727
"html-minifier-terser": "^7.2.0",
28-
"inliner": "^1.13.1",
29-
"nodemon": "^3.1.7"
28+
"web-resource-inliner": "^7.0.0",
29+
"nodemon": "^3.1.9"
3030
},
3131
"engines": {
3232
"node": ">=20.0.0"
3333
}
34-
}
34+
}

tools/cdata.js

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
const fs = require("node:fs");
1919
const path = require("path");
20-
const inliner = require("inliner");
20+
const inline = require("web-resource-inliner");
2121
const zlib = require("node:zlib");
2222
const CleanCSS = require("clean-css");
2323
const minifyHtml = require("html-minifier-terser").minify;
@@ -128,21 +128,26 @@ async function minify(str, type = "plain") {
128128

129129
async function writeHtmlGzipped(sourceFile, resultFile, page) {
130130
console.info("Reading " + sourceFile);
131-
new inliner(sourceFile, async function (error, html) {
132-
if (error) throw error;
131+
inline.html({
132+
fileContent: fs.readFileSync(sourceFile, "utf8"),
133+
relativeTo: path.dirname(sourceFile),
134+
strict: true,
135+
},
136+
async function (error, html) {
137+
if (error) throw error;
133138

134-
html = adoptVersionAndRepo(html);
135-
const originalLength = html.length;
136-
html = await minify(html, "html-minify");
137-
const result = zlib.gzipSync(html, { level: zlib.constants.Z_BEST_COMPRESSION });
138-
console.info("Minified and compressed " + sourceFile + " from " + originalLength + " to " + result.length + " bytes");
139-
const array = hexdump(result);
140-
let src = singleHeader;
141-
src += `const uint16_t PAGE_${page}_L = ${result.length};\n`;
142-
src += `const uint8_t PAGE_${page}[] PROGMEM = {\n${array}\n};\n\n`;
143-
console.info("Writing " + resultFile);
144-
fs.writeFileSync(resultFile, src);
145-
});
139+
html = adoptVersionAndRepo(html);
140+
const originalLength = html.length;
141+
html = await minify(html, "html-minify");
142+
const result = zlib.gzipSync(html, { level: zlib.constants.Z_BEST_COMPRESSION });
143+
console.info("Minified and compressed " + sourceFile + " from " + originalLength + " to " + result.length + " bytes");
144+
const array = hexdump(result);
145+
let src = singleHeader;
146+
src += `const uint16_t PAGE_${page}_L = ${result.length};\n`;
147+
src += `const uint8_t PAGE_${page}[] PROGMEM = {\n${array}\n};\n\n`;
148+
console.info("Writing " + resultFile);
149+
fs.writeFileSync(resultFile, src);
150+
});
146151
}
147152

148153
async function specToChunk(srcDir, s) {

usermods/usermod_rotary_brightness_color/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Open Usermod Settings in WLED to change settings:
3737
No special requirements.
3838

3939
## Change Log
40-
41-
2021-07
42-
* Upgraded to work with the latest WLED code, and make settings configurable in Usermod Settings
40+
- 2021-07<br>
41+
Upgraded to work with the latest WLED code, and make settings configurable in Usermod Settings
42+
- 2025-03<br>
43+
Upgraded to work with the latest WLED code

usermods/usermod_rotary_brightness_color/usermod_rotary_brightness_color.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ class RotaryEncoderBrightnessColor : public Usermod
9393
}
9494
else
9595
{
96-
fastled_col.red = col[0];
97-
fastled_col.green = col[1];
98-
fastled_col.blue = col[2];
96+
fastled_col.red = colPri[0];
97+
fastled_col.green = colPri[1];
98+
fastled_col.blue = colPri[2];
9999
prim_hsv = rgb2hsv_approximate(fastled_col);
100100
new_val = (int16_t)prim_hsv.h + fadeAmount;
101101
if (new_val > 255)
@@ -104,9 +104,9 @@ class RotaryEncoderBrightnessColor : public Usermod
104104
new_val += 255; // roll-over if smaller than 0
105105
prim_hsv.h = (byte)new_val;
106106
hsv2rgb_rainbow(prim_hsv, fastled_col);
107-
col[0] = fastled_col.red;
108-
col[1] = fastled_col.green;
109-
col[2] = fastled_col.blue;
107+
colPri[0] = fastled_col.red;
108+
colPri[1] = fastled_col.green;
109+
colPri[2] = fastled_col.blue;
110110
}
111111
}
112112
else if (Enc_B == LOW)
@@ -118,9 +118,9 @@ class RotaryEncoderBrightnessColor : public Usermod
118118
}
119119
else
120120
{
121-
fastled_col.red = col[0];
122-
fastled_col.green = col[1];
123-
fastled_col.blue = col[2];
121+
fastled_col.red = colPri[0];
122+
fastled_col.green = colPri[1];
123+
fastled_col.blue = colPri[2];
124124
prim_hsv = rgb2hsv_approximate(fastled_col);
125125
new_val = (int16_t)prim_hsv.h - fadeAmount;
126126
if (new_val > 255)
@@ -129,9 +129,9 @@ class RotaryEncoderBrightnessColor : public Usermod
129129
new_val += 255; // roll-over if smaller than 0
130130
prim_hsv.h = (byte)new_val;
131131
hsv2rgb_rainbow(prim_hsv, fastled_col);
132-
col[0] = fastled_col.red;
133-
col[1] = fastled_col.green;
134-
col[2] = fastled_col.blue;
132+
colPri[0] = fastled_col.red;
133+
colPri[1] = fastled_col.green;
134+
colPri[2] = fastled_col.blue;
135135
}
136136
}
137137
//call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification)

usermods/usermod_v2_rotary_encoder_ui_ALT/usermod_v2_rotary_encoder_ui_ALT.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ void RotaryEncoderUIUsermod::setup()
516516

517517
loopTime = millis();
518518

519-
currentCCT = (approximateKelvinFromRGB(RGBW32(col[0], col[1], col[2], col[3])) - 1900) >> 5;
519+
currentCCT = (approximateKelvinFromRGB(RGBW32(colPri[0], colPri[1], colPri[2], colPri[3])) - 1900) >> 5;
520520

521521
if (!initDone) sortModesAndPalettes();
522522

@@ -918,17 +918,17 @@ void RotaryEncoderUIUsermod::changeHue(bool increase){
918918
display->updateRedrawTime();
919919
#endif
920920
currentHue1 = max(min((increase ? currentHue1+fadeAmount : currentHue1-fadeAmount), 255), 0);
921-
colorHStoRGB(currentHue1*256, currentSat1, col);
921+
colorHStoRGB(currentHue1*256, currentSat1, colPri);
922922
stateChanged = true;
923923
if (applyToAll) {
924924
for (unsigned i=0; i<strip.getSegmentsNum(); i++) {
925925
Segment& seg = strip.getSegment(i);
926926
if (!seg.isActive()) continue;
927-
seg.colors[0] = RGBW32(col[0], col[1], col[2], col[3]);
927+
seg.colors[0] = RGBW32(colPri[0], colPri[1], colPri[2], colPri[3]);
928928
}
929929
} else {
930930
Segment& seg = strip.getSegment(strip.getMainSegmentId());
931-
seg.colors[0] = RGBW32(col[0], col[1], col[2], col[3]);
931+
seg.colors[0] = RGBW32(colPri[0], colPri[1], colPri[2], colPri[3]);
932932
}
933933
lampUdated();
934934
#ifdef USERMOD_FOUR_LINE_DISPLAY
@@ -948,16 +948,16 @@ void RotaryEncoderUIUsermod::changeSat(bool increase){
948948
display->updateRedrawTime();
949949
#endif
950950
currentSat1 = max(min((increase ? currentSat1+fadeAmount : currentSat1-fadeAmount), 255), 0);
951-
colorHStoRGB(currentHue1*256, currentSat1, col);
951+
colorHStoRGB(currentHue1*256, currentSat1, colPri);
952952
if (applyToAll) {
953953
for (unsigned i=0; i<strip.getSegmentsNum(); i++) {
954954
Segment& seg = strip.getSegment(i);
955955
if (!seg.isActive()) continue;
956-
seg.colors[0] = RGBW32(col[0], col[1], col[2], col[3]);
956+
seg.colors[0] = RGBW32(colPri[0], colPri[1], colPri[2], colPri[3]);
957957
}
958958
} else {
959959
Segment& seg = strip.getSegment(strip.getMainSegmentId());
960-
seg.colors[0] = RGBW32(col[0], col[1], col[2], col[3]);
960+
seg.colors[0] = RGBW32(colPri[0], colPri[1], colPri[2], colPri[3]);
961961
}
962962
lampUdated();
963963
#ifdef USERMOD_FOUR_LINE_DISPLAY

wled00/FX.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,10 @@ typedef struct Segment {
676676
[[gnu::hot]] uint32_t getPixelColor(int i) const;
677677
// 1D support functions (some implement 2D as well)
678678
void blur(uint8_t, bool smear = false);
679+
void clear();
679680
void fill(uint32_t c);
680681
void fade_out(uint8_t r);
682+
void fadeToSecondaryBy(uint8_t fadeBy);
681683
void fadeToBlackBy(uint8_t fadeBy);
682684
inline void blendPixelColor(int n, uint32_t color, uint8_t blend) { setPixelColor(n, color_blend(getPixelColor(n), color, blend)); }
683685
inline void blendPixelColor(int n, CRGB c, uint8_t blend) { blendPixelColor(n, RGBW32(c.r,c.g,c.b,0), blend); }

wled00/FX_2Dfcn.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -684,9 +684,7 @@ void Segment::drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w,
684684
case 60: bits = pgm_read_byte_near(&console_font_5x12[(chr * h) + i]); break; // 5x12 font
685685
default: return;
686686
}
687-
uint32_t c = ColorFromPaletteWLED(grad, (i+1)*255/h, 255, NOBLEND);
688-
// pre-scale color for all pixels
689-
c = color_fade(c, _segBri);
687+
CRGBW c = ColorFromPalette(grad, (i+1)*255/h, _segBri, LINEARBLEND_NOWRAP);
690688
_colorScaled = true;
691689
for (int j = 0; j<w; j++) { // character width
692690
int x0, y0;
@@ -699,7 +697,7 @@ void Segment::drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w,
699697
}
700698
if (x0 < 0 || x0 >= (int)vWidth() || y0 < 0 || y0 >= (int)vHeight()) continue; // drawing off-screen
701699
if (((bits>>(j+(8-w))) & 0x01)) { // bit set
702-
setPixelColorXY(x0, y0, c);
700+
setPixelColorXY(x0, y0, c.color32);
703701
}
704702
}
705703
_colorScaled = false;

0 commit comments

Comments
 (0)