Central Heating controller using the real time clock, PHY module for internet, 1-wire interface for temperature sensors, a system log and a configuration file
Dependencies: net 1-wire lpc1768 crypto clock web fram log
/media/uploads/andrewboyson/heating.sch
/media/uploads/andrewboyson/heating.brd
/media/uploads/andrewboyson/eagle.epf
web-this/system/web-system-script.js@106:41ed3ea0bbba, 2021-04-23 (annotated)
- Committer:
- andrewboyson
- Date:
- Fri Apr 23 08:36:42 2021 +0000
- Revision:
- 106:41ed3ea0bbba
- Parent:
- 53:c1bf7d9db507
Not working, crashes.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 47:229338b3adcb | 1 | //System script |
andrewboyson | 47:229338b3adcb | 2 | 'use strict'; |
andrewboyson | 47:229338b3adcb | 3 | |
andrewboyson | 48:6eac12df3ad5 | 4 | let serverName = ''; |
andrewboyson | 48:6eac12df3ad5 | 5 | let fileName = ''; |
andrewboyson | 48:6eac12df3ad5 | 6 | let readInterval = 0; |
andrewboyson | 48:6eac12df3ad5 | 7 | let writeSize = 0; |
andrewboyson | 48:6eac12df3ad5 | 8 | let count = 0; |
andrewboyson | 48:6eac12df3ad5 | 9 | let startTime = null; |
andrewboyson | 48:6eac12df3ad5 | 10 | let framUsed = 0; |
andrewboyson | 47:229338b3adcb | 11 | |
andrewboyson | 47:229338b3adcb | 12 | function parse() |
andrewboyson | 47:229338b3adcb | 13 | { |
andrewboyson | 48:6eac12df3ad5 | 14 | let lines = Ajax.response.split('\n'); |
andrewboyson | 48:6eac12df3ad5 | 15 | serverName = lines[0]; |
andrewboyson | 48:6eac12df3ad5 | 16 | fileName = lines[1]; |
andrewboyson | 48:6eac12df3ad5 | 17 | readInterval = Ajax.hexToSignedInt16(lines[2]); |
andrewboyson | 48:6eac12df3ad5 | 18 | writeSize = Ajax.hexToSignedInt16(lines[3]); |
andrewboyson | 48:6eac12df3ad5 | 19 | count = Ajax.hexToSignedInt16(lines[4]); |
andrewboyson | 48:6eac12df3ad5 | 20 | startTime = new Date(parseInt(lines[5], 16) * 1000); |
andrewboyson | 48:6eac12df3ad5 | 21 | framUsed = Ajax.hexToSignedInt16(lines[6]); |
andrewboyson | 47:229338b3adcb | 22 | } |
andrewboyson | 47:229338b3adcb | 23 | function display() |
andrewboyson | 47:229338b3adcb | 24 | { |
andrewboyson | 47:229338b3adcb | 25 | let elem; |
andrewboyson | 48:6eac12df3ad5 | 26 | elem = Ajax.getElementOrNull('ajax-server-name' ); if (elem) elem.value = serverName; |
andrewboyson | 48:6eac12df3ad5 | 27 | elem = Ajax.getElementOrNull('ajax-file-name' ); if (elem) elem.value = fileName; |
andrewboyson | 48:6eac12df3ad5 | 28 | elem = Ajax.getElementOrNull('ajax-read-interval'); if (elem) elem.value = readInterval; |
andrewboyson | 48:6eac12df3ad5 | 29 | elem = Ajax.getElementOrNull('ajax-write-size' ); if (elem) elem.value = writeSize; |
andrewboyson | 48:6eac12df3ad5 | 30 | elem = Ajax.getElementOrNull('ajax-count' ); if (elem) elem.textContent = count; |
andrewboyson | 48:6eac12df3ad5 | 31 | elem = Ajax.getElementOrNull('ajax-start-time' ); if (elem) elem.textContent = startTime.toISOString().substr(0, 19).split('T').join(' ') + ' UTC'; |
andrewboyson | 48:6eac12df3ad5 | 32 | elem = Ajax.getElementOrNull('ajax-fram-used' ); if (elem) elem.textContent = framUsed; |
andrewboyson | 47:229338b3adcb | 33 | } |
andrewboyson | 47:229338b3adcb | 34 | |
andrewboyson | 47:229338b3adcb | 35 | Ajax.server = '/system-ajax'; |
andrewboyson | 47:229338b3adcb | 36 | Ajax.onResponse = function() { parse(); display(); }; |
andrewboyson | 47:229338b3adcb | 37 | Ajax.init(); |