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

Move z axis buttons out to main window #41

Merged
merged 7 commits into from
Jul 10, 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
2 changes: 1 addition & 1 deletion www/css/tablet.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ html {
color: #7a7a7a;
margin: 0 auto;
display: grid;
grid-template-columns: 75% 25%;
grid-template-columns: 70% 30%;
}

.maslow-grid-container {
Expand Down
3 changes: 2 additions & 1 deletion www/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ function initUI() {
if (typeof id('FW_VERSION') != 'undefined') id('FW_VERSION').innerHTML = fw_version
// Get the element with id="defaultOpen" and click on it
id('tablettablink').click()
onReportType({ value: 'auto' })

if (typeof id('grblcontroltablink') !== 'undefined') {
id('grblcontroltablink').click()
Expand All @@ -405,6 +404,8 @@ function initUI() {
console.log(JSON.stringify(translated_list))
//endRemoveIf(production)
initUI_2()

setTimeout(tryAutoReport, 500); //Not sure why this needs a delay but it seems like a hack
}

function initUI_2() {
Expand Down
20 changes: 5 additions & 15 deletions www/js/tablet.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ checkHomed = function () {
}

sendMove = function (cmd) {
console.log("Send move called");
tabletClick()
var jog = function (params) {
params = params || {}
Expand All @@ -251,8 +252,9 @@ sendMove = function (cmd) {
}

var distance = Number(id('disM').innerText) || 0
if (cmd.includes('Z')) {
distance = Number(id('disZ').innerText) || 0

if (cmd.includes('Z') && distance > 75) {
alert("Can't move the z-axis that far");
}

var fn = {
Expand Down Expand Up @@ -486,7 +488,7 @@ function tabletShowMessage(msg, collecting) {
if (msg.startsWith('error:')) {
const msgExtra = {
"8": " - Command requires idle state. Unlock machine?",
"152": " - Configuration is invalid. Maslow.yaml file may be corrupt. Try restarting",
"152": " - Configuration is invalid. Maslow.yaml file may be corrupt. Turning off and back on again can often fix this issue.",
"153": " - Configuration is invalid. ESP32 probably did a panic reset. Config changes cannot be saved. Try restarting",
};

Expand Down Expand Up @@ -1195,7 +1197,6 @@ window.addEventListener('keydown', handleKeyDown)
window.addEventListener('keyup', handleKeyUp)

numpad.attach({ target: 'disM', axis: 'D' })
numpad.attach({ target: 'disZ', axis: 'Z' })
//numpad.attach({target: "wpos-y", axis: "Y"});
//numpad.attach({target: "wpos-z", axis: "Z"});
//numpad.attach({target: "wpos-a", axis: "A"});
Expand Down Expand Up @@ -1250,10 +1251,6 @@ function fullscreenIfMobile() {
}
}

function showZaxisPopup() {
document.getElementById('z-axis-popup').style.display = 'block'
}

function showCalibrationPopup() {
document.getElementById('calibration-popup').style.display = 'block'
}
Expand Down Expand Up @@ -1282,13 +1279,6 @@ function homeZ() {
}

document.addEventListener('click', function (event) {
if (
!document.getElementById('z-axis-popup').contains(event.target) &&
!document.getElementById('zBtn').contains(event.target) &&
!document.getElementById('numPad').contains(event.target)
) {
document.getElementById('z-axis-popup').style.display = 'none'
}
if (
!document.getElementById('calibration-popup').contains(event.target) &&
!document.getElementById('calibrationBTN').contains(event.target) &&
Expand Down
73 changes: 34 additions & 39 deletions www/sub/tablettab.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,18 @@
</textarea>
</div>
<div class = "tablettab-controls-wrapper">
<div style="grid-template-columns: 25% 25% 25% 25%;" class="maslow-grid-container tablettab-controls-item">
<div class="maslow-grid-item maslow-grid-item-btn" onclick="sendMove('X-Y+')" style="background-color: #b69fcb;">
<canvas id="tlBtn" style="width: 100%; height: 100%"></canvas>
<div style="grid-template-columns: 20% 20% 20% 20% 20%;" class="maslow-grid-container tablettab-controls-item">
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #f2f0e4;; color: #337ab7"
onclick="sendMove('Z+');" id="zUp">
<svg width="32" height="32" viewBox="0 0 38 38">
<polygon fill="currentColor" points="10.319 5.525 17.833 13.039 2.805 13.039 10.319 5.525" />
<rect fill="currentColor" height="2.5" transform="translate(31.899 11.262) rotate(90)" width="21.79" x="-0.576" y="20.33" />
</svg>
Z
</div>
<div class="maslow-grid-item maslow-grid-item-btn" onclick="sendMove('X-Y+')" style="background-color: #b69fcb;"><canvas id="tlBtn" style="width: 100%; height: 100%"></canvas></div>
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #9d88c0;" onclick="sendMove('Y+')"><canvas id="upBtn" style="width: 100%; height: 100%"></canvas></div>
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #b69fcb;" onclick="sendMove('X+Y+')"><canvas id="trBtn" style="width: 100%; height: 100%"></canvas></div>
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #337ab7; color: white; height: 50px;display: flex;flex-direction: column;"
onclick="files_select_upload()">
<svg width="1.3em" height="1.2em" viewBox="0 0 1792 1792" fill="currentColor">
<g>
<path d="M1344 1472q0-26-19-45t-45-19-45 19-19 45 19 45 45 19 45-19 19-45zm256 0q0-26-19-45t-45-19-45 19-19 45 19 45 45 19 45-19 19-45zm128-224v320q0 40-28 68t-68 28h-1472q-40 0-68-28t-28-68v-320q0-40 28-68t68-28h427q21 56 70.5 92t110.5 36h256q61 0 110.5-36t70.5-92h427q40 0 68 28t28 68zm-325-648q-17 40-59 40h-256v448q0 26-19 45t-45 19h-256q-26 0-45-19t-19-45v-448h-256q-42 0-59-40-17-39 14-69l448-448q18-19 45-19t45 19l448 448q31 30 14 69z"/>
</g>
</svg>
<span>Upload GCode</span>
</div>
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #9d88c0;" onclick="sendMove('X-')"><canvas id="lBtn" style="width: 100%; height: 100%"></div>
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #f2f0e4;" onclick="moveHome()"><canvas id="hBtn" style="width: 100%; height: 100%"></div>
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #9d88c0;" onclick="sendMove('X+')"><canvas id="rBtn" style="width: 100%; height: 100%"></div>
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #f2f0e4; font-size: 1vw; color: #337ab7; display: flex;flex-direction: column;"
onclick="loadCornerValues(); openModal('calibration-popup');" id="calibrationBTN" >
<svg height="32" width="32" viewBox="0 0 48 48" fill="currentColor">
Expand All @@ -35,30 +29,47 @@
</svg>
<span>Setup</span>
</div>
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #b69fcb;" onclick="sendMove('X-Y-')"> <canvas id="blBtn" style="width: 100%; height: 100%"></canvas> </div>
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #9d88c0;" onclick="sendMove('Y-')"><canvas id="dnBtn" style="width: 100%; height: 100%"></div>
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #b69fcb;" onclick="sendMove('X+Y-')"> <canvas id="brBtn" style="width: 100%; height: 100%"></canvas> </div>
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #f2f0e4;; color: #337ab7"
onclick="openModal('z-axis-popup');" id="zBtn">
onclick="sendMove('Z-');" id="zDown">
<svg width="32" height="32" viewBox="0 0 38 38">
<polygon fill="currentColor" points="10.319 5.525 17.833 13.039 2.805 13.039 10.319 5.525" />
<rect fill="currentColor" height="2.5" transform="translate(31.899 11.262) rotate(90)" width="21.79" x="-0.576" y="20.33" />
<polygon fill="currentColor" points="27.681 32.475 35.195 24.961 20.167 24.961 27.681 32.475" />
<rect fill="currentColor" height="2.5" transform="translate(11.262 44.101) rotate(-90)" width="21.79" x="16.786" y="15.17" />
</svg>
Z
</div>
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #9d88c0;" onclick="sendMove('X-')"><canvas id="lBtn" style="width: 100%; height: 100%"></div>
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #f2f0e4;" onclick="moveHome()"><canvas id="hBtn" style="width: 100%; height: 100%"></div>
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #9d88c0;" onclick="sendMove('X+')"><canvas id="rBtn" style="width: 100%; height: 100%"></div>
<div class="maslow-grid-item maslow-grid-item-btn"></div>

<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #f2f0e4;"
onmousedown="zeroAxis('Z');" onmouseup="refreshGcode();">Define Z Home</div>
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #b69fcb;" onclick="sendMove('X-Y-')"> <canvas id="blBtn" style="width: 100%; height: 100%"></canvas> </div>
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #9d88c0;" onclick="sendMove('Y-')"><canvas id="dnBtn" style="width: 100%; height: 100%"></div>
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #b69fcb;" onclick="sendMove('X+Y-')"> <canvas id="brBtn" style="width: 100%; height: 100%"></canvas> </div>
<div class="maslow-grid-item maslow-grid-item-btn"></div>

<div class="maslow-grid-item maslow-grid-item-btn">Dist To Move:</div>
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #f2f0e4;" id="disM">100</div>
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #f2f0e4;" id="units" title="Toggle Units"
onclick="toggleUnits()">mm</div>
<div class="maslow-grid-item maslow-grid-item-btn" id="defineHomeBTN" style="background-color: #f2f0e4;"
onmousedown="setHomeClickDown();" onmouseup="setHomeClickUp();">Define Home</div>
onmousedown="setHomeClickDown();" onmouseup="setHomeClickUp();">Define XY Home</div>
<div class="maslow-grid-item maslow-grid-item-btn"></div>
</div>
<div class="maslow-grid-container tablettab-controls-item" style="height: 60px;">
<div style="grid-template-columns: 80% 20%;" class="maslow-grid-container tablettab-controls-item" style="height: 60px;">
<select class="form-control" id="filelist" onchange="selectFile()">
<option>Load File...</option>
</select>
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #337ab7; color: white; height: 50px;display: flex;flex-direction: column;"
onclick="files_select_upload()">
<svg width="1.3em" height="1.2em" viewBox="0 0 1792 1792" fill="currentColor">
<g>
<path d="M1344 1472q0-26-19-45t-45-19-45 19-19 45 19 45 45 19 45-19 19-45zm256 0q0-26-19-45t-45-19-45 19-19 45 19 45 45 19 45-19 19-45zm128-224v320q0 40-28 68t-68 28h-1472q-40 0-68-28t-28-68v-320q0-40 28-68t68-28h427q21 56 70.5 92t110.5 36h256q61 0 110.5-36t70.5-92h427q40 0 68 28t28 68zm-325-648q-17 40-59 40h-256v448q0 26-19 45t-45 19h-256q-26 0-45-19t-19-45v-448h-256q-42 0-59-40-17-39 14-69l448-448q18-19 45-19t45 19l448 448q31 30 14 69z"/>
</g>
</svg>
<span>Upload GCode</span>
</div>
</div>
<div class="maslow-grid-container tablettab-controls-item" style="grid-template-columns: 33% 33% 33%;">
<div class="maslow-grid-item maslow-grid-item-btn" style="background-color: #4aa85c;" onclick="doPlayButton()">
Expand Down Expand Up @@ -104,22 +115,6 @@

</div>

<div id="z-axis-popup" class="calibration-modal-container" onclick="hideModal('z-axis-popup')">
<div class="calibration-modal-content" onclick="event.stopPropagation();">
<div class="calibration-modal-button-container">
<div class="buttons-row">
<div class="calibration-modal-info" id = "disZ"> 1.00</div>
<button class="calibration-modal-button" onclick="sendMove('Z+')"> Up</button>
</div>
<div class="buttons-row">
<button class="calibration-modal-button" onclick="zeroAxis('Z')"> Define Home</button>
<button class="calibration-modal-button" onclick="sendMove('Z-')"> Down</button>
</div>

</div>
</div>
</div>

<div id="calibration-popup" class="calibration-modal-container" onclick="hideModal('calibration-popup')">
<div class="calibration-modal-content" onclick="event.stopPropagation();">
<div class="calibration-modal-button-container">
Expand Down