Minor tweaks.

This commit is contained in:
Blaz Kristan 2024-06-30 10:44:25 +02:00
parent b8b11880b0
commit 693bf4816b
7 changed files with 25 additions and 23 deletions

View File

@ -4875,7 +4875,7 @@ uint16_t mode_2DBlackHole(void) { // By: Stepko https://editor.soulma
// central white dot // central white dot
SEGMENT.setPixelColorXY(cols/2, rows/2, WHITE); SEGMENT.setPixelColorXY(cols/2, rows/2, WHITE);
// blur everything a bit // blur everything a bit
SEGMENT.blur(16); SEGMENT.blur(cols*rows > 100 ? 16 : 0);
return FRAMETIME; return FRAMETIME;
} // mode_2DBlackHole() } // mode_2DBlackHole()
@ -5671,8 +5671,7 @@ uint16_t mode_2Dsquaredswirl(void) { // By: Mark Kriegsman. https://g
const uint8_t kBorderWidth = 2; const uint8_t kBorderWidth = 2;
SEGMENT.fadeToBlackBy(24); SEGMENT.fadeToBlackBy(24);
uint8_t blurAmount = SEGMENT.custom3>>1; // reduced resolution slider SEGMENT.blur(SEGMENT.custom3>>1);
SEGMENT.blur(blurAmount);
// Use two out-of-sync sine waves // Use two out-of-sync sine waves
int i = beatsin8(19, kBorderWidth, cols-kBorderWidth); int i = beatsin8(19, kBorderWidth, cols-kBorderWidth);
@ -6461,7 +6460,7 @@ uint16_t mode_2DWaverly(void) {
SEGMENT.addPixelColorXY((cols - 1) - i, (rows - 1) - j, ColorFromPalette(SEGPALETTE, map(j, 0, thisMax, 250, 0), 255, LINEARBLEND)); SEGMENT.addPixelColorXY((cols - 1) - i, (rows - 1) - j, ColorFromPalette(SEGPALETTE, map(j, 0, thisMax, 250, 0), 255, LINEARBLEND));
} }
} }
SEGMENT.blur(16); SEGMENT.blur(cols*rows > 100 ? 16 : 0);
return FRAMETIME; return FRAMETIME;
} // mode_2DWaverly() } // mode_2DWaverly()

View File

@ -385,14 +385,14 @@ BusPwm::BusPwm(BusConfig &bc)
uint8_t numPins = NUM_PWM_PINS(bc.type); uint8_t numPins = NUM_PWM_PINS(bc.type);
_frequency = bc.frequency ? bc.frequency : WLED_PWM_FREQ; _frequency = bc.frequency ? bc.frequency : WLED_PWM_FREQ;
#ifdef ESP8266 #ifdef ESP8266
// duty cycle resolution (_depth) can be extracted from this formula: 1MHz > _frequency * 2^_depth // duty cycle resolution (_depth) can be extracted from this formula: 1MHz > _frequency * 2^_depth
if (_frequency > 1760) _depth = 8; if (_frequency > 1760) _depth = 8;
else if (_frequency > 880) _depth = 9; else if (_frequency > 880) _depth = 9;
else _depth = 10; // WLED_PWM_FREQ <= 880Hz else _depth = 10; // WLED_PWM_FREQ <= 880Hz
analogWriteRange((1<<_depth)-1); analogWriteRange((1<<_depth)-1);
analogWriteFreq(_frequency); analogWriteFreq(_frequency);
#else #else
_ledcStart = pinManager.allocateLedc(numPins); _ledcStart = pinManager.allocateLedc(numPins);
if (_ledcStart == 255) { //no more free LEDC channels if (_ledcStart == 255) { //no more free LEDC channels
deallocatePins(); return; deallocatePins(); return;
@ -402,7 +402,7 @@ BusPwm::BusPwm(BusConfig &bc)
else if (_frequency > 39062) _depth = 10; else if (_frequency > 39062) _depth = 10;
else if (_frequency > 19531) _depth = 11; else if (_frequency > 19531) _depth = 11;
else _depth = 12; // WLED_PWM_FREQ <= 19531Hz else _depth = 12; // WLED_PWM_FREQ <= 19531Hz
#endif #endif
for (unsigned i = 0; i < numPins; i++) { for (unsigned i = 0; i < numPins; i++) {
uint8_t currentPin = bc.pins[i]; uint8_t currentPin = bc.pins[i];

View File

@ -169,10 +169,11 @@ class Bus {
type == TYPE_FW1906 || type == TYPE_WS2805 ) return true; type == TYPE_FW1906 || type == TYPE_WS2805 ) return true;
return false; return false;
} }
static int16_t getCCT() { return _cct; } static inline int16_t getCCT() { return _cct; }
static void setCCT(int16_t cct) { static void setCCT(int16_t cct) {
_cct = cct; _cct = cct;
} }
static inline uint8_t getCCTBlend() { return _cctBlend; }
static void setCCTBlend(uint8_t b) { static void setCCTBlend(uint8_t b) {
if (b > 100) b = 100; if (b > 100) b = 100;
_cctBlend = (b * 127) / 100; _cctBlend = (b * 127) / 100;

View File

@ -208,13 +208,13 @@ CRGBPalette16 generateRandomPalette(void) //generate fully random palette
void colorHStoRGB(uint16_t hue, byte sat, byte* rgb) //hue, sat to rgb void colorHStoRGB(uint16_t hue, byte sat, byte* rgb) //hue, sat to rgb
{ {
float h = ((float)hue)/65535.0f; float h = ((float)hue)/10922.5f; // hue*6/65535
float s = ((float)sat)/255.0f; float s = ((float)sat)/255.0f;
int i = floorf(h*6); int i = int(h);
float f = h * 6.0f - i; float f = h - i;
int p = int(255.0f * (1.0f-s)); int p = int(255.0f * (1.0f-s));
int q = int(255.0f * (1.0f-f*s)); int q = int(255.0f * (1.0f-s*f));
int t = int(255.0f * (1.0f-(1.0f-f)*s)); int t = int(255.0f * (1.0f-s*(1.0f-f)));
p = constrain(p, 0, 255); p = constrain(p, 0, 255);
q = constrain(q, 0, 255); q = constrain(q, 0, 255);
t = constrain(t, 0, 255); t = constrain(t, 0, 255);

View File

@ -923,6 +923,7 @@ select.sel-p, select.sel-pl, select.sel-ple {
margin: 5px 0; margin: 5px 0;
width: 100%; width: 100%;
height: 40px; height: 40px;
padding: 0 20px 0 8px;
} }
div.sel-p { div.sel-p {
position: relative; position: relative;

View File

@ -588,7 +588,7 @@ function loadFXData(callback = null)
fxdata = []; fxdata = [];
if (!retry) { if (!retry) {
retry = true; retry = true;
setTimeout(loadFXData, 500); // retry setTimeout(()=>{loadFXData(loadFX);}, 500); // retry
} }
showToast(e, true); showToast(e, true);
}) })
@ -1707,9 +1707,7 @@ function requestJson(command=null)
fetch(getURL('/json/si'), { fetch(getURL('/json/si'), {
method: type, method: type,
headers: { headers: {"Content-Type": "application/json; charset=UTF-8"},
"Content-type": "application/json; charset=UTF-8"
},
body: req body: req
}) })
.then(res => { .then(res => {
@ -2692,7 +2690,9 @@ function setBalance(b)
function rmtTgl(ip,i) { function rmtTgl(ip,i) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
fetch(`http://${ip}/win&T=2`, {method: 'get'}) fetch(`http://${ip}/win&T=2`, {
method: 'get'
})
.then((r)=>{ .then((r)=>{
return r.text(); return r.text();
}) })
@ -2784,10 +2784,7 @@ function loadPalettesData(callback = null)
function getPalettesData(page, callback) function getPalettesData(page, callback)
{ {
fetch(getURL(`/json/palx?page=${page}`), { fetch(getURL(`/json/palx?page=${page}`), {
method: 'get', method: 'get'
headers: {
"Content-type": "application/json; charset=UTF-8"
}
}) })
.then(res => { .then(res => {
if (!res.ok) showErrorToast(); if (!res.ok) showErrorToast();
@ -2800,6 +2797,10 @@ function getPalettesData(page, callback)
else callback(); else callback();
}) })
.catch((error)=>{ .catch((error)=>{
if (!retry) {
retry = true;
setTimeout(()=>{getPalettesData(page,callback);}, 500); // retry
}
showToast(error, true); showToast(error, true);
}); });
} }

View File

@ -290,7 +290,7 @@
// do we have a led count field // do we have a led count field
if (nm=="LC") { if (nm=="LC") {
let c = parseInt(LC.value,10); //get LED count let c = parseInt(LC.value,10); //get LED count
if (c > 300 && i < 8) maxB = min(oMaxB,10); //TODO: hard limit for buses when using ESP32 parallel I2S if (c > 300 && i < 8) maxB = oMaxB - max(maxD-7,0); //TODO: hard limit for buses when using ESP32 parallel I2S
if (!customStarts || !startsDirty[n]) gId("ls"+n).value=sLC; //update start value if (!customStarts || !startsDirty[n]) gId("ls"+n).value=sLC; //update start value
gId("ls"+n).disabled = !customStarts; //enable/disable field editing gId("ls"+n).disabled = !customStarts; //enable/disable field editing
if (c) { if (c) {