Compare commits

..

No commits in common. "db763223c6bd9a7f00ddadd2e1ed9f8d529574f1" and "ac1848c48e830a8d08a9184caf8838c33a2f1735" have entirely different histories.

3 changed files with 11 additions and 13 deletions

View File

@ -9,15 +9,9 @@ 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':

View File

@ -87,7 +87,7 @@ html, body {
} }
table { table {
margin: 10; margin: 0 auto;
color: aqua !important; color: aqua !important;
} }
@ -95,8 +95,4 @@ table, th, td {
border: 1px solid; border: 1px solid;
border-collapse: collapse; border-collapse: collapse;
padding: 3px; padding: 3px;
}
th, td {
width: 50%;
} }

View File

@ -21,18 +21,22 @@
</div> </div>
<div id="status" class="row"> <div id="status" class="row">
<!-- <!--
| Auger | rows[0].cells[1] | Auger | rows[0].cells[1] | On Time | rows[0].cells[3] |
| Feed Rate | rows[1].cells[1] | Feed Rate | rows[1].cells[1] | Off Time | rows[1].cells[3] |
--> -->
<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>
@ -112,12 +116,16 @@
// 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':