Skip to content

Commit

Permalink
Merge remote-tracking branch 'ewowi/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
ewoudwijma committed Oct 8, 2024
2 parents 55dcd8b + 44d6239 commit 14c3199
Show file tree
Hide file tree
Showing 16 changed files with 1,701 additions and 1,729 deletions.
12 changes: 9 additions & 3 deletions data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ function createHTML(json, parentNode = null, rowNr = UINT8_MAX) {
changeHTML(variable, variable, rowNr); // set the variable with its own changed values
}
else { //onUI
if (variable.value)
if (variable.value != null) //also if value == false (checkbox)
changeHTML(variable, {"value":variable.value, "chk":"gen1"}, rowNr); //set only the value

if (variable.options) // eg for pin type
Expand Down Expand Up @@ -1423,14 +1423,21 @@ function toggleModal(varNode) { //canvas or textarea
}
// https://stackoverflow.com/questions/324303/cut-and-paste-moving-nodes-in-the-dom-with-javascript

function isLowerCase(s) {
return s.toLowerCase() == s
}

function initCap(s) {
if (typeof s !== 'string') return '';
let result = "";
for (let i = 0; i < s.length; i++) {
if (i==0) //first uppercase
result += s.charAt(i).toUpperCase();
else if (s.charAt(i).toLowerCase() !== s.charAt(i) && s.charAt(i-1).toLowerCase() == s.charAt(i-1)) //uppercase (previous not uppercase) => add space
else if (!isLowerCase(s.charAt(i)) && isLowerCase(s.charAt(i-1))) //uppercase (previous not uppercase) => add space
// else if (!isLowerCase(s.charAt(i)) && isLowerCase(s.charAt(i-1)) && (i+1 >= s.length || isLowerCase(s.charAt(i+1))))
result += " " + s.charAt(i);
// else if (!isLowerCase(s.charAt(i)) && !isLowerCase(s.charAt(i-1)) && (i+1 >= s.length || isLowerCase(s.charAt(i+1))))
// result += " " + s.charAt(i);
else if (s.charAt(i) == '-' || s.charAt(i) == '_') //- and _ is space
result += " ";
else
Expand All @@ -1439,7 +1446,6 @@ function initCap(s) {
return result;
}


//drag and drop functionality
//===========================

Expand Down
9 changes: 8 additions & 1 deletion data/newui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,21 @@ const UINT16_MAX = 256*256-1;
function gId(c) {return document.getElementById(c);}
function cE(e) { return document.createElement(e); }

function isLowerCase(s) {
return s.toLowerCase() == s
}

function initCap(s) {
if (typeof s !== 'string') return '';
let result = "";
for (let i = 0; i < s.length; i++) {
if (i==0) //first uppercase
result += s.charAt(i).toUpperCase();
else if (s.charAt(i).toLowerCase() !== s.charAt(i) && s.charAt(i-1).toLowerCase() == s.charAt(i-1)) //uppercase (previous not uppercase) => add space
else if (!isLowerCase(s.charAt(i)) && isLowerCase(s.charAt(i-1))) //uppercase (previous not uppercase) => add space
// else if (!isLowerCase(s.charAt(i)) && isLowerCase(s.charAt(i-1)) && (i+1 >= s.length || isLowerCase(s.charAt(i+1))))
result += " " + s.charAt(i);
// else if (!isLowerCase(s.charAt(i)) && !isLowerCase(s.charAt(i-1)) && (i+1 >= s.length || isLowerCase(s.charAt(i+1))))
// result += " " + s.charAt(i);
else if (s.charAt(i) == '-' || s.charAt(i) == '_') //- and _ is space
result += " ";
else
Expand Down
74 changes: 46 additions & 28 deletions misc/model.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,47 +312,50 @@
"max": 255,
"n": [
{
"id": "clTbl",
"id": "clients",
"type": "table",
"ro": true,
"n": [
{
"id": "clNr",
"id": "nr",
"type": "number",
"pid": "clients",
"ro": true,
"max": 999,
"pid": "clTbl",
"o": 72,
"fun": 53
},
{
"id": "clIp",
"id": "ip",
"type": "text",
"pid": "clients",
"ro": true,
"max": 16,
"pid": "clTbl",
"o": 73,
"fun": 54
},
{
"id": "clIsFull",
"id": "full",
"type": "checkbox",
"pid": "clients",
"ro": true,
"pid": "clTbl",
"o": 74,
"fun": 55
"o": 45,
"fun": 33
},
{
"id": "clStatus",
"id": "status",
"type": "select",
"pid": "clients",
"ro": true,
"pid": "clTbl",
"o": 75,
"fun": 56
"o": 46,
"fun": 34
},
{
"id": "clLength",
"type": "number",
"pid": "clients",
"ro": true,
"max": 64,
"pid": "clTbl",
Expand Down Expand Up @@ -420,20 +423,22 @@
"s": true,
"n": [
{
"id": "ethOn",
"id": "ethernet",
"type": "checkbox",
"ro": false,
"value": 1,
"n": [
{
"id": "ethConfig",
"id": "config",
"type": "select",
"pid": "ethernet",
"ro": false,
"value": 0,
"n": [
{
"id": "ethaddr",
"id": "address",
"type": "number",
"pid": "config",
"ro": false,
"max": 255,
"value": 0,
Expand All @@ -442,8 +447,9 @@
"fun": 64
},
{
"id": "ethpower",
"id": "power",
"type": "pin",
"pid": "config",
"ro": false,
"max": 40,
"value": 14,
Expand All @@ -452,8 +458,9 @@
"fun": 65
},
{
"id": "ethmdc",
"id": "mdc",
"type": "pin",
"pid": "config",
"ro": false,
"max": 40,
"value": 23,
Expand All @@ -462,8 +469,9 @@
"fun": 66
},
{
"id": "ethmdio",
"id": "mdio",
"type": "pin",
"pid": "config",
"ro": false,
"max": 40,
"value": 18,
Expand All @@ -472,17 +480,19 @@
"fun": 67
},
{
"id": "ethtype",
"id": "type",
"type": "select",
"pid": "config",
"ro": false,
"value": 0,
"o": 89,
"pid": "ethConfig",
"fun": 68
},
{
"id": "ethclkmode",
"id": "clockMode",
"type": "select",
"pid": "config",
"ro": false,
"value": 3,
"o": 90,
Expand All @@ -495,8 +505,9 @@
"fun": 63
},
{
"id": "etStatus",
"id": "status",
"type": "text",
"pid": "ethernet",
"ro": true,
"max": 32,
"pid": "ethOn",
Expand All @@ -509,14 +520,15 @@
"fun": 62
},
{
"id": "wifiOn",
"id": "wiFi",
"type": "checkbox",
"ro": false,
"value": true,
"n": [
{
"id": "ssid",
"type": "text",
"pid": "wiFi",
"ro": false,
"max": 31,
"value": "ewtr",
Expand All @@ -525,8 +537,9 @@
"fun": 72
},
{
"id": "pw",
"id": "password",
"type": "password",
"pid": "wiFi",
"ro": false,
"max": 63,
"value": "zonledmod",
Expand All @@ -537,15 +550,17 @@
{
"id": "rssi",
"type": "text",
"pid": "wiFi",
"ro": true,
"max": 32,
"pid": "wifiOn",
"o": 95,
"fun": 74
},
{
"id": "wfStatus",
"id": "status",
"type": "text",
"pid": "wiFi",
"ro": true,
"max": 32,
"pid": "wifiOn",
Expand All @@ -558,14 +573,15 @@
"fun": 71
},
{
"id": "apOn",
"id": "AP",
"type": "checkbox",
"ro": false,
"value": 0,
"n": [
{
"id": "apStatus",
"id": "status",
"type": "text",
"pid": "AP",
"ro": true,
"max": 32,
"pid": "apOn",
Expand Down Expand Up @@ -742,22 +758,24 @@
"max": 255,
"n": [
{
"id": "vlTbl",
"id": "loops",
"type": "table",
"ro": true,
"n": [
{
"id": "vlVar",
"id": "variable",
"type": "text",
"pid": "loops",
"ro": true,
"max": 32,
"pid": "vlTbl",
"o": 124,
"fun": 97
},
{
"id": "vlLoopps",
"id": "#loops",
"type": "number",
"pid": "loops",
"ro": true,
"max": 999,
"pid": "vlTbl",
Expand Down
Loading

0 comments on commit 14c3199

Please sign in to comment.