Skip to content

Commit

Permalink
Add invert X / invert_Y / Invert_Z and swap x y
Browse files Browse the repository at this point in the history
  • Loading branch information
luc-github committed Apr 20, 2023
1 parent 348196e commit 9161f40
Show file tree
Hide file tree
Showing 24 changed files with 200 additions and 26 deletions.
Binary file modified index.html.gz
Binary file not shown.
Binary file modified languages/de/index.html.gz
Binary file not shown.
Binary file modified languages/en/index.html.gz
Binary file not shown.
Binary file modified languages/es/index.html.gz
Binary file not shown.
Binary file modified languages/fr/index.html.gz
Binary file not shown.
Binary file modified languages/grbl/index.html.gz
Binary file not shown.
Binary file modified languages/hu/index.html.gz
Binary file not shown.
Binary file modified languages/it/index.html.gz
Binary file not shown.
Binary file modified languages/ja/index.html.gz
Binary file not shown.
Binary file modified languages/multi/index.html.gz
Binary file not shown.
Binary file modified languages/pl/index.html.gz
Binary file not shown.
Binary file modified languages/ptbr/index.html.gz
Binary file not shown.
Binary file modified languages/ru/index.html.gz
Binary file not shown.
Binary file modified languages/tr/index.html.gz
Binary file not shown.
Binary file modified languages/uk/index.html.gz
Binary file not shown.
Binary file modified languages/zh_CN/index.html.gz
Binary file not shown.
Binary file modified languages/zh_TW/index.html.gz
Binary file not shown.
42 changes: 21 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion www/images/jogdial.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
var target_firmware = "";
</script>
<script>
var web_ui_version = "2.1.2b0";
var web_ui_version = "2.1.3b0";
</script>
<script>
var direct_sd = false;
Expand Down
26 changes: 26 additions & 0 deletions www/js/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,31 @@ function SendZerocommand(cmd) {

function SendJogcommand(cmd, feedrate) {
if (document.getElementById('lock_UI').checked) return;
if (preferenceslist[0].swap_x_y=="true") {
if (cmd.indexOf("X") > -1) {
cmd = cmd.replace("X", "Y");
} else if (cmd.indexOf("Y") > -1) {
cmd = cmd.replace("Y", "X");
}
}
if (preferenceslist[0].invert_x=="true") {
if (cmd.indexOf("X") > -1) {
if (cmd.indexOf("X-") > -1) cmd = cmd.replace("X-", "X");
else cmd = cmd.replace("X", "X-");
}
}
if (preferenceslist[0].invert_y=="true") {
if (cmd.indexOf("Y") > -1) {
if (cmd.indexOf("Y-") > -1) cmd = cmd.replace("Y-", "Y");
else cmd = cmd.replace("Y", "Y-");
}
}
if (preferenceslist[0].invert_z=="true") {
if (cmd.indexOf("Z") > -1 ) {
if (cmd.indexOf("Z-") > -1) cmd = cmd.replace("Z-", "Z");
else cmd = cmd.replace("Z", "Z-");
}
}
var feedratevalue = "";
var command = "";
if (feedrate == "XYfeedrate") {
Expand Down Expand Up @@ -216,6 +241,7 @@ function SendJogcommand(cmd, feedrate) {
command = "$J=G91 G21 F" + feedratevalue + " " + cmd;
console.log(command);
} else command = "G91\nG1 " + cmd + " F" + feedratevalue + "\nG90";
console.log(command);
SendPrinterCommand(command, true, get_Position);
}

Expand Down
9 changes: 7 additions & 2 deletions www/js/grbl.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,13 @@ function build_axis_selection(){

function control_changeaxis(){
var letter = document.getElementById('control_select_axis').value;
document.getElementById('axisup').innerHTML = '+'+letter;
document.getElementById('axisdown').innerHTML = '-'+letter;
if (letter== "Z" && preferenceslist[0].invert_z === 'true') {
document.getElementById('axisup').innerHTML = '-'+letter;
document.getElementById('axisdown').innerHTML = '+'+letter;
} else {
document.getElementById('axisup').innerHTML = '+'+letter;
document.getElementById('axisdown').innerHTML = '-'+letter;
}
document.getElementById('homeZlabel').innerHTML = ' '+letter+' ';
switch(last_axis_letter) {
case "Z":
Expand Down
121 changes: 120 additions & 1 deletion www/js/preferencesdlg.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ var defaultpreferenceslist = "[{\
\"interval_positions\":\"3\",\
\"interval_temperatures\":\"3\",\
\"interval_status\":\"3\",\
\"swap_x_y\":\"false\",\
\"invert_x\":\"false\",\
\"invert_y\":\"false\",\
\"invert_z\":\"false\",\
\"xy_feedrate\":\"1000\",\
\"z_feedrate\":\"100\",\
\"a_feedrate\":\"100\",\
Expand Down Expand Up @@ -75,6 +79,10 @@ function initpreferences() {
\"interval_positions\":\"3\",\
\"interval_temperatures\":\"3\",\
\"interval_status\":\"3\",\
\"swap_x_y\":\"false\",\
\"invert_x\":\"false\",\
\"invert_y\":\"false\",\
\"invert_z\":\"false\",\
\"xy_feedrate\":\"1000\",\
\"z_feedrate\":\"100\",\
\"a_feedrate\":\"100\",\
Expand Down Expand Up @@ -132,6 +140,10 @@ function initpreferences() {
\"interval_positions\":\"3\",\
\"interval_temperatures\":\"3\",\
\"interval_status\":\"3\",\
\"swap_x_y\":\"false\",\
\"invert_x\":\"false\",\
\"invert_y\":\"false\",\
\"invert_z\":\"false\",\
\"xy_feedrate\":\"1000\",\
\"z_feedrate\":\"100\",\
\"a_feedrate\":\"100\",\
Expand Down Expand Up @@ -424,6 +436,7 @@ function applypreferenceslist() {
document.getElementById('controlPanel').style.display = 'none';
on_autocheck_position(false);
}

if (preferenceslist[0].enable_verbose_mode === 'true') {
document.getElementById('monitor_enable_verbose_mode').checked = true;
Monitor_check_verbose_mode();
Expand Down Expand Up @@ -468,8 +481,82 @@ function applypreferenceslist() {
document.getElementById('files_refresh_btn').style.display = 'none';
document.getElementById('print_upload_btn').style.display = 'none';
document.getElementById('files_createdir_btn').style.display = "none";
}
if (document.getElementById('plusX')) {
if (preferenceslist[0].swap_x_y == 'true') {
if (preferenceslist[0].invert_y == 'true') {
document.getElementById('plusX').innerHTML = " -Y ";
} else {
document.getElementById('plusX').innerHTML = " +Y ";
}
} else {
if (preferenceslist[0].invert_x === 'true') {
document.getElementById('plusX').innerHTML = " -X ";
} else {
document.getElementById('plusX').innerHTML = " +X ";
}
}
}
if (document.getElementById('plusY')) {
if (preferenceslist[0].swap_x_y == 'true') {
if (preferenceslist[0].invert_x == 'true') {
document.getElementById('plusY').innerHTML = " -X ";
} else {
document.getElementById('plusY').innerHTML = " +X ";
}
} else {
if (preferenceslist[0].invert_y == 'true') {
document.getElementById('plusY').innerHTML = " -Y ";
} else {
document.getElementById('plusY').innerHTML = " +Y ";
}
}
}
if(document.getElementById('axisup')){
if (preferenceslist[0].invert_z == 'true') {
document.getElementById('axisup').innerHTML = "&nbsp;-Z";
} else {
document.getElementById('axisup').innerHTML=" +Z ";
}
}
if (document.getElementById('minusX')) {
if (preferenceslist[0].swap_x_y == 'true') {
if (preferenceslist[0].invert_y === 'true') {
document.getElementById('minusX').innerHTML = " +Y ";
} else {
document.getElementById('minusX').innerHTML = " -Y ";
}
} else { if (preferenceslist[0].invert_x == 'true') {
document.getElementById('minusX').innerHTML = " +X ";
} else {
document.getElementById('minusX').innerHTML = " -X ";
}}

}
if (document.getElementById('minusY')) {
if (preferenceslist[0].swap_x_y == 'true') {
console.log("Minus Y need to swap to X")
if (preferenceslist[0].invert_x == 'true') {
console.log("Minus Y need to invert X")
document.getElementById('minusY').innerHTML = " +X ";
} else {
document.getElementById('minusY').innerHTML = " -X ";
}
} else {
if (preferenceslist[0].invert_y == 'true') {
document.getElementById('minusY').innerHTML = " +Y ";
} else {
document.getElementById('minusY').innerHTML = " -Y ";
}
}
}
if(document.getElementById('axisdown')){
if (preferenceslist[0].invert_z == 'true') {
document.getElementById('axisdown').innerHTML="+Z";
} else {
document.getElementById('axisdown').innerHTML=" -Z ";
}
}
if (preferenceslist[0].enable_commands_panel === 'true') {
document.getElementById('commandsPanel').style.display = 'flex';
if (preferenceslist[0].enable_autoscroll === 'true') {
Expand Down Expand Up @@ -644,6 +731,22 @@ function build_dlg_preferences_list() {
if (typeof(preferenceslist[0].interval_status) !== 'undefined') {
document.getElementById('preferences_status_Interval_check').value = parseInt(preferenceslist[0].interval_status);
} else document.getElementById('preferences_status_Interval_check').value = parseInt(default_preferenceslist[0].interval_status);
//Swap X Y
if (typeof (preferenceslist[0].swap_x_y) !== 'undefined') {
document.getElementById('preferences_swap_x_y').checked = (preferenceslist[0].swap_x_y === 'true');
} else document.getElementById('preferences_swap_x_y').checked = false;
//Invert X
if (typeof (preferenceslist[0].invert_x) !== 'undefined') {
document.getElementById('preferences_invert_x').checked = (preferenceslist[0].invert_x === 'true');
} else document.getElementById('preferences_invert_x').checked = false;
//Invert Y
if (typeof (preferenceslist[0].invert_y) !== 'undefined') {
document.getElementById('preferences_invert_y').checked = (preferenceslist[0].invert_y === 'true');
} else document.getElementById('preferences_invert_y').checked = false;
//Invert Z
if (typeof (preferenceslist[0].invert_z) !== 'undefined') {
document.getElementById('preferences_invert_z').checked = (preferenceslist[0].invert_z === 'true');
} else document.getElementById('preferences_invert_z').checked = false;
//xy feedrate
if (typeof(preferenceslist[0].xy_feedrate) !== 'undefined') {
document.getElementById('preferences_control_xy_velocity').value = parseInt(preferenceslist[0].xy_feedrate);
Expand Down Expand Up @@ -784,7 +887,11 @@ function closePreferencesDialog() {
(typeof(preferenceslist[0].enable_probe) === 'undefined') ||
(typeof(preferenceslist[0].enable_bed) === 'undefined') ||
(typeof(preferenceslist[0].enable_chamber) === 'undefined') ||
(typeof(preferenceslist[0].enable_fan) === 'undefined') ||
(typeof (preferenceslist[0].enable_fan) === 'undefined') ||
(typeof(preferenceslist[0].swap_x_y) === 'undefined') ||
(typeof(preferenceslist[0].invert_x) === 'undefined') ||
(typeof(preferenceslist[0].invert_y) === 'undefined') ||
(typeof(preferenceslist[0].invert_z) === 'undefined') ||
(typeof(preferenceslist[0].xy_feedrate) === 'undefined') ||
(typeof(preferenceslist[0].z_feedrate) === 'undefined') ||
(typeof(preferenceslist[0].e_feedrate) === 'undefined') ||
Expand Down Expand Up @@ -888,6 +995,14 @@ function closePreferencesDialog() {
}
//interval temperatures
if (document.getElementById('preferences_tempInterval_check').value != parseInt(preferenceslist[0].interval_temperatures)) modified = true;
//swap x y
if (document.getElementById('preferences_swap_x_y').checked != (preferenceslist[0].swap_x_y === 'true')) modified = true;
//invert x
if (document.getElementById('preferences_invert_x').checked != (preferenceslist[0].invert_x === 'true')) modified = true;
//invert y
if (document.getElementById('preferences_invert_y').checked != (preferenceslist[0].invert_y === 'true')) modified = true;
//invert z
if (document.getElementById('preferences_invert_z').checked != (preferenceslist[0].invert_z === 'true')) modified = true;
//e feedrate
if (document.getElementById('preferences_e_velocity').value != parseInt(preferenceslist[0].e_feedrate)) modified = true;
//e distance
Expand Down Expand Up @@ -987,6 +1102,10 @@ function SavePreferences(current_preferences) {
saveprefs += "\",\"enable_bed\":\"" + document.getElementById('enable_bed_controls').checked;
saveprefs += "\",\"enable_chamber\":\"" + document.getElementById('enable_chamber_controls').checked;
saveprefs += "\",\"enable_fan\":\"" + document.getElementById('enable_fan_controls').checked;
saveprefs += "\",\"swap_x_y\":\"" + document.getElementById('preferences_swap_x_y').checked;
saveprefs += "\",\"invert_x\":\"" + document.getElementById('preferences_invert_x').checked;
saveprefs += "\",\"invert_y\":\"" + document.getElementById('preferences_invert_y').checked;
saveprefs += "\",\"invert_z\":\"" + document.getElementById('preferences_invert_z').checked;
saveprefs += "\",\"enable_control_panel\":\"" + document.getElementById('show_control_panel').checked;
saveprefs += "\",\"enable_grbl_probe_panel\":\"" + document.getElementById('show_grbl_probe_tab').checked;
saveprefs += "\",\"enable_grbl_surface_panel\":\"" + document.getElementById('show_grbl_surface_tab').checked;
Expand Down
24 changes: 24 additions & 0 deletions www/sub/preferencesdlg.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,30 @@ <h3>
</table>

</div>
<div class="checkbox" id="swap_x_y_control" style="display: block;">
<label>
<input type="checkbox" id="preferences_swap_x_y" />
<span translate>Swap X Y</span>
</label>
</div>
<div class="checkbox" id="invert_x_control" style="display: block;">
<label>
<input type="checkbox" id="preferences_invert_x" />
<span translate>Invert X</span>
</label>
</div>
<div class="checkbox" id="invert_x_control" style="display: block;">
<label>
<input type="checkbox" id="preferences_invert_y" />
<span translate>Invert Y</span>
</label>
</div>
<div class="checkbox" id="invert_x_control" style="display: block;">
<label>
<input type="checkbox" id="preferences_invert_z" />
<span translate>Invert Z</span>
</label>
</div>
<br>
<div id="preferences_control_xy_velocity_group">
<table>
Expand Down

0 comments on commit 9161f40

Please sign in to comment.