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-derived/boiler/web-boiler-script.inc@49:9491c966dc60, 2019-04-27 (annotated)
- Committer:
- andrewboyson
- Date:
- Sat Apr 27 09:27:11 2019 +0000
- Revision:
- 49:9491c966dc60
- Parent:
- http-derived/boiler/http-boiler-script.inc@47:229338b3adcb
Updated web 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 | 47:229338b3adcb | 4 | "let dateTime = '';\n" |
| andrewboyson | 47:229338b3adcb | 5 | "let tankTemperature = '';\n" |
| andrewboyson | 47:229338b3adcb | 6 | "let blrOutTemperature = '';\n" |
| andrewboyson | 47:229338b3adcb | 7 | "let blrRtnTemperature = '';\n" |
| andrewboyson | 47:229338b3adcb | 8 | "let boilerCall = false;\n" |
| andrewboyson | 47:229338b3adcb | 9 | "let boilerPump = false;\n" |
| andrewboyson | 47:229338b3adcb | 10 | "let tankSetPoint = '';\n" |
| andrewboyson | 47:229338b3adcb | 11 | "let tankHysteresis = '';\n" |
| andrewboyson | 47:229338b3adcb | 12 | "let blrRunOnDeg = '';\n" |
| andrewboyson | 47:229338b3adcb | 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 | 47:229338b3adcb | 18 | " tankTemperature = OneWire.DS18B20ToString (lines[0]);\n" |
| andrewboyson | 47:229338b3adcb | 19 | " blrOutTemperature = OneWire.DS18B20ToString (lines[1]);\n" |
| andrewboyson | 47:229338b3adcb | 20 | " blrRtnTemperature = OneWire.DS18B20ToString (lines[2]);\n" |
| andrewboyson | 47:229338b3adcb | 21 | " boilerCall = Ajax.hexToBit (lines[3], 0);\n" |
| andrewboyson | 47:229338b3adcb | 22 | " boilerPump = Ajax.hexToBit (lines[3], 1);\n" |
| andrewboyson | 47:229338b3adcb | 23 | " tankSetPoint = Ajax.hexToSignedInt16(lines[4]);\n" |
| andrewboyson | 47:229338b3adcb | 24 | " tankHysteresis = Ajax.hexToSignedInt16(lines[5]);\n" |
| andrewboyson | 47:229338b3adcb | 25 | " blrRunOnDeg = Ajax.hexToSignedInt16(lines[6]);\n" |
| andrewboyson | 47:229338b3adcb | 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 | 47:229338b3adcb | 31 | " elem = Ajax.getElementOrNull('ajax-tank-html' ); if (elem) elem.textContent = tankTemperature;\n" |
| andrewboyson | 47:229338b3adcb | 32 | " elem = Ajax.getElementOrNull('ajax-blr-out-html' ); if (elem) elem.textContent = blrOutTemperature;\n" |
| andrewboyson | 47:229338b3adcb | 33 | " elem = Ajax.getElementOrNull('ajax-blr-rtn-html' ); if (elem) elem.textContent = blrRtnTemperature;\n" |
| andrewboyson | 47:229338b3adcb | 34 | " elem = Ajax.getElementOrNull('ajax-blr-call-toggle'); if (elem) elem.setAttribute('dir', boilerCall ? 'rtl' : 'ltr');\n" |
| andrewboyson | 47:229338b3adcb | 35 | " elem = Ajax.getElementOrNull('ajax-blr-pump-toggle'); if (elem) elem.setAttribute('dir', boilerPump ? 'rtl' : 'ltr');\n" |
| andrewboyson | 47:229338b3adcb | 36 | " elem = Ajax.getElementOrNull('ajax-tank-set-point' ); if (elem) elem.value = tankSetPoint;\n" |
| andrewboyson | 47:229338b3adcb | 37 | " elem = Ajax.getElementOrNull('ajax-tank-hysteresis'); if (elem) elem.value = tankHysteresis;\n" |
| andrewboyson | 47:229338b3adcb | 38 | " elem = Ajax.getElementOrNull('ajax-blr-run-on-deg' ); if (elem) elem.value = blrRunOnDeg;\n" |
| andrewboyson | 47:229338b3adcb | 39 | " elem = Ajax.getElementOrNull('ajax-blr-run-on-time'); if (elem) elem.value = blrRunOnTime;\n" |
| andrewboyson | 47:229338b3adcb | 40 | "\n" |
| andrewboyson | 47:229338b3adcb | 41 | "}\n" |
| andrewboyson | 47:229338b3adcb | 42 | "\n" |
| andrewboyson | 47:229338b3adcb | 43 | "Ajax.server = '/boiler-ajax';\n" |
| andrewboyson | 47:229338b3adcb | 44 | "Ajax.onResponse = function() { parse(); display(); };\n" |
| andrewboyson | 47:229338b3adcb | 45 | "Ajax.init();\n" |
| andrewboyson | 47:229338b3adcb | 46 | "" |