Skip to content

Commit 04e1a8e

Browse files
committed
upd
1 parent 1799914 commit 04e1a8e

File tree

8 files changed

+490
-477
lines changed

8 files changed

+490
-477
lines changed

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Settings
2-
version=1.0.10
2+
version=1.0.11
33
author=AlexGyver <[email protected]>
44
maintainer=AlexGyver <[email protected]>
55
sentence=Simple UI webface builder for esp8266/esp32

src/web/settings.h

Lines changed: 460 additions & 459 deletions
Large diffs are not rendered by default.

web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "settings",
3-
"version": "1.0.9",
3+
"version": "1.0.10",
44
"main": "index.js",
55
"scripts": {
66
"build": "webpack --config ./webpack.single.js & webpack --config ./webpack.index.js",

web/src/script/bson.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,14 @@ export default function decodeBson(b, codes = []) {
107107
for (let j = 0; j < 4; j++) {
108108
v |= b[++i] << (j * 8);
109109
}
110-
s += ieee32ToFloat(v).toFixed(data);
110+
let f = ieee32ToFloat(v);
111+
if (isNaN(f)) {
112+
s += '"NaN"';
113+
} else if (!isFinite(f)) {
114+
s += '"Infinity"';
115+
} else {
116+
s += f.toFixed(data);
117+
}
111118
s += ',';
112119
} break;
113120

web/src/script/settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ export default class Settings {
516516
this.restartPing();
517517
}
518518
makeUrl(cmd, params = {}) {
519-
// const base_url = 'http://192.168.1.95';
519+
// const base_url = 'http://192.168.1.54';
520520
const base_url = window.location.origin;
521521

522522
if (this.auth) params.auth = this.auth.toString(16);

web/src/script/ui/rssi.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
display: inline-block;
33
width: 21px;
44
/* transform: rotate(45deg); */
5-
transform: translateY(-5px);
5+
/* transform: translateY(-5px); */
6+
transform: translateX(-2px) translateY(-10px) rotate(45deg);
67
}

web/src/script/ui/rssi.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
11
import './rssi.css';
22

33
export function makeRSSI() {
4-
return `<svg viewBox="0 0 365.9 365.9" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
5-
<path name="3" d="M361 112a247 247 0 0 0-356 0 18 18 0 0 0 27 26 211 211 0 0 1 302 0 18 18 0 0 0 27-26z" style="fill:var(--font);fill-opacity:1"/>
6-
<path name="2" d="M183 107c-51 0-100 22-134 60a18 18 0 0 0 28 24 143 143 0 0 1 212 0 18 18 0 0 0 28-24c-34-38-83-60-134-60z" style="fill:var(--font);fill-opacity:1"/>
7-
<path name="1" d="M183 176c-36 0-69 17-90 46a18 18 0 0 0 30 22 74 74 0 0 1 120 0 18 18 0 0 0 30-22c-21-29-54-46-90-46z" style="fill:var(--font);fill-opacity:1"/>
8-
<circle name="0" cx="182.9" cy="286.7" r="41.5" style="fill:var(--font);fill-opacity:1"/>
9-
<path name="x" d="M273 127a19 19 0 0 0-27-27l-63 63-63-63a19 19 0 0 0-28 27l64 64-64 63a19 19 0 0 0 28 27l63-63 63 63a19 19 0 0 0 27-27l-63-63z" style="fill:var(--error);fill-opacity:0"/>
4+
return `<svg xml:space="preserve" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 366.5 256">
5+
<path name="3" d="M361 91A247 247 0 0 0 5 91a19 19 0 0 0 27 26 211 211 0 0 1 302 0 19 19 0 0 0 27-26z" style="fill:var(--font)"/>
6+
<path name="2" d="M183 86c-51 0-100 22-134 60a18 18 0 0 0 28 24 143 143 0 0 1 212 0 18 18 0 0 0 28-24c-34-38-83-60-134-60z" style="fill:var(--font)"/>
7+
<path name="1" d="M183 155c-36 0-69 17-90 46a19 19 0 0 0 30 22 74 74 0 0 1 120 0 19 19 0 0 0 30-22c-21-29-54-46-90-46z" style="fill:var(--font)"/>
8+
<path name="x" d="M292 147a19 19 0 0 0 0-38h-89V20a19 19 0 0 0-39-1v91l-90-1a19 19 0 0 0 1 39h89v89a19 19 0 0 0 38 0v-89z" style="fill:var(--error);fill-opacity:0"/>
109
</svg>`;
1110
}
1211

1312
export function changeRSSI(cont, rssi) {
13+
let apply = (path, state) => {
14+
path.style.fillOpacity = state ? 0.8 : 0.2;
15+
}
16+
let error = (path, rssi) => {
17+
path.style.fillOpacity = rssi ? 0 : 1.0;
18+
}
19+
1420
cont.title = rssi + '%';
1521
let svg = cont.firstElementChild;
16-
const min = 0.2, max = 0.7;
1722
for (let p of svg.children) {
1823
switch (p.getAttribute('name')) {
19-
case '3': p.style.fillOpacity = rssi > 75 ? max : min; break;
20-
case '2': p.style.fillOpacity = rssi > 50 ? max : min; break;
21-
case '1': p.style.fillOpacity = rssi > 25 ? max : min; break;
22-
case '0': p.style.fillOpacity = rssi > 0 ? max : min; break;
23-
case 'x': p.style.fillOpacity = rssi == 0 ? 1 : 0; break;
24+
case '3': apply(p, rssi > 66); break;
25+
case '2': apply(p, rssi > 33); break;
26+
case '1': apply(p, rssi > 0); break;
27+
case 'x': error(p, rssi); break;
2428
}
2529
}
2630
}

web/src/script/widgets/slider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default class SliderWidget extends WidgetBase {
4242
}
4343

4444
update(value) {
45-
this.$slider.value = (value ?? 0) + '';
45+
this.$slider.value = Number(value ?? 0) + '';
4646
this.move();
4747
}
4848
}

0 commit comments

Comments
 (0)