Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: net 1-wire lpc1768 crypto clock web fram log
web-this/boiler/web-boiler-script.inc@92:2d1ca4dcbca7, 2020-06-10 (annotated)
- Committer:
 - andrewboyson
 - Date:
 - Wed Jun 10 11:45:38 2020 +0000
 - Revision:
 - 92:2d1ca4dcbca7
 - Parent:
 - 91:8b192efd0288
 - Child:
 - 104:46ce1aaf8be7
 
Made changes to the javascript in web pages displaying temperatures in line with the changes to the 1-wire library.
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| andrewboyson | 47:229338b3adcb | 1 | "//Boiler script\n" | 
| andrewboyson | 47:229338b3adcb | 2 | "'use strict';\n" | 
| andrewboyson | 47:229338b3adcb | 3 | "\n" | 
| andrewboyson | 91:8b192efd0288 | 4 | "let dateTime = '';\n" | 
| andrewboyson | 91:8b192efd0288 | 5 | "let tankTemperature = '';\n" | 
| andrewboyson | 91:8b192efd0288 | 6 | "let blrOutTemperature = '';\n" | 
| andrewboyson | 91:8b192efd0288 | 7 | "let blrRtnTemperature = '';\n" | 
| andrewboyson | 91:8b192efd0288 | 8 | "let boilerCall = false;\n" | 
| andrewboyson | 91:8b192efd0288 | 9 | "let boilerPump = false;\n" | 
| andrewboyson | 91:8b192efd0288 | 10 | "let tankSetPoint = '';\n" | 
| andrewboyson | 91:8b192efd0288 | 11 | "let tankHysteresis = '';\n" | 
| andrewboyson | 91:8b192efd0288 | 12 | "let blrRunOnDeg = '';\n" | 
| andrewboyson | 91:8b192efd0288 | 13 | "let blrRunOnTime = '';\n" | 
| andrewboyson | 47:229338b3adcb | 14 | "\n" | 
| andrewboyson | 47:229338b3adcb | 15 | "function parse()\n" | 
| andrewboyson | 47:229338b3adcb | 16 | "{\n" | 
| andrewboyson | 47:229338b3adcb | 17 | " let lines = Ajax.response.split('\\n');\n" | 
| andrewboyson | 92:2d1ca4dcbca7 | 18 | " tankTemperature = Ajax.hexToSignedInt16(lines[0]);\n" | 
| andrewboyson | 92:2d1ca4dcbca7 | 19 | " blrOutTemperature = Ajax.hexToSignedInt16(lines[1]);\n" | 
| andrewboyson | 92:2d1ca4dcbca7 | 20 | " blrRtnTemperature = Ajax.hexToSignedInt16(lines[2]);\n" | 
| andrewboyson | 92:2d1ca4dcbca7 | 21 | " boilerCall = Ajax.hexToBit (lines[3], 0);\n" | 
| andrewboyson | 92:2d1ca4dcbca7 | 22 | " boilerPump = Ajax.hexToBit (lines[3], 1);\n" | 
| andrewboyson | 92:2d1ca4dcbca7 | 23 | " tankSetPoint = Ajax.hexToSignedInt16(lines[4]);\n" | 
| andrewboyson | 92:2d1ca4dcbca7 | 24 | " tankHysteresis = Ajax.hexToSignedInt16(lines[5]);\n" | 
| andrewboyson | 92:2d1ca4dcbca7 | 25 | " blrRunOnDeg = Ajax.hexToSignedInt16(lines[6]);\n" | 
| andrewboyson | 92:2d1ca4dcbca7 | 26 | " blrRunOnTime = Ajax.hexToSignedInt16(lines[7]);\n" | 
| andrewboyson | 47:229338b3adcb | 27 | "}\n" | 
| andrewboyson | 47:229338b3adcb | 28 | "function display()\n" | 
| andrewboyson | 47:229338b3adcb | 29 | "{\n" | 
| andrewboyson | 47:229338b3adcb | 30 | " let elem;\n" | 
| andrewboyson | 92:2d1ca4dcbca7 | 31 | " elem = Ajax.getElementOrNull('ajax-tank-html' ); if (elem) elem.textContent = OneWire.DS18B20ToString(tankTemperature);\n" | 
| andrewboyson | 92:2d1ca4dcbca7 | 32 | " elem = Ajax.getElementOrNull('ajax-blr-out-html' ); if (elem) elem.textContent = OneWire.DS18B20ToString(blrOutTemperature);\n" | 
| andrewboyson | 92:2d1ca4dcbca7 | 33 | " elem = Ajax.getElementOrNull('ajax-blr-rtn-html' ); if (elem) elem.textContent = OneWire.DS18B20ToString(blrRtnTemperature);\n" | 
| andrewboyson | 92:2d1ca4dcbca7 | 34 | " elem = Ajax.getElementOrNull('ajax-blr-rise-html' ); if (elem) elem.textContent = OneWire.DS18B20ToString(blrOutTemperature - blrRtnTemperature);\n" | 
| andrewboyson | 91:8b192efd0288 | 35 | " \n" | 
| andrewboyson | 47:229338b3adcb | 36 | " elem = Ajax.getElementOrNull('ajax-blr-call-toggle'); if (elem) elem.setAttribute('dir', boilerCall ? 'rtl' : 'ltr');\n" | 
| andrewboyson | 47:229338b3adcb | 37 | " elem = Ajax.getElementOrNull('ajax-blr-pump-toggle'); if (elem) elem.setAttribute('dir', boilerPump ? 'rtl' : 'ltr');\n" | 
| andrewboyson | 47:229338b3adcb | 38 | " elem = Ajax.getElementOrNull('ajax-tank-set-point' ); if (elem) elem.value = tankSetPoint;\n" | 
| andrewboyson | 47:229338b3adcb | 39 | " elem = Ajax.getElementOrNull('ajax-tank-hysteresis'); if (elem) elem.value = tankHysteresis;\n" | 
| andrewboyson | 92:2d1ca4dcbca7 | 40 | " elem = Ajax.getElementOrNull('ajax-blr-run-on-deg' ); if (elem) elem.value = OneWire.DS18B20ToString(blrRunOnDeg);\n" | 
| andrewboyson | 47:229338b3adcb | 41 | " elem = Ajax.getElementOrNull('ajax-blr-run-on-time'); if (elem) elem.value = blrRunOnTime;\n" | 
| andrewboyson | 47:229338b3adcb | 42 | "\n" | 
| andrewboyson | 47:229338b3adcb | 43 | "}\n" | 
| andrewboyson | 47:229338b3adcb | 44 | "\n" | 
| andrewboyson | 47:229338b3adcb | 45 | "Ajax.server = '/boiler-ajax';\n" | 
| andrewboyson | 47:229338b3adcb | 46 | "Ajax.onResponse = function() { parse(); display(); };\n" | 
| andrewboyson | 47:229338b3adcb | 47 | "Ajax.init();\n" | 
| andrewboyson | 47:229338b3adcb | 48 | "" |