Manages the 1-wire bus

Dependents:   oldheating heating

Revision:
10:b4e0b4c4e045
Parent:
9:6f663ad53c7e
--- a/web/web-1wire-script.inc	Wed Jun 10 11:41:03 2020 +0000
+++ b/web/web-1wire-script.inc	Wed Jun 10 17:02:21 2020 +0000
@@ -87,14 +87,22 @@
 "    elem = Ajax.getElementOrNull('ajax-1-wire-tweak-release'); if (elem) elem.textContent = oneWireReleaseTweak;\n"
 "    elem = Ajax.getElementOrNull('ajax-1-wire-trace'        ); if (elem) elem.setAttribute('dir', oneWireTrace ? 'rtl' : 'ltr');\n"
 "\n"
-"    elem = Ajax.getElementOrNull('ajax-name-0'); if (elem) elem.textContent = assignedNames[0];\n"
-"    elem = Ajax.getElementOrNull('ajax-name-1'); if (elem) elem.textContent = assignedNames[1];\n"
-"    elem = Ajax.getElementOrNull('ajax-name-2'); if (elem) elem.textContent = assignedNames[2];\n"
-"    elem = Ajax.getElementOrNull('ajax-name-3'); if (elem) elem.textContent = assignedNames[3];\n"
-"    elem = Ajax.getElementOrNull('ajax-rom-0' ); if (elem) elem.value = assignedRoms[0];\n"
-"    elem = Ajax.getElementOrNull('ajax-rom-1' ); if (elem) elem.value = assignedRoms[1];\n"
-"    elem = Ajax.getElementOrNull('ajax-rom-2' ); if (elem) elem.value = assignedRoms[2];\n"
-"    elem = Ajax.getElementOrNull('ajax-rom-3' ); if (elem) elem.value = assignedRoms[3];\n"
+"    elem = Ajax.getElementOrNull('ajax-name-0'); if (elem && assignedNames.length > 0) elem.textContent = assignedNames[0];\n"
+"    elem = Ajax.getElementOrNull('ajax-name-1'); if (elem && assignedNames.length > 1) elem.textContent = assignedNames[1];\n"
+"    elem = Ajax.getElementOrNull('ajax-name-2'); if (elem && assignedNames.length > 2) elem.textContent = assignedNames[2];\n"
+"    elem = Ajax.getElementOrNull('ajax-name-3'); if (elem && assignedNames.length > 3) elem.textContent = assignedNames[3];\n"
+"    elem = Ajax.getElementOrNull('ajax-name-4'); if (elem && assignedNames.length > 4) elem.textContent = assignedNames[4];\n"
+"    elem = Ajax.getElementOrNull('ajax-name-5'); if (elem && assignedNames.length > 5) elem.textContent = assignedNames[5];\n"
+"    elem = Ajax.getElementOrNull('ajax-name-6'); if (elem && assignedNames.length > 6) elem.textContent = assignedNames[6];\n"
+"    elem = Ajax.getElementOrNull('ajax-name-7'); if (elem && assignedNames.length > 7) elem.textContent = assignedNames[7];\n"
+"    elem = Ajax.getElementOrNull('ajax-rom-0' ); if (elem && assignedRoms.length  > 0) elem.value = assignedRoms[0];\n"
+"    elem = Ajax.getElementOrNull('ajax-rom-1' ); if (elem && assignedRoms.length  > 1) elem.value = assignedRoms[1];\n"
+"    elem = Ajax.getElementOrNull('ajax-rom-2' ); if (elem && assignedRoms.length  > 2) elem.value = assignedRoms[2];\n"
+"    elem = Ajax.getElementOrNull('ajax-rom-3' ); if (elem && assignedRoms.length  > 3) elem.value = assignedRoms[3];\n"
+"    elem = Ajax.getElementOrNull('ajax-rom-4' ); if (elem && assignedRoms.length  > 4) elem.value = assignedRoms[4];\n"
+"    elem = Ajax.getElementOrNull('ajax-rom-5' ); if (elem && assignedRoms.length  > 5) elem.value = assignedRoms[5];\n"
+"    elem = Ajax.getElementOrNull('ajax-rom-6' ); if (elem && assignedRoms.length  > 6) elem.value = assignedRoms[6];\n"
+"    elem = Ajax.getElementOrNull('ajax-rom-7' ); if (elem && assignedRoms.length  > 7) elem.value = assignedRoms[7];\n"
 "}\n"
 "\n"
 "Ajax.server     = '/1wire-ajax';\n"