Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indicate homed status #31

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions www/js/tablet.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ function saveSerialMessages() {
document.body.removeChild(link);
}

// from MINFO command
var maslowStatus = { homed: false, extended: false};

var loadedValues = {};
function tabletShowMessage(msg, collecting) {
if (
Expand All @@ -298,6 +301,21 @@ function tabletShowMessage(msg, collecting) {
return
}

//This keeps track of when we saw the last heartbeat from the machine
if (msg.startsWith('MINFO: ')) {
maslowStatus = JSON.parse(msg.substring(7));
if (maslowStatus.homed) {
id('homed').innerText ='Maslow is Homed ☺';
id('homed').style="color: forestgreen";
} else{
id('homed').innerText = 'NOT HOMED!!!! Must re-zero the belts (remove, retract, extend, reattach, apply tension)';
id('homed').style="color: #c98200";
// TODO: disable movement / loading, etc
console.log("NOT HOMED!")
}
return;
}

//This keeps track of when we saw the last heartbeat from the machine
if(msg.startsWith('[MSG:INFO: Heartbeat')){
lastHeartBeatTime = new Date().getTime();
Expand Down Expand Up @@ -798,6 +816,8 @@ function tabletInit() {
SendRealtimeCmd(0x3f); // ?
// print startup messages in serial
SendPrinterCommand('$SS');
// get maslow info
SendPrinterCommand('$MINFO');
tabletGetFileList('/');
requestModes();
loadConfigValues();
Expand Down Expand Up @@ -1342,6 +1362,10 @@ const onCalibrationButtonsClick = async (command, msg) => {
msgWindow.textContent = text
msgWindow.scrollTop = msgWindow.scrollHeight
}

if (command != '$MINFO') {
setTimeout(() => {sendCommand('$MINFO');}, 1000)
}
}

/* Calibration modal END */
22 changes: 21 additions & 1 deletion www/sub/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,28 @@
<span translate>FluidNC</span>
</button>
<button class="tablinks" onclick="opentab(event, 'tablettab', 'mainuitabscontent', 'mainuitablinks')" id="tablettablink">
<span>Maslow</span>
<svg width="2em" height="1.5em" viewBox="40 40 150 150">
<g id="Badge">
<path fill="currentColor" stroke="white" stroke-miterlimit="10" d="M125.458,44.447c-40.212,0-72.81,32.598-72.81,72.811
s32.598,72.811,72.81,72.811c40.213,0,72.81-32.598,72.81-72.811S165.671,44.447,125.458,44.447z M163.618,147.79
c-0.504,0.635-1.226,1.058-2.026,1.188c-9.372,1.516-16.004-0.435-19.718-5.795c-5.158-7.445-3.067-20.328,1.025-32.651
l-29.267,41.573c-0.625,0.889-1.628,1.381-2.659,1.381c-0.449,0-0.903-0.094-1.334-0.288c-1.42-0.642-2.187-2.2-1.826-3.716
l12.131-50.945L90.9,141.727c7.914,11.304,20.688,18.008,34.558,18.008c8.729,0,17.104-2.642,24.22-7.639
c1.468-1.031,3.496-0.677,4.527,0.793c1.031,1.469,0.677,3.495-0.792,4.526c-8.215,5.771-17.882,8.819-27.955,8.819
c-15.172,0-29.206-6.957-38.405-18.789l-0.51,0.76c-1.002,1.49-3.021,1.885-4.51,0.883c-1.49-1.001-1.885-3.021-0.883-4.51
l43.418-64.563c0.876-1.304,2.56-1.793,4.001-1.164c1.439,0.631,2.222,2.201,1.857,3.73l-12.37,51.95l34.64-49.206
c-7.611-6.45-17.175-9.981-27.237-9.981c-23.267,0-42.195,18.929-42.195,42.195c0,4.604,0.736,9.13,2.189,13.453
c0.572,1.701-0.344,3.544-2.045,4.115c-0.343,0.117-0.692,0.17-1.036,0.17c-1.357,0-2.624-0.856-3.08-2.215
c-1.677-4.99-2.528-10.213-2.528-15.523c0-26.851,21.845-48.695,48.695-48.695c11.418,0,22.279,3.941,30.991,11.149l0.954-1.355
c0.999-1.42,2.936-1.804,4.401-0.872c1.464,0.931,1.939,2.849,1.078,4.355c-9.684,16.942-22.5,47.497-15.664,57.361
c2.027,2.925,6.089,4.021,12.084,3.26c5.468-7.317,8.351-16.003,8.351-25.204c0-8.116-2.31-15.997-6.68-22.792
c-0.971-1.509-0.534-3.521,0.976-4.491c1.51-0.971,3.521-0.534,4.491,0.976c5.046,7.845,7.713,16.942,7.713,26.307
C174.154,128.646,170.511,139.107,163.618,147.79z" />
</g>
</svg>
<span><span id="homed">Maslow homed status unknown</span></span>
</button>

</div>

<ul class="nav navbar-nav navbar-right">
Expand Down
2 changes: 1 addition & 1 deletion www/sub/tablettab.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
<div class="buttons-row">
<button class="calibration-modal-button" onclick="onCalibrationButtonsClick('$ALL','Retract All');">Retract All</button>
<span class="arrow">&#8594;</span>
<button class="calibration-modal-button" onclick="onCalibrationButtonsClick('$EXT','Extend All');">Extend All</button>>
<button class="calibration-modal-button" onclick="onCalibrationButtonsClick('$EXT','Extend All');">Extend All</button>
<div class="buttons-row-col-el">
<span class="arrow">&#8599;</span>
<span class="arrow">&#8600;</span>
Expand Down