Skip to content

Commit 1804f02

Browse files
authored
Merge pull request #69 from luc-github/grbl_6axis
6axis support for grbl_esp32
2 parents 28c4af0 + 101ef3e commit 1804f02

File tree

12 files changed

+483
-89
lines changed

12 files changed

+483
-89
lines changed

index.html.gz

1.59 KB
Binary file not shown.

www/css/style.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ body {
6262
z-index: 2;
6363
}
6464

65+
.topmarginspace {
66+
margin-top: 20px
67+
}
68+
6569
.loader {
6670
border: 4px solid #f3f3f3;
6771
/* Light grey */
@@ -402,4 +406,4 @@ w25 {
402406
text-align: center;
403407
}
404408

405-
.button_txt {}
409+
.button_txt {}

www/images/jogdial.svg

Lines changed: 3 additions & 3 deletions
Loading

www/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
var target_firmware = "";
1111
</script>
1212
<script>
13-
var web_ui_version = "2.1b44";
13+
var web_ui_version = "2.1b45";
1414
</script>
1515
<script>
1616
var direct_sd = false;

www/js/app.js

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ function update_UI_firmware_target() {
310310
document.getElementById('control_y_position_label').innerHTML = "Y";
311311
document.getElementById('control_z_position_label').innerHTML = "Z";
312312
document.getElementById('config_smoothie_nav').style.display = 'none';
313+
showAxiscontrols();
313314
if (target_firmware == "repetier") {
314315
fwName = "Repetier";
315316
document.getElementById('configtablink').style.display = 'block';
@@ -370,13 +371,45 @@ function update_UI_firmware_target() {
370371
document.getElementById('zero_xyz_btn').style.display = 'block';
371372
document.getElementById('zero_x_btn').style.display = 'block';
372373
document.getElementById('zero_y_btn').style.display = 'block';
373-
document.getElementById('zero_z_btn').style.display = 'block';
374+
if (grblaxis >2) {
375+
//document.getElementById('control_z_position_display').style.display = 'block';
376+
document.getElementById('control_z_position_label').innerHTML = "Zw";
377+
document.getElementById('zero_xyz_btn_txt').innerHTML +="Z";
378+
grblzerocmd += " Z0";
379+
380+
} else {
381+
hideAxiscontrols();
382+
document.getElementById('preferences_control_z_velocity_group').style.display = 'none';
383+
}
384+
if (grblaxis >3) {
385+
386+
document.getElementById('zero_xyz_btn_txt').innerHTML +="A";
387+
grblzerocmd += " A0";
388+
build_axis_selection();
389+
document.getElementById('preferences_control_a_velocity_group').style.display = 'block';
390+
document.getElementById('positions_labels2').style.display = 'inline-grid';
391+
document.getElementById('control_a_position_display').style.display = 'block';
392+
}
393+
if (grblaxis >4) {
394+
document.getElementById('control_b_position_display').style.display = 'block';
395+
document.getElementById('zero_xyz_btn_txt').innerHTML +="B";
396+
grblzerocmd += " B0";
397+
document.getElementById('preferences_control_b_velocity_group').style.display = 'block';
398+
}
399+
if (grblaxis >5) {
400+
document.getElementById('control_c_position_display').style.display = 'block';
401+
document.getElementById('zero_xyz_btn_txt').innerHTML +="C";
402+
document.getElementById('preferences_control_c_velocity_group').style.display = 'block';
403+
404+
} else {
405+
document.getElementById('control_c_position_display').style.display = 'none';
406+
}
374407
document.getElementById('grblPanel').style.display = 'flex';
375408
document.getElementById('FW_github').href = 'https://github.com/bdring/Grbl_Esp32';
376409
document.getElementById('settings_filters').style.display = 'none';
377410
document.getElementById('control_x_position_label').innerHTML = "Xw";
378411
document.getElementById('control_y_position_label').innerHTML = "Yw";
379-
document.getElementById('control_z_position_label').innerHTML = "Zw";
412+
380413

381414
} else if (target_firmware == "marlin-embedded") {
382415
fwName = "Marlin ESP32";

www/js/config.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,15 +532,27 @@ var grbl_help = {
532532
"$100": "X steps/mm",
533533
"$101": "Y steps/mm",
534534
"$102": "Z steps/mm",
535+
"$103": "A steps/mm",
536+
"$104": "B steps/mm",
537+
"$105": "C steps/mm",
535538
"$110": "X Max rate, mm/min",
536539
"$111": "Y Max rate, mm/min",
537540
"$112": "Z Max rate, mm/min",
541+
"$113": "A Max rate, mm/min",
542+
"$114": "B Max rate, mm/min",
543+
"$115": "C Max rate, mm/min",
538544
"$120": "X Acceleration, mm/sec^2",
539545
"$121": "Y Acceleration, mm/sec^2",
540546
"$122": "Z Acceleration, mm/sec^2",
547+
"$123": "A Acceleration, mm/sec^2",
548+
"$124": "B Acceleration, mm/sec^2",
549+
"$125": "C Acceleration, mm/sec^2",
541550
"$130": "X Max travel, mm",
542551
"$131": "Y Max travel, mm",
543-
"$132": "Z Max travel, mm"
552+
"$132": "Z Max travel, mm",
553+
"$133": "A Max travel, mm",
554+
"$134": "B Max travel, mm",
555+
"$135": "C Max travel, mm"
544556

545557
};
546558

@@ -580,4 +592,4 @@ function getESPconfigfailed(error_code, response) {
580592
document.getElementById('config_status').style.display = "block";
581593
document.getElementById('config_status').innerHTML = translate_text_item("Failed:") + error_code + " " + response;
582594
document.getElementById('config_refresh_btn').style.display = "block";
583-
}
595+
}

www/js/connectdlg.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,14 @@ function getFWdata(response) {
7878
sublist = tlist[7].split(":");
7979
if (sublist[0].trim() == "hostname") esp_hostname = sublist[1].trim();
8080
}
81-
81+
82+
if ((target_firmware == "grbl-embedded") && (tlist.length > 8)) {
83+
sublist = tlist[8].split(":");
84+
if (sublist[0].trim() == "axis") {
85+
grblaxis = parseInt(sublist[1].trim());
86+
}
87+
}
88+
8289
if (async_webcommunication) {
8390
if (!!window.EventSource) {
8491
event_source = new EventSource('/events');
@@ -122,4 +129,4 @@ function retryconnect() {
122129
document.getElementById('connecting_msg').style.display = 'block';
123130
var url = "/command?plain=" + encodeURIComponent("[ESP800]");;
124131
SendGetHttp(url, connectsuccess, connectfailed)
125-
}
132+
}

www/js/controls.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
var interval_position = -1;
22
var control_macrolist = [];
33

4+
45
function init_controls_panel() {
56
loadmacrolist();
67
}
78

8-
function hideZcontrols() {
9+
function hideAxiscontrols() {
910
document.getElementById('JogBar').style.display = 'none';
1011
document.getElementById('HomeZ').style.display = 'none';
1112
document.getElementById('CornerZ').style.display = 'block';
@@ -14,7 +15,7 @@ function hideZcontrols() {
1415
document.getElementById('z_velocity_display').style.display = 'none';
1516
}
1617

17-
function showZcontrols() {
18+
function showAxiscontrols() {
1819
document.getElementById('CornerZ').style.display = 'none';
1920
document.getElementById('JogBar').style.display = 'block';
2021
document.getElementById('HomeZ').style.display = 'block';
@@ -168,7 +169,9 @@ function SendHomecommand(cmd) {
168169
break;
169170

170171
case 'G28 Z0':
171-
cmd = '$HZ';
172+
if (grblaxis > 3) {
173+
cmd = '$H' + document.getElementById('control_select_axis').value;
174+
} else cmd = '$HZ';
172175
break;
173176
default:
174177
cmd = '$H';
@@ -198,12 +201,18 @@ function SendJogcommand(cmd, feedrate) {
198201
} else {
199202
feedratevalue = parseInt(document.getElementById('control_z_velocity').value);
200203
if (feedratevalue < 1 || isNaN(feedratevalue) || (feedratevalue === null)) {
201-
alertdlg(translate_text_item("Out of range"), translate_text_item("Z Feedrate value must be at least 1 mm/min!"));
204+
var letter = "Z";
205+
if ((target_firmware == "grbl-embedded") && (grblaxis > 3)) letter = "Axis";
206+
alertdlg(translate_text_item("Out of range"), translate_text_item( letter +" Feedrate value must be at least 1 mm/min!"));
202207
document.getElementById('control_z_velocity').value = preferenceslist[0].z_feedrate;
203208
return;
204209
}
205210
}
206211
if ((target_firmware == "grbl-embedded") || (target_firmware == "grbl")) {
212+
if(grblaxis > 3){
213+
var letter = document.getElementById('control_select_axis').value;
214+
cmd = cmd.replace("Z", letter);
215+
}
207216
command = "$J=G91 G21 F" + feedratevalue + " " + cmd;
208217
console.log(command);
209218
} else command = "G91\nG1 " + cmd + " F" + feedratevalue + "\nG90";
@@ -286,4 +295,4 @@ function macro_command(target, filename) {
286295
} else return;
287296
//console.log(cmd);
288297
SendPrinterCommand(cmd);
289-
}
298+
}

www/js/grbl.js

Lines changed: 112 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,75 @@ var gotWCO = false;
55
var WCOx = 0;
66
var WCOy = 0;
77
var WCOz = 0;
8+
var WCOa = 0;
9+
var WCOb = 0;
10+
var WCOc = 0;
11+
var grblaxis = 2;
12+
var grblzerocmd = 'X0 Y0';
13+
var axis_Z_feedrate = 0;
14+
var axis_A_feedrate = 0;
15+
var axis_B_feedrate = 0;
16+
var axis_C_feedrate = 0;
17+
var last_axis_letter = "Z";
18+
19+
function build_axis_selection(){
20+
var html = "<select class='form-control wauto' id='control_select_axis' onchange='control_changeaxis()' >";
21+
for (var i = 3; i <= grblaxis; i++) {
22+
var letter;
23+
if (i == 3) letter = "Z";
24+
else if (i == 4) letter = "A";
25+
else if (i == 5) letter = "B";
26+
else if (i == 6) letter = "C";
27+
html += "<option value='" + letter + "'";
28+
if (i == 3) html += " selected ";
29+
html += ">";
30+
html += letter;
31+
html += "</option>\n";
32+
}
33+
html += "</select>\n";
34+
if(grblaxis > 3) {
35+
document.getElementById('axis_selection').innerHTML = html;
36+
document.getElementById('axis_label').innerHTML = translate_text_item("Axis") + ":";
37+
document.getElementById('axis_selection').style.display = "table-row"
38+
}
39+
}
40+
41+
function control_changeaxis(){
42+
var letter = document.getElementById('control_select_axis').value;
43+
document.getElementById('axisup').innerHTML = '+'+letter;
44+
document.getElementById('axisdown').innerHTML = '-'+letter;
45+
document.getElementById('homeZlabel').innerHTML = ' '+letter+' ';
46+
switch(last_axis_letter) {
47+
case "Z":
48+
axis_Z_feedrate = document.getElementById('control_z_velocity').value;
49+
break;
50+
case "A":
51+
axis_A_feedrate = document.getElementById('control_z_velocity').value;
52+
break;
53+
case "B":
54+
axis_B_feedrate = document.getElementById('control_z_velocity').value;
55+
break;
56+
case "C":
57+
axis_C_feedrate = document.getElementById('control_z_velocity').value;
58+
break;
59+
}
60+
61+
last_axis_letter = letter;
62+
switch(last_axis_letter) {
63+
case "Z":
64+
document.getElementById('control_z_velocity').value = axis_Z_feedrate;
65+
break;
66+
case "A":
67+
document.getElementById('control_z_velocity').value = axis_A_feedrate;
68+
break;
69+
case "B":
70+
document.getElementById('control_z_velocity').value = axis_B_feedrate;
71+
break;
72+
case "C":
73+
document.getElementById('control_z_velocity').value = axis_C_feedrate;
74+
break;
75+
}
76+
}
877

978
function init_grbl_panel() {
1079
grbl_set_probe_detected(false);
@@ -117,10 +186,25 @@ function process_grbl_position(response) {
117186
} else {
118187
WCOy = 0;
119188
}
120-
if (tab3.length > 2) {
189+
if ((tab3.length > 2) && (grblaxis > 2)) {
121190
WCOz = parseFloat(tab3[2]);
122191
} else {
123192
WCOz = 0;
193+
}
194+
if ((tab3.length > 3) && (grblaxis > 3)) {
195+
WCOa = parseFloat(tab3[3]);
196+
} else {
197+
WCOa = 0;
198+
}
199+
if ((tab3.length > 4) && (grblaxis > 4)){
200+
WCOb = parseFloat(tab3[4]);
201+
} else {
202+
WCOb = 0;
203+
}
204+
if ((tab3.length > 5) && (grblaxis > 5)) {
205+
WCOc = parseFloat(tab3[5]);
206+
} else {
207+
WCOc = 0;
124208
}
125209
gotWCO = true;
126210
}
@@ -134,10 +218,22 @@ function process_grbl_position(response) {
134218
document.getElementById('control_y_position').innerHTML = tab3[1];
135219
if (gotWCO) document.getElementById('control_ym_position').innerHTML = (WCOy + parseFloat(tab3[1])).toFixed(3);
136220
}
137-
if (tab3.length > 2) {
221+
if ((tab3.length > 2) && (grblaxis > 2)) {
138222
document.getElementById('control_z_position').innerHTML = tab3[2];
139223
if (gotWCO) document.getElementById('control_zm_position').innerHTML = (WCOz + parseFloat(tab3[2])).toFixed(3);
140224
}
225+
if ((tab3.length > 3) && (grblaxis > 3)) {
226+
document.getElementById('control_a_position').innerHTML = tab3[3];
227+
if (gotWCO) document.getElementById('control_am_position').innerHTML = (WCOa + parseFloat(tab3[3])).toFixed(3);
228+
}
229+
if ((tab3.length > 4) && (grblaxis > 4)) {
230+
document.getElementById('control_b_position').innerHTML = tab3[4];
231+
if (gotWCO) document.getElementById('control_bm_position').innerHTML = (WCOb + parseFloat(tab3[4])).toFixed(3);
232+
}
233+
if ((tab3.length > 5) && (grblaxis > 5)) {
234+
document.getElementById('control_c_position').innerHTML = tab3[5];
235+
if (gotWCO) document.getElementById('control_cm_position').innerHTML = (WCOc + parseFloat(tab3[5])).toFixed(3);
236+
}
141237

142238
} else {
143239
tab1 = response.split("MPos:");
@@ -150,10 +246,22 @@ function process_grbl_position(response) {
150246
document.getElementById('control_ym_position').innerHTML = tab3[1];
151247
if (gotWCO) document.getElementById('control_y_position').innerHTML = (parseFloat(tab3[1]) - WCOy).toFixed(3);
152248
}
153-
if (tab3.length > 2) {
249+
if ((tab3.length > 2) && (grblaxis > 2)) {
154250
document.getElementById('control_zm_position').innerHTML = tab3[2];
155251
if (gotWCO) document.getElementById('control_z_position').innerHTML = (parseFloat(tab3[2]) - WCOz).toFixed(3);
156252
}
253+
if ((tab3.length > 3) && (grblaxis > 3)) {
254+
document.getElementById('control_am_position').innerHTML = tab3[3];
255+
if (gotWCO) document.getElementById('control_a_position').innerHTML = (parseFloat(tab3[3]) - WCOa).toFixed(3);
256+
}
257+
if ((tab3.length > 4) && (grblaxis > 4)) {
258+
document.getElementById('control_bm_position').innerHTML = tab3[4];
259+
if (gotWCO) document.getElementById('control_b_position').innerHTML = (parseFloat(tab3[4]) - WCOb).toFixed(3);
260+
}
261+
if ((tab3.length > 5) && (grblaxis > 5)) {
262+
document.getElementById('control_cm_position').innerHTML = tab3[5];
263+
if (gotWCO) document.getElementById('control_c_position').innerHTML = (parseFloat(tab3[5]) - WCOc).toFixed(3);
264+
}
157265
}
158266
}
159267
}
@@ -317,4 +425,4 @@ function StartProbeProcess() {
317425
document.getElementById("probingtext").style.display = "table-row";
318426
grbl_error_msg = "";
319427
document.getElementById('grbl_status_text').innerHTML = grbl_error_msg;
320-
}
428+
}

0 commit comments

Comments
 (0)