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
pull/2771/head
cschwinne 2022-09-06 03:06:00 +02:00
rodzic 508b1e76c2
commit 6802f5a802
6 zmienionych plików z 1895 dodań i 1898 usunięć

Wyświetl plik

@ -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,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,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,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,

Wyświetl plik

@ -101,10 +101,9 @@ button {
position: fixed;
bottom: calc(var(--bh) + 6px);
right: 6px;
color: var(--c-d);
color: var(--c-8);
cursor: pointer;
writing-mode: vertical-rl;
transform: rotate(180deg);
}
.bri {
@ -1045,7 +1044,7 @@ textarea {
/*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);
}

Wyświetl plik

@ -594,7 +594,9 @@ function parseInfo(i) {
lastinfo = i;
var name = i.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 (loc) name = "(L) " + name;
d.title = name;
@ -1995,15 +1997,15 @@ function setSeg(s)
var stopY = parseInt(gId(`seg${s}eY`).value);
obj.seg.startY = startY;
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 spc = parseInt(gId(`seg${s}spc`).value);
var ofs = parseInt(gId(`seg${s}of` ).value);
obj.seg.grp = grp;
obj.seg.spc = spc;
obj.seg.of = ofs;
if (isM) obj.seg.tp = gId(`seg${s}tp`).checked;
}
requestJson(obj);
}

Plik diff jest za duży Load Diff

Wyświetl plik

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

Wyświetl plik

@ -290,7 +290,7 @@ WLED_GLOBAL byte bootPreset _INIT(0); // save preset to load
WLED_GLOBAL bool autoSegments _INIT(false);
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 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 byte col[] _INIT_N(({ 255, 160, 0, 0 })); // current RGB(W) primary color. col[] should be updated if you want to change the color.