Compare commits
3 Commits
ac1848c48e
...
db763223c6
Author | SHA1 | Date | |
---|---|---|---|
db763223c6 | |||
0b6794fb89 | |||
9e6e813b4c |
6
main.js
6
main.js
@ -9,9 +9,15 @@ portal.start();
|
|||||||
|
|
||||||
dbfn.run(`UPDATE timestamps SET value = ${Date.now()} WHERE key = 'process_start'`).catch(err => console.error(`Error setting process start time: ${err}`));
|
dbfn.run(`UPDATE timestamps SET value = ${Date.now()} WHERE key = 'process_start'`).catch(err => console.error(`Error setting process start time: ${err}`));
|
||||||
|
|
||||||
|
// Initialization, which then calls main()
|
||||||
fn.commands.refreshConfig().then(res => {
|
fn.commands.refreshConfig().then(res => {
|
||||||
if (process.env.DEBUG) console.log(`[${(Date.now() - config.timestamps.procStart)/1000}] I: ${res.status}`);
|
if (process.env.DEBUG) console.log(`[${(Date.now() - config.timestamps.procStart)/1000}] I: ${res.status}`);
|
||||||
config = res.config;
|
config = res.config;
|
||||||
|
const shutdownNextCycleQuery = "UPDATE status SET value = 0 WHERE key = 'shutdown_next_cycle'";
|
||||||
|
dbfn.run(shutdownNextCycleQuery).then(res => {
|
||||||
|
if (process.env.DEBUG) console.log(`[${(Date.now() - config.timestamps.procStart)/1000}] I: ${res.status}`);
|
||||||
|
console.log(`[${(Date.now() - config.timestamps.procStart) / 1000}] I: Shutdown flag reset.`);
|
||||||
|
}).catch(err => console.log(`[${(Date.now() - config.timestamps.procStart)/1000}] E: ${err}`));
|
||||||
// Setup for use with the Pi's GPIO pins
|
// Setup for use with the Pi's GPIO pins
|
||||||
switch (process.env.ONPI) {
|
switch (process.env.ONPI) {
|
||||||
case 'true':
|
case 'true':
|
||||||
|
@ -87,7 +87,7 @@ html, body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
table {
|
table {
|
||||||
margin: 0 auto;
|
margin: 10;
|
||||||
color: aqua !important;
|
color: aqua !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,4 +95,8 @@ table, th, td {
|
|||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
th, td {
|
||||||
|
width: 50%;
|
||||||
}
|
}
|
@ -21,22 +21,18 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="status" class="row">
|
<div id="status" class="row">
|
||||||
<!--
|
<!--
|
||||||
| Auger | rows[0].cells[1] | On Time | rows[0].cells[3] |
|
| Auger | rows[0].cells[1]
|
||||||
| Feed Rate | rows[1].cells[1] | Off Time | rows[1].cells[3] |
|
| Feed Rate | rows[1].cells[1]
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<table id="status-table" class="table table-bordered col-sm-12 col-md-6">
|
<table id="status-table" class="table table-bordered col-sm-12 col-md-6">
|
||||||
<tr>
|
<tr>
|
||||||
<td>Auger</td>
|
<td>Auger</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>On Time</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Feed Rate</td>
|
<td>Feed Rate</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>Off Time</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -116,16 +112,12 @@
|
|||||||
// Get the elements we need to update
|
// Get the elements we need to update
|
||||||
const statusTable = document.getElementById('status-table');
|
const statusTable = document.getElementById('status-table');
|
||||||
const augerStatus = statusTable.rows[0].cells[1];
|
const augerStatus = statusTable.rows[0].cells[1];
|
||||||
const augerOn = statusTable.rows[0].cells[3];
|
|
||||||
const augerOff = statusTable.rows[1].cells[3];
|
|
||||||
const feedRate = statusTable.rows[1].cells[1];
|
const feedRate = statusTable.rows[1].cells[1];
|
||||||
const feedRateSelect = document.getElementById('feed-rate-select');
|
const feedRateSelect = document.getElementById('feed-rate-select');
|
||||||
|
|
||||||
// console.log(config);
|
// console.log(config);
|
||||||
|
|
||||||
augerStatus.innerHTML = parseStatus(config.status.auger);
|
augerStatus.innerHTML = parseStatus(config.status.auger);
|
||||||
augerOn.innerHTML = config.intervals.augerOn;
|
|
||||||
augerOff.innerHTML = config.intervals.augerOff;
|
|
||||||
|
|
||||||
switch (config.intervals.augerOn) {
|
switch (config.intervals.augerOn) {
|
||||||
case '500':
|
case '500':
|
||||||
|
Loading…
Reference in New Issue
Block a user