Controls the central heating system and the lights.

Dependencies:   1-wire clock crypto fram log lpc1768 net web wiz mbed

Committer:
andrewboyson
Date:
Sat Nov 12 10:03:38 2022 +0000
Revision:
8:8ac076ce51af
Parent:
0:22b158d3c76f
Updated LPC1768 library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andrewboyson 0:22b158d3c76f 1 "//System script\n"
andrewboyson 0:22b158d3c76f 2 "'use strict';\n"
andrewboyson 0:22b158d3c76f 3 "\n"
andrewboyson 0:22b158d3c76f 4 "let serverName = '';\n"
andrewboyson 0:22b158d3c76f 5 "let fileName = '';\n"
andrewboyson 0:22b158d3c76f 6 "let readInterval = 0;\n"
andrewboyson 0:22b158d3c76f 7 "let writeSize = 0;\n"
andrewboyson 0:22b158d3c76f 8 "let count = 0;\n"
andrewboyson 0:22b158d3c76f 9 "let startTime = null;\n"
andrewboyson 0:22b158d3c76f 10 "let framUsed = 0;\n"
andrewboyson 0:22b158d3c76f 11 "\n"
andrewboyson 0:22b158d3c76f 12 "function parse()\n"
andrewboyson 0:22b158d3c76f 13 "{\n"
andrewboyson 0:22b158d3c76f 14 " let lines = Ajax.response.split('\\n');\n"
andrewboyson 0:22b158d3c76f 15 " serverName = lines[0];\n"
andrewboyson 0:22b158d3c76f 16 " fileName = lines[1];\n"
andrewboyson 0:22b158d3c76f 17 " readInterval = Ajax.hexToSignedInt16(lines[2]);\n"
andrewboyson 0:22b158d3c76f 18 " writeSize = Ajax.hexToSignedInt16(lines[3]);\n"
andrewboyson 0:22b158d3c76f 19 " count = Ajax.hexToSignedInt16(lines[4]);\n"
andrewboyson 0:22b158d3c76f 20 " startTime = new Date(parseInt(lines[5], 16) * 1000);\n"
andrewboyson 0:22b158d3c76f 21 " framUsed = Ajax.hexToSignedInt16(lines[6]);\n"
andrewboyson 0:22b158d3c76f 22 "}\n"
andrewboyson 0:22b158d3c76f 23 "function display()\n"
andrewboyson 0:22b158d3c76f 24 "{\n"
andrewboyson 0:22b158d3c76f 25 " let elem;\n"
andrewboyson 0:22b158d3c76f 26 " elem = Ajax.getElementOrNull('ajax-server-name' ); if (elem) elem.value = serverName;\n"
andrewboyson 0:22b158d3c76f 27 " elem = Ajax.getElementOrNull('ajax-file-name' ); if (elem) elem.value = fileName;\n"
andrewboyson 0:22b158d3c76f 28 " elem = Ajax.getElementOrNull('ajax-read-interval'); if (elem) elem.value = readInterval;\n"
andrewboyson 0:22b158d3c76f 29 " elem = Ajax.getElementOrNull('ajax-write-size' ); if (elem) elem.value = writeSize;\n"
andrewboyson 0:22b158d3c76f 30 " elem = Ajax.getElementOrNull('ajax-count' ); if (elem) elem.textContent = count;\n"
andrewboyson 0:22b158d3c76f 31 " elem = Ajax.getElementOrNull('ajax-start-time' ); if (elem) elem.textContent = startTime.toISOString().substr(0, 19).split('T').join(' ') + ' UTC';\n"
andrewboyson 0:22b158d3c76f 32 " elem = Ajax.getElementOrNull('ajax-fram-used' ); if (elem) elem.textContent = framUsed;\n"
andrewboyson 0:22b158d3c76f 33 "}\n"
andrewboyson 0:22b158d3c76f 34 "\n"
andrewboyson 0:22b158d3c76f 35 "Ajax.server = '/system-ajax';\n"
andrewboyson 0:22b158d3c76f 36 "Ajax.onResponse = function() { parse(); display(); };\n"
andrewboyson 0:22b158d3c76f 37 "Ajax.init();\n"
andrewboyson 0:22b158d3c76f 38 ""