102 lines
4.9 KiB
HTML
102 lines
4.9 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Hestia Web Portal</title>
|
|
<link rel="stylesheet" href="/main.css">
|
|
</head>
|
|
<body onload="refreshData()">
|
|
<%- include('trial.html') -%>
|
|
<div id="title">Hestia Web Portal</div>
|
|
<div id="status">Auger: <span id="auger-status"></span> | Igniter: <span id="igniter-status"></span> | Combustion Blower: <span id="blower-status"></span></div>
|
|
<div id="safeties">Vacuum: <span id="vacuum-status"></span> | Proof of Fire: <span id="pof-status"></span></div>
|
|
<div id="controls-container">
|
|
<form action="/" method="post">
|
|
<!-- Start | Shutdown | Reload Settings -->
|
|
<div class="button-container">
|
|
<input class="button-unselected" type="submit" id="ignite" value="Start" name="start"><input class="button-unselected" type="submit" id="shutdown" value="Shutdown" name="shutdown"><input class="button-unselected" type="submit" id="reload" value="Reload" name="reload"><br>
|
|
</div>
|
|
<!-- Set feed rates -->
|
|
<!-- <label for="augerOn">Auger On Interval: </label><input type="number" id="auger-on" name="augerOn" min="500" max="1000" value="<%= intervals.augerOn %>">ms<br> -->
|
|
<!-- <label for="augerOff">Auger Off Interval: </label><input type="number" id="auger-off" name="augerOff" min="1000" max="2000" value="<%= intervals.augerOff %>">ms<br> -->
|
|
<!-- <label for="pauseInt">App Pause Interval: </label><input type="number" id="pause-int" name="pauseInt" min="1000" max="600000" value="<%= intervals.pause %>">ms<br> -->
|
|
</form>
|
|
</div>
|
|
<div class="subheading">
|
|
Pellet Feed Rate
|
|
</div>
|
|
<div class="button-container">
|
|
<button class="button-unselected" id="low-level">LOW</button><button class="button-unselected" id="med-level">MED</button><button class="button-unselected" id="hi-level">HI</button>
|
|
</div>
|
|
<div class="button-container">
|
|
<img src="./dancing_jesus.gif">
|
|
</div>
|
|
<div id="log-container">
|
|
<button id="refresh-log" onclick="refreshLog()">Refresh Log</button><br>
|
|
<!-- <textarea id="log-area"></textarea> -->
|
|
<iframe id="log-area" src="log.txt"></iframe>
|
|
</div>
|
|
<script>
|
|
function sleep(ms) {
|
|
return new Promise((resolve, reject) => {
|
|
setTimeout(() => {
|
|
resolve();
|
|
}, ms);
|
|
});
|
|
}
|
|
|
|
function readJSON(path) {
|
|
var request = new XMLHttpRequest();
|
|
request.open("GET", path, false);
|
|
request.send(null)
|
|
var JSONObj = JSON.parse(request.responseText);
|
|
return JSONObj;
|
|
}
|
|
|
|
function parseStatus(data) {
|
|
switch (data) {
|
|
case 0:
|
|
return "Off";
|
|
break;
|
|
case 1:
|
|
return "On";
|
|
break
|
|
default:
|
|
return "Error";
|
|
break;
|
|
}
|
|
}
|
|
|
|
function refreshData() {
|
|
const log = document.getElementById('log-area');
|
|
log.contentWindow.location.reload();
|
|
sleep(100).then(() => {
|
|
document.getElementById('log-area').contentWindow.scrollTo(0, 9999999);
|
|
});
|
|
|
|
const augerStatus = document.getElementById('auger-status');
|
|
// const augerOn = document.getElementById('auger-on');
|
|
// const augerOff = document.getElementById('auger-off');
|
|
const igniterStatus = document.getElementById('igniter-status');
|
|
const blowerStatus = document.getElementById('blower-status');
|
|
// const pauseInt = document.getElementById('pause-int');
|
|
const vacuumStatus = document.getElementById('vacuum-status');
|
|
const pofStatus = document.getElementById('pof-status');
|
|
|
|
const config = readJSON('./config.json');
|
|
|
|
augerStatus.innerHTML = parseStatus(config.status.auger);
|
|
// augerOn.innerHTML = parseStatus(config.intervals.augerOn);
|
|
// augerOff.innerHTML = parseStatus(config.intervals.augerOff);
|
|
igniterStatus.innerHTML = parseStatus(config.status.igniter);
|
|
blowerStatus.innerHTML = parseStatus(config.status.blower);
|
|
// pauseInt.innerHTML = parseStatus(config.intervals.pause);
|
|
vacuumStatus.innerHTML = parseStatus(config.status.vacuum);
|
|
pofStatus.innerHTML = parseStatus(config.status.pof);
|
|
|
|
sleep(2000).then(() => {
|
|
refreshData();
|
|
});
|
|
};
|
|
</script>
|
|
</body>
|
|
</html> |