Add basic realtime command

Hide abort / progress if grbl fw
Hide printer answer if grbl-embeded fw
This commit is contained in:
Luc
2018-09-13 14:14:06 +02:00
parent 0063c520a9
commit e475b2d9f7
7 changed files with 30 additions and 17 deletions

Binary file not shown.

View File

@@ -229,12 +229,16 @@ function update_UI_firmware_target() {
document.getElementById('configtablink').style.display = 'block';
document.getElementById('auto_check_control').style.display = 'block';
document.getElementById('motor_off_control').style.display = 'block';
document.getElementById('progress_btn').style.display = 'block';
document.getElementById('abort_btn').style.display = 'block';
}
else if (target_firmware == "repetier4davinci" ) {
fwName = "Repetier for Davinci";
document.getElementById('configtablink').style.display = 'block';
document.getElementById('auto_check_control').style.display = 'block';
document.getElementById('motor_off_control').style.display = 'block';
document.getElementById('progress_btn').style.display = 'block';
document.getElementById('abort_btn').style.display = 'block';
}
else if (target_firmware == "smoothieware" ) {
fwName = "Smoothieware";
@@ -242,11 +246,15 @@ function update_UI_firmware_target() {
document.getElementById('config_smoothie_nav').style.display = 'block';
document.getElementById('auto_check_control').style.display = 'block';
document.getElementById('motor_off_control').style.display = 'block';
document.getElementById('progress_btn').style.display = 'block';
document.getElementById('abort_btn').style.display = 'block';
}
else if (target_firmware == "grbl-embedded" ) {
fwName = "GRBL ESP32";
document.getElementById('configtablink').style.display = 'block';
document.getElementById('auto_check_control').style.display = 'none';
document.getElementById('progress_btn').style.display = 'none';
document.getElementById('abort_btn').style.display = 'none';
document.getElementById('motor_off_control').style.display = 'none';
document.getElementById('tab_title_configuration').innerHTML= "<span translate>GRBL configuration</span>";
document.getElementById('tab_printer_configuration').innerHTML= "<span translate>GRBL</span>";
@@ -257,18 +265,24 @@ function update_UI_firmware_target() {
document.getElementById('configtablink').style.display = 'block';
document.getElementById('auto_check_control').style.display = 'block';
document.getElementById('motor_off_control').style.display = 'block';
document.getElementById('progress_btn').style.display = 'block';
document.getElementById('abort_btn').style.display = 'block';
}
else if (target_firmware == "marlin" ) {
fwName = "Marlin";
document.getElementById('configtablink').style.display = 'block';
document.getElementById('auto_check_control').style.display = 'block';
document.getElementById('motor_off_control').style.display = 'block';
document.getElementById('progress_btn').style.display = 'block';
document.getElementById('abort_btn').style.display = 'block';
}
else if (target_firmware == "marlinkimbra" ) {
fwName = "Marlin Kimbra";
document.getElementById('configtablink').style.display = 'block';
document.getElementById('auto_check_control').style.display = 'block';
document.getElementById('motor_off_control').style.display = 'block';
document.getElementById('progress_btn').style.display = 'block';
document.getElementById('abort_btn').style.display = 'block';
}
else if (target_firmware == "grbl" ) {
fwName = "Grbl";
@@ -278,6 +292,8 @@ function update_UI_firmware_target() {
document.getElementById('files_input_file').accept = " .g, .gco, .gcode, .txt, .ncc, .G, .GCO, .GCODE, .TXT, .NC";
document.getElementById('auto_check_control').style.display = 'none';
document.getElementById('motor_off_control').style.display = 'none';
document.getElementById('progress_btn').style.display = 'none';
document.getElementById('abort_btn').style.display = 'none';
}
else {
fwName = "Unknown";

21
www/js/controls.js vendored
View File

@@ -103,14 +103,10 @@ else {
function get_Position(){
var command = "M114";
if ((target_firmware == "grbl") || (target_firmware == "grbl-embedded")) command = "?";
//removeIf(production)
var response = "ok C: X:0.0000 Y:0.0000 Z:0.0000 E:0.0000 ";
if (target_firmware == "grbl") response = "<Idle|MPos:10.000,0.000,0.000|FS:0,0|Ov:71,100,147>";
process_Position(response);
return;
//endRemoveIf(production)
SendPrinterCommand(command, false, process_Position,null, 114, 1);
if ((target_firmware == "grbl") || (target_firmware == "grbl-embedded")) {
command = "?";
SendPrinterCommand(command, false, null,null, 114, 1);
} else SendPrinterCommand(command, false, process_Position,null, 114, 1);
}
function Control_get_position_value(label, result_data) {
@@ -128,14 +124,7 @@ function get_Position(){
function process_Position(response){
if ((target_firmware == "grbl") || (target_firmware == "grbl-embedded")){
var tab1 = response.split("WPos:");
if (tab1.length >1) {
var tab2 = tab1[1].split("|");
var tab3 = tab2[0].split(",");
document.getElementById('control_x_position').innerHTML = tab3[0];
if (tab3.length > 1) document.getElementById('control_y_position').innerHTML = tab3[1];
if (tab3.length > 2) document.getElementById('control_z_position').innerHTML = tab3[2];
}
process_grbl_position(response);
} else {
document.getElementById('control_x_position').innerHTML = Control_get_position_value("X:", response);
document.getElementById('control_y_position').innerHTML = Control_get_position_value("Y:", response);

View File

@@ -88,6 +88,10 @@ function process_grbl_SD(response){
}
}
function SendRealtimeCmd(cmd){
SendPrinterCommand(cmd, false, null,null, cmd.charCodeAt(0), 1);
}
function process_status(response){
process_grbl_position(response);
process_grbl_status(response);

View File

@@ -39,6 +39,7 @@ function SendPrinterSilentCommandSuccess(response){
function SendPrinterCommandSuccess(response){
if ((target_firmware == "grbl") || (target_firmware == "grbl-embedded")) return;
if (response[response.length-1] != '\n')Monitor_output_Update(response + "\n");
else Monitor_output_Update(response);
}

View File

@@ -49,7 +49,7 @@
<button class="btn btn-xs btn-primary hide_it" id="files_refresh_primary_sd_btn" onclick="files_refreshFiles(primary_sd)" >SD 1</button>
<button class="btn btn-xs btn-primary hide_it" id="files_refresh_secondary_sd_btn" onclick="files_refreshFiles(secondary_sd)" >SD 2</button>
<button id="progress_btn" class="btn btn-xs btn-primary" onclick="files_progress()" translate>Progress</button>
<button class="btn btn-xs btn-primary" onclick="files_abort()" translate>Abort</button>
<button id="abort_btn" class="btn btn-xs btn-primary" onclick="files_abort()" translate>Abort</button>
<button class="btn btn-xs btn-primary" onclick="files_select_upload()" translate>Upload</button>
<input type="file" id="files_input_file" onchange="files_check_if_upload()" accept=" .g, .gco, .gcode, .G, .GCO, .GCODE" style="display:none" />
</div>

View File

@@ -25,5 +25,8 @@
<div id="control-body" class="panel-body panel-flex-main">
<div id='grbl_status'></div>
<div id='grbl_SD_status'></div>
<button onclick='SendRealtimeCmd("!");'>Pause</button>
<button onclick='SendRealtimeCmd("~");'>resume</button>
<button onclick='SendRealtimeCmd(String.fromCharCode(0x18));'>Stop</button>
</div>
</div>