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
http-derived/boiler/http-boiler-script.inc
- Committer:
- andrewboyson
- Date:
- 2019-04-23
- Revision:
- 47:229338b3adcb
File content as of revision 47:229338b3adcb:
"//Boiler script\n"
"'use strict';\n"
"\n"
"let dateTime = '';\n"
"let tankTemperature = '';\n"
"let blrOutTemperature = '';\n"
"let blrRtnTemperature = '';\n"
"let boilerCall = false;\n"
"let boilerPump = false;\n"
"let tankSetPoint = '';\n"
"let tankHysteresis = '';\n"
"let blrRunOnDeg = '';\n"
"let blrRunOnTime = '';\n"
"\n"
"function parse()\n"
"{\n"
" let lines = Ajax.response.split('\\n');\n"
" tankTemperature = OneWire.DS18B20ToString (lines[0]);\n"
" blrOutTemperature = OneWire.DS18B20ToString (lines[1]);\n"
" blrRtnTemperature = OneWire.DS18B20ToString (lines[2]);\n"
" boilerCall = Ajax.hexToBit (lines[3], 0);\n"
" boilerPump = Ajax.hexToBit (lines[3], 1);\n"
" tankSetPoint = Ajax.hexToSignedInt16(lines[4]);\n"
" tankHysteresis = Ajax.hexToSignedInt16(lines[5]);\n"
" blrRunOnDeg = Ajax.hexToSignedInt16(lines[6]);\n"
" blrRunOnTime = Ajax.hexToSignedInt16(lines[7]);\n"
"}\n"
"function display()\n"
"{\n"
" let elem;\n"
" elem = Ajax.getElementOrNull('ajax-tank-html' ); if (elem) elem.textContent = tankTemperature;\n"
" elem = Ajax.getElementOrNull('ajax-blr-out-html' ); if (elem) elem.textContent = blrOutTemperature;\n"
" elem = Ajax.getElementOrNull('ajax-blr-rtn-html' ); if (elem) elem.textContent = blrRtnTemperature;\n"
" elem = Ajax.getElementOrNull('ajax-blr-call-toggle'); if (elem) elem.setAttribute('dir', boilerCall ? 'rtl' : 'ltr');\n"
" elem = Ajax.getElementOrNull('ajax-blr-pump-toggle'); if (elem) elem.setAttribute('dir', boilerPump ? 'rtl' : 'ltr');\n"
" elem = Ajax.getElementOrNull('ajax-tank-set-point' ); if (elem) elem.value = tankSetPoint;\n"
" elem = Ajax.getElementOrNull('ajax-tank-hysteresis'); if (elem) elem.value = tankHysteresis;\n"
" elem = Ajax.getElementOrNull('ajax-blr-run-on-deg' ); if (elem) elem.value = blrRunOnDeg;\n"
" elem = Ajax.getElementOrNull('ajax-blr-run-on-time'); if (elem) elem.value = blrRunOnTime;\n"
"\n"
"}\n"
"\n"
"Ajax.server = '/boiler-ajax';\n"
"Ajax.onResponse = function() { parse(); display(); };\n"
"Ajax.init();\n"
""