Fix set feedrate
This commit is contained in:
parent
0834facb54
commit
83c040b800
@ -26,6 +26,8 @@ const config = {
|
|||||||
const psState = new State(config);
|
const psState = new State(config);
|
||||||
const comms = new Communicator(psState);
|
const comms = new Communicator(psState);
|
||||||
|
|
||||||
|
const setFeedRateButton = document.getElementById("set-feed-rate");
|
||||||
|
|
||||||
export function refreshState(doc, state) {
|
export function refreshState(doc, state) {
|
||||||
const igniterStatus = doc.getElementById("igniter-status");
|
const igniterStatus = doc.getElementById("igniter-status");
|
||||||
const exhaustStatus = doc.getElementById("exhaust-status");
|
const exhaustStatus = doc.getElementById("exhaust-status");
|
||||||
@ -74,3 +76,10 @@ window.onload = function() {
|
|||||||
comms.init(psState, config);
|
comms.init(psState, config);
|
||||||
refreshState(window.document, psState);
|
refreshState(window.document, psState);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
setFeedRateButton.addEventListener("click", function() {
|
||||||
|
const feedRate = document.getElementById("feed-rate").value;
|
||||||
|
psState.auger.feedRate = feedRate;
|
||||||
|
comms.send(config.mqtt.topics.auger, JSON.stringify(psState.auger));
|
||||||
|
refreshState(window.document, psState);
|
||||||
|
});
|
@ -72,11 +72,10 @@
|
|||||||
<div class="button-container flex mt-4">
|
<div class="button-container flex mt-4">
|
||||||
<input class="btn bg-gray-700 hover:bg-purple-600 text-white py-2 w-full rounded mx-auto" type="submit" id="stop-btn" value="Shutdown" name="stopButton" onclick="shutdown()">
|
<input class="btn bg-gray-700 hover:bg-purple-600 text-white py-2 w-full rounded mx-auto" type="submit" id="stop-btn" value="Shutdown" name="stopButton" onclick="shutdown()">
|
||||||
</div>
|
</div>
|
||||||
<form action="/" method="post">
|
|
||||||
<!-- Set feed rates -->
|
<!-- Set feed rates -->
|
||||||
<div class="form-group mt-4">
|
<div class="form-group mt-4">
|
||||||
<label for="feedRate" class="block text-sm font-medium text-purple-400">Feed Rate:</label>
|
<label for="feed-rate" class="block text-sm font-medium text-purple-400">Feed Rate:</label>
|
||||||
<select name="feedRate" class="form-control bg-gray-700 text-white mt-1 block w-full rounded border-gray-600 focus:border-purple-500 focus:ring-purple-500 py-2 px-4">
|
<select name="feed-rate" id="feed-rate" class="form-control bg-gray-700 text-white mt-1 block w-full rounded border-gray-600 focus:border-purple-500 focus:ring-purple-500 py-2 px-4">
|
||||||
<option value="500">Low</option>
|
<option value="500">Low</option>
|
||||||
<option value="625">Medium-Low</option>
|
<option value="625">Medium-Low</option>
|
||||||
<option value="750">Medium</option>
|
<option value="750">Medium</option>
|
||||||
@ -85,9 +84,8 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-container flex justify-end mt-4">
|
<div class="button-container flex justify-end mt-4">
|
||||||
<input class="btn bg-purple-600 hover:bg-purple-700 text-white py-2 px-4 rounded w-full" type="submit" id="reload" value="Set Feed Rate" name="reload">
|
<button class="btn bg-purple-600 hover:bg-purple-700 text-white py-2 px-4 rounded w-full" id="set-feed-rate" name="reload">Set Feed Rate</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-center my-8">
|
<div class="text-center my-8">
|
||||||
|
Loading…
Reference in New Issue
Block a user