Fix several small bugs

Fixed no new 2D segments creatable in UI
Fixed brightness not applied if `"on":true` present in the same JSON api call
Fixed CJK text upside down in namelabel (rotate to nicer direction only if no CJK characters)
Gamma correction color enabled by default
This commit is contained in:
cschwinne 2022-09-06 03:06:00 +02:00
parent 508b1e76c2
commit 6802f5a802
6 changed files with 1895 additions and 1898 deletions

View File

@ -7209,7 +7209,7 @@ static uint8_t akemi[] PROGMEM = {
0,0,0,0,0,0,0,3,2,0,6,5,5,5,5,5,5,5,5,5,5,4,0,2,3,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,3,2,0,6,5,5,5,5,5,5,5,5,5,5,4,0,2,3,0,0,0,0,0,0,0,
0,0,0,0,0,0,3,2,3,6,5,5,7,7,5,5,5,5,7,7,5,5,4,3,2,3,0,0,0,0,0,0, 0,0,0,0,0,0,3,2,3,6,5,5,7,7,5,5,5,5,7,7,5,5,4,3,2,3,0,0,0,0,0,0,
0,0,0,0,0,2,3,1,3,6,5,1,7,7,7,5,5,1,7,7,7,5,4,3,1,3,2,0,0,0,0,0, 0,0,0,0,0,2,3,1,3,6,5,1,7,7,7,5,5,1,7,7,7,5,4,3,1,3,2,0,0,0,0,0,
0,0,0,0,0,8,3,1,3,6,5,1,7,7,7,5,5,1,7,7,7,5,4,3,1,3,8,9,0,0,0,0, 0,0,0,0,0,8,3,1,3,6,5,1,7,7,7,5,5,1,7,7,7,5,4,3,1,3,8,0,0,0,0,0,
0,0,0,0,0,8,3,1,3,6,5,5,1,1,5,5,5,5,1,1,5,5,4,3,1,3,8,0,0,0,0,0, 0,0,0,0,0,8,3,1,3,6,5,5,1,1,5,5,5,5,1,1,5,5,4,3,1,3,8,0,0,0,0,0,
0,0,0,0,0,2,3,1,3,6,5,5,5,5,5,5,5,5,5,5,5,5,4,3,1,3,2,0,0,0,0,0, 0,0,0,0,0,2,3,1,3,6,5,5,5,5,5,5,5,5,5,5,5,5,4,3,1,3,2,0,0,0,0,0,
0,0,0,0,0,0,3,2,3,6,5,5,5,5,5,5,5,5,5,5,5,5,4,3,2,3,0,0,0,0,0,0, 0,0,0,0,0,0,3,2,3,6,5,5,5,5,5,5,5,5,5,5,5,5,4,3,2,3,0,0,0,0,0,0,

View File

@ -101,10 +101,9 @@ button {
position: fixed; position: fixed;
bottom: calc(var(--bh) + 6px); bottom: calc(var(--bh) + 6px);
right: 6px; right: 6px;
color: var(--c-d); color: var(--c-8);
cursor: pointer; cursor: pointer;
writing-mode: vertical-rl; writing-mode: vertical-rl;
transform: rotate(180deg);
} }
.bri { .bri {
@ -1045,7 +1044,7 @@ textarea {
/*box-shadow: 0 0 0 5px var(--c-d);*/ /*box-shadow: 0 0 0 5px var(--c-d);*/
} }
.qcs, #namelabel { .qcs {
text-shadow: -1px -1px 0 var(--c-4), 1px -1px 0 var(--c-4), -1px 1px 0 var(--c-4), 1px 1px 0 var(--c-4); text-shadow: -1px -1px 0 var(--c-4), 1px -1px 0 var(--c-4), -1px 1px 0 var(--c-4), 1px 1px 0 var(--c-4);
} }

View File

@ -594,7 +594,9 @@ function parseInfo(i) {
lastinfo = i; lastinfo = i;
var name = i.name; var name = i.name;
gId('namelabel').innerHTML = name; gId('namelabel').innerHTML = name;
//if (name === "Dinnerbone") d.documentElement.style.transform = "rotate(180deg)"; if (!name.match(/[\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\uff66-\uff9f\u3131-\uD79D]/))
gId('namelabel').style.transform = "rotate(180deg)"; // rotate if no CJK characters
if (name === "Dinnerbone") d.documentElement.style.transform = "rotate(180deg)"; // Minecraft easter egg
if (i.live) name = "(Live) " + name; if (i.live) name = "(Live) " + name;
if (loc) name = "(L) " + name; if (loc) name = "(L) " + name;
d.title = name; d.title = name;
@ -1995,15 +1997,15 @@ function setSeg(s)
var stopY = parseInt(gId(`seg${s}eY`).value); var stopY = parseInt(gId(`seg${s}eY`).value);
obj.seg.startY = startY; obj.seg.startY = startY;
obj.seg.stopY = (cfg.comp.seglen?startY:0)+stopY; obj.seg.stopY = (cfg.comp.seglen?startY:0)+stopY;
obj.seg.tp = gId(`seg${s}tp`).checked;
} }
if (gId(`seg${s}grp`)) { if (gId(`seg${s}grp`)) { // advanced options, not present in new segment dialog (makeSeg())
var grp = parseInt(gId(`seg${s}grp`).value); var grp = parseInt(gId(`seg${s}grp`).value);
var spc = parseInt(gId(`seg${s}spc`).value); var spc = parseInt(gId(`seg${s}spc`).value);
var ofs = parseInt(gId(`seg${s}of` ).value); var ofs = parseInt(gId(`seg${s}of` ).value);
obj.seg.grp = grp; obj.seg.grp = grp;
obj.seg.spc = spc; obj.seg.spc = spc;
obj.seg.of = ofs; obj.seg.of = ofs;
if (isM) obj.seg.tp = gId(`seg${s}tp`).checked;
} }
requestJson(obj); requestJson(obj);
} }

File diff suppressed because it is too large Load Diff

View File

@ -287,22 +287,13 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
bool stateResponse = root[F("v")] | false; bool stateResponse = root[F("v")] | false;
bool onBefore = bri; bool onBefore = bri;
uint8_t tmpBri = bri; getVal(root["bri"], &bri);
getVal(root["bri"], &tmpBri);
if (root["on"].isNull()) { bool on = root["on"] | (bri > 0);
if ((onBefore && tmpBri==0) || (!onBefore && tmpBri>0)) toggleOnOff(); if (!on != !bri) toggleOnOff();
bri = tmpBri;
} else { if (root["on"].is<const char*>() && root["on"].as<const char*>()[0] == 't') {
bool on = root["on"] | onBefore; if (onBefore || !bri) toggleOnOff(); // do not toggle off again if just turned on by bri (makes e.g. "{"on":"t","bri":32}" work)
if (on != onBefore || (root["on"].is<const char*>() && root["on"].as<const char*>()[0] == 't')) {
toggleOnOff();
// a hack is needed after toggleOnOf()
if (!root["bri"].isNull()) {
if (bri==0) briLast = tmpBri;
else bri = tmpBri;
}
}
} }
if (bri && !onBefore) { // unfreeze all segments when turning on if (bri && !onBefore) { // unfreeze all segments when turning on

View File

@ -290,7 +290,7 @@ WLED_GLOBAL byte bootPreset _INIT(0); // save preset to load
WLED_GLOBAL bool autoSegments _INIT(false); WLED_GLOBAL bool autoSegments _INIT(false);
WLED_GLOBAL bool correctWB _INIT(false); // CCT color correction of RGB color WLED_GLOBAL bool correctWB _INIT(false); // CCT color correction of RGB color
WLED_GLOBAL bool cctFromRgb _INIT(false); // CCT is calculated from RGB instead of using seg.cct WLED_GLOBAL bool cctFromRgb _INIT(false); // CCT is calculated from RGB instead of using seg.cct
WLED_GLOBAL bool gammaCorrectCol _INIT(false); // use gamma correction on colors WLED_GLOBAL bool gammaCorrectCol _INIT(true ); // use gamma correction on colors
WLED_GLOBAL bool gammaCorrectBri _INIT(false); // use gamma correction on brightness WLED_GLOBAL bool gammaCorrectBri _INIT(false); // use gamma correction on brightness
WLED_GLOBAL byte col[] _INIT_N(({ 255, 160, 0, 0 })); // current RGB(W) primary color. col[] should be updated if you want to change the color. WLED_GLOBAL byte col[] _INIT_N(({ 255, 160, 0, 0 })); // current RGB(W) primary color. col[] should be updated if you want to change the color.