Browse Source

WebUI: fix some issues

- fix colorpicker variable name
- var msg and var pre for debug messages
- add gpio16 to gpio list, remove unused template code
- fix lightfox endif matching rfbridge instead of lightfox
- formatting
master
Max Prokhorov 5 years ago
committed by GitHub
parent
commit
2ef21d840d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 19945 additions and 19954 deletions
  1. BIN
      code/espurna/data/index.all.html.gz
  2. BIN
      code/espurna/data/index.light.html.gz
  3. BIN
      code/espurna/data/index.lightfox.html.gz
  4. BIN
      code/espurna/data/index.rfbridge.html.gz
  5. BIN
      code/espurna/data/index.rfm69.html.gz
  6. BIN
      code/espurna/data/index.sensor.html.gz
  7. BIN
      code/espurna/data/index.small.html.gz
  8. BIN
      code/espurna/data/index.thermostat.html.gz
  9. +3015
    -3017
      code/espurna/static/index.all.html.gz.h
  10. +2846
    -2846
      code/espurna/static/index.light.html.gz.h
  11. +1950
    -1950
      code/espurna/static/index.lightfox.html.gz.h
  12. +2429
    -2429
      code/espurna/static/index.rfbridge.html.gz.h
  13. +3908
    -3907
      code/espurna/static/index.rfm69.html.gz.h
  14. +1824
    -1824
      code/espurna/static/index.sensor.html.gz.h
  15. +1950
    -1950
      code/espurna/static/index.small.html.gz.h
  16. +1987
    -1987
      code/espurna/static/index.thermostat.html.gz.h
  17. +36
    -44
      code/html/custom.js

BIN
code/espurna/data/index.all.html.gz View File


BIN
code/espurna/data/index.light.html.gz View File


BIN
code/espurna/data/index.lightfox.html.gz View File


BIN
code/espurna/data/index.rfbridge.html.gz View File


BIN
code/espurna/data/index.rfm69.html.gz View File


BIN
code/espurna/data/index.sensor.html.gz View File


BIN
code/espurna/data/index.small.html.gz View File


BIN
code/espurna/data/index.thermostat.html.gz View File


+ 3015
- 3017
code/espurna/static/index.all.html.gz.h
File diff suppressed because it is too large
View File


+ 2846
- 2846
code/espurna/static/index.light.html.gz.h
File diff suppressed because it is too large
View File


+ 1950
- 1950
code/espurna/static/index.lightfox.html.gz.h
File diff suppressed because it is too large
View File


+ 2429
- 2429
code/espurna/static/index.rfbridge.html.gz.h
File diff suppressed because it is too large
View File


+ 3908
- 3907
code/espurna/static/index.rfm69.html.gz.h
File diff suppressed because it is too large
View File


+ 1824
- 1824
code/espurna/static/index.sensor.html.gz.h
File diff suppressed because it is too large
View File


+ 1950
- 1950
code/espurna/static/index.small.html.gz.h
File diff suppressed because it is too large
View File


+ 1987
- 1987
code/espurna/static/index.thermostat.html.gz.h
File diff suppressed because it is too large
View File


+ 36
- 44
code/html/custom.js View File

@ -121,11 +121,7 @@ function keepTime() {
} }
function zeroPad(number, positions) { function zeroPad(number, positions) {
var zeros = "";
for (var i = 0; i < positions; i++) {
zeros += "0";
}
return (zeros + number).slice(-positions);
return number.toString().padStart(positions, "0");
} }
function loadTimeZones() { function loadTimeZones() {
@ -142,15 +138,16 @@ function loadTimeZones() {
]; ];
for (var i in time_zones) { for (var i in time_zones) {
var value = time_zones[i];
var offset = value >= 0 ? value : -value;
var text = "GMT" + (value >= 0 ? "+" : "-") +
var tz = time_zones[i];
var offset = tz >= 0 ? tz : -tz;
var text = "GMT" + (tz >= 0 ? "+" : "-") +
zeroPad(parseInt(offset / 60, 10), 2) + ":" + zeroPad(parseInt(offset / 60, 10), 2) + ":" +
zeroPad(offset % 60, 2); zeroPad(offset % 60, 2);
$("select[name='ntpOffset']").append( $("select[name='ntpOffset']").append(
$("<option></option>").
attr("value",value).
text(text));
$("<option></option>")
.attr("value", tz)
.text(text)
);
} }
} }
@ -404,31 +401,23 @@ function doResetThermostatCounters(ask) {
} }
<!-- endRemoveIf(!thermostat)--> <!-- endRemoveIf(!thermostat)-->
function initGPIO(node, name, key, value) {
var template = $("#gpioConfigTemplate").children();
var line = $(template).clone();
$("span.id", line).html(value);
$("select", line).attr("name", key);
line.appendTo(node);
}
function initSelectGPIO(select) { function initSelectGPIO(select) {
// TODO: cross-check used GPIOs
// TODO: support 9 & 10 with esp8285 variant
// TODO: properly lock used GPIOs via locking and apply the mask here
var mapping = [ var mapping = [
[153, "NONE"], [153, "NONE"],
[0, "0"],
[0, "0 (FLASH)"],
[1, "1 (U0TXD)"], [1, "1 (U0TXD)"],
[2, "2 (U1TXD)"], [2, "2 (U1TXD)"],
[3, "3 (U0RXD)"], [3, "3 (U0RXD)"],
[4, "4"],
[5, "5"],
[4, "4 (SDA)"],
[5, "5 (SCL)"],
[9, "9 (SDD2)"],
[10, "10 (SDD3)"],
[12, "12 (MTDI)"], [12, "12 (MTDI)"],
[13, "13 (MTCK)"], [13, "13 (MTCK)"],
[14, "14 (MTMS)"], [14, "14 (MTMS)"],
[15, "15 (MTDO)"], [15, "15 (MTDO)"],
[16, "15 (WAKE)"],
]; ];
for (n in mapping) { for (n in mapping) {
var elem = $('<option value="' + mapping[n][0] + '">'); var elem = $('<option value="' + mapping[n][0] + '">');
@ -1098,7 +1087,10 @@ function initRelayConfig(data) {
// Populate the relay SELECTs // Populate the relay SELECTs
$("select.isrelay").append( $("select.isrelay").append(
$("<option></option>").attr("value",i).text("Switch #" + i));
$("<option></option>")
.attr("value", i)
.text("Switch #" + i)
);
} }
@ -1175,7 +1167,7 @@ function getPickerRGB(picker) {
return $(picker).wheelColorPicker("getValue", "css"); return $(picker).wheelColorPicker("getValue", "css");
} }
function setPickerRGB(picker, color) {
function setPickerRGB(picker, value) {
$(picker).wheelColorPicker("setValue", value, true); $(picker).wheelColorPicker("setValue", value, true);
} }
@ -1482,7 +1474,7 @@ function processData(data) {
return; return;
} }
<!-- endRemoveIf(!rfbridge)-->
<!-- endRemoveIf(!lightfox)-->
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// RFM69 // RFM69
@ -1508,22 +1500,22 @@ function processData(data) {
} }
if (key == "mapping") { if (key == "mapping") {
for (var i in data.mapping) {
for (var i in data.mapping) {
// add a new row
addMapping();
// add a new row
addMapping();
// get group
var line = $("#mapping .pure-g")[i];
// get group
var line = $("#mapping .pure-g")[i];
// fill in the blanks
var mapping = data.mapping[i];
Object.keys(mapping).forEach(function(key) {
var id = "input[name=" + key + "]";
if ($(id, line).length) $(id, line).val(mapping[key]).attr("original", mapping[key]);
});
}
return;
// fill in the blanks
var mapping = data.mapping[i];
Object.keys(mapping).forEach(function(key) {
var id = "input[name=" + key + "]";
if ($(id, line).length) $(id, line).val(mapping[key]).attr("original", mapping[key]);
});
}
return;
} }
<!-- endRemoveIf(!rfm69)--> <!-- endRemoveIf(!rfm69)-->
@ -1802,8 +1794,8 @@ function processData(data) {
if ("weblog" === key) { if ("weblog" === key) {
send("{}"); send("{}");
msg = value["msg"];
pre = value["pre"];
var msg = value["msg"];
var pre = value["pre"];
for (var i=0; i < msg.length; ++i) { for (var i=0; i < msg.length; ++i) {
if (pre[i]) { if (pre[i]) {


Loading…
Cancel
Save