2018-06-27 19:23:34 +00:00
|
|
|
// Toolbar with USB port/connect/disconnect
|
|
|
|
function setConnectBar(val, status) {
|
|
|
|
if (val == 0) { // Not Connected Yet
|
|
|
|
// Status Badge
|
|
|
|
$('#connectStatus').html("Port: Not Connected");
|
|
|
|
// Connect/Disconnect Button
|
|
|
|
$("#disconnectBtn").hide();
|
2018-08-01 19:04:27 +00:00
|
|
|
$('#portUSB').parent().show();
|
2018-06-27 19:23:34 +00:00
|
|
|
$("#connectBtn").show();
|
|
|
|
if ($('#portUSB').val() != "") {
|
|
|
|
$("#connectBtn").attr('disabled', false);
|
|
|
|
} else {
|
|
|
|
$("#connectBtn").attr('disabled', true);
|
|
|
|
}
|
|
|
|
// Port Dropdown
|
|
|
|
if ($('#portUSB').val() != "") {
|
|
|
|
$('#portUSB').parent(".select").removeClass('disabled')
|
|
|
|
} else {
|
|
|
|
$('#portUSB').parent(".select").addClass('disabled')
|
|
|
|
}
|
|
|
|
$('#portUSB').parent(".select").addClass('success')
|
|
|
|
$('#portUSB').parent(".select").removeClass('alert')
|
|
|
|
// Set Port Dropdown to Current Value
|
|
|
|
// Not applicable to Status 0 as its set by populatePortsMenu();
|
|
|
|
|
|
|
|
} else if (val == 1 || val == 2) { // Connected, but not Playing yet
|
|
|
|
// Status Badge
|
|
|
|
$('#connectStatus').html("Port: Connected");
|
|
|
|
// Connect/Disconnect Button
|
|
|
|
$("#connectBtn").hide();
|
2018-08-01 19:04:27 +00:00
|
|
|
$('#portUSB').parent().hide();
|
2018-06-27 19:23:34 +00:00
|
|
|
$("#connectBtn").attr('disabled', false);
|
|
|
|
$("#disconnectBtn").show();
|
|
|
|
// Port Dropdown
|
|
|
|
$('#portUSB').parent(".select").addClass('disabled')
|
|
|
|
$('#portUSB').parent(".select").removeClass('success')
|
|
|
|
$('#portUSB').parent(".select").addClass('alert')
|
|
|
|
// Set Port Dropdown to Current Value
|
|
|
|
$("#portUSB").val(status.comms.interfaces.activePort);
|
|
|
|
} else if (val == 3) { // Busy Streaming GCODE
|
|
|
|
// Status Badge
|
|
|
|
$('#connectStatus').html("Port: Connected");
|
|
|
|
// Connect/Disconnect Button
|
|
|
|
$("#connectBtn").hide();
|
2018-08-01 19:04:27 +00:00
|
|
|
$('#portUSB').parent().hide();
|
2018-06-27 19:23:34 +00:00
|
|
|
$("#connectBtn").attr('disabled', false);
|
|
|
|
$("#disconnectBtn").show();
|
|
|
|
// Port Dropdown
|
|
|
|
$('#portUSB').parent(".select").addClass('disabled')
|
|
|
|
$('#portUSB').parent(".select").removeClass('success')
|
|
|
|
$('#portUSB').parent(".select").addClass('alert')
|
|
|
|
// Set Port Dropdown to Current Value
|
|
|
|
$("#portUSB").val(status.comms.interfaces.activePort);
|
|
|
|
|
|
|
|
} else if (val == 4) { // Paused
|
|
|
|
// Status Badge
|
|
|
|
$('#connectStatus').html("Port: Connected");
|
|
|
|
// Connect/Disconnect Button
|
|
|
|
$("#connectBtn").hide();
|
2018-08-01 19:04:27 +00:00
|
|
|
$('#portUSB').parent().hide();
|
2018-06-27 19:23:34 +00:00
|
|
|
$("#connectBtn").attr('disabled', false);
|
|
|
|
$("#disconnectBtn").show();
|
|
|
|
// Port Dropdown
|
|
|
|
$('#portUSB').parent(".select").addClass('disabled')
|
|
|
|
$('#portUSB').parent(".select").removeClass('success')
|
|
|
|
$('#portUSB').parent(".select").addClass('alert')
|
|
|
|
// Set Port Dropdown to Current Value
|
|
|
|
$("#portUSB").val(status.comms.interfaces.activePort);
|
|
|
|
|
|
|
|
} else if (val == 5) { // Alarm State
|
|
|
|
// Status Badge
|
|
|
|
$('#connectStatus').html("Port: Connected");
|
|
|
|
// Connect/Disconnect Button
|
|
|
|
$("#connectBtn").hide();
|
2018-08-01 19:04:27 +00:00
|
|
|
$('#portUSB').parent().hide();
|
2018-06-27 19:23:34 +00:00
|
|
|
$("#connectBtn").attr('disabled', false);
|
|
|
|
$("#disconnectBtn").show();
|
|
|
|
// Port Dropdown
|
|
|
|
$('#portUSB').parent(".select").addClass('disabled')
|
|
|
|
$('#portUSB').parent(".select").removeClass('success')
|
|
|
|
$('#portUSB').parent(".select").addClass('alert')
|
|
|
|
// Set Port Dropdown to Current Value
|
|
|
|
$("#portUSB").val(status.comms.interfaces.activePort);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Toolbar with play/pause/stop
|
|
|
|
function setControlBar(val, status) {
|
|
|
|
if (val == 0) { // Not Connected Yet
|
|
|
|
$('#runBtn').hide().attr('disabled', true);
|
|
|
|
$('#resumeBtn').hide().attr('disabled', true);
|
|
|
|
$('#pauseBtn').hide().attr('disabled', true);
|
|
|
|
$('#stopBtn').hide().attr('disabled', true);
|
|
|
|
$('#toolBtn').hide().attr('disabled', true);
|
|
|
|
$('#homeBtn').hide().attr('disabled', true);
|
2018-08-24 19:00:03 +00:00
|
|
|
$('.estop').hide()
|
2018-08-25 16:54:28 +00:00
|
|
|
} else if (val == 1 || val == 2) { // Connected, but not Playing yet
|
2018-08-24 19:00:03 +00:00
|
|
|
if (typeof ace !== 'undefined') {
|
|
|
|
$('#runBtn').show().attr('disabled', editor.session.getLength() < 2);
|
|
|
|
} else {
|
|
|
|
$('#runBtn').show().attr('disabled', false);
|
|
|
|
}
|
2018-06-27 19:23:34 +00:00
|
|
|
$('#resumeBtn').hide().attr('disabled', true);
|
|
|
|
$('#pauseBtn').hide().attr('disabled', true);
|
|
|
|
$('#stopBtn').show().attr('disabled', true);
|
|
|
|
$('#toolBtn').show().attr('disabled', false);
|
|
|
|
$('#homeBtn').show().attr('disabled', false);
|
2018-08-24 19:00:03 +00:00
|
|
|
$('.estop').show()
|
2018-06-27 19:23:34 +00:00
|
|
|
} else if (val == 3) { // Busy Streaming GCODE
|
|
|
|
$('#runBtn').hide().attr('disabled', true);
|
|
|
|
$('#resumeBtn').hide().attr('disabled', true);
|
|
|
|
$('#pauseBtn').show().attr('disabled', false);
|
|
|
|
$('#stopBtn').show().attr('disabled', false);
|
|
|
|
$('#toolBtn').show().attr('disabled', false);
|
|
|
|
$('#homeBtn').show().attr('disabled', true);
|
2018-08-24 19:00:03 +00:00
|
|
|
$('.estop').show()
|
2018-06-27 19:23:34 +00:00
|
|
|
} else if (val == 4) { // Paused
|
|
|
|
$('#runBtn').hide().attr('disabled', true);
|
|
|
|
$('#resumeBtn').show().attr('disabled', false);
|
|
|
|
$('#pauseBtn').hide().attr('disabled', true);
|
|
|
|
$('#stopBtn').show().attr('disabled', false);
|
|
|
|
$('#toolBtn').show().attr('disabled', false);
|
|
|
|
$('#homeBtn').show().attr('disabled', true);
|
2018-08-24 19:00:03 +00:00
|
|
|
$('.estop').show()
|
2018-06-27 19:23:34 +00:00
|
|
|
} else if (val == 5) { // Alarm State
|
|
|
|
$('#runBtn').show().attr('disabled', true);
|
|
|
|
$('#resumeBtn').hide().attr('disabled', true);
|
|
|
|
$('#pauseBtn').hide().attr('disabled', true);
|
|
|
|
$('#stopBtn').show().attr('disabled', false);
|
|
|
|
$('#toolBtn').show().attr('disabled', true);
|
|
|
|
$('#homeBtn').show().attr('disabled', true);
|
2018-08-24 19:00:03 +00:00
|
|
|
$('.estop').show()
|
2018-06-27 19:23:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function setJogPanel(val, status) {
|
|
|
|
if (val == 0) { // Not Connected Yet
|
|
|
|
// Show panel and resize editor
|
2018-08-25 16:54:28 +00:00
|
|
|
$("#svgview").css('background-color', '#f5f6f7');
|
2018-09-06 16:10:40 +00:00
|
|
|
// $("#jogcontrols").slideUp(20);
|
|
|
|
$("#editor").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
|
|
|
$("#console").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
|
|
|
$("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
2018-08-06 16:56:45 +00:00
|
|
|
// $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height());
|
2018-08-24 19:00:03 +00:00
|
|
|
if (editor) {
|
|
|
|
editor.resize()
|
|
|
|
}
|
2018-06-27 19:23:34 +00:00
|
|
|
$('.jogbtn').attr('disabled', true);
|
2018-06-27 20:53:07 +00:00
|
|
|
if ($('#jograte').attr('disabled')) {
|
|
|
|
$('#jograte').attr('disabled', false);
|
|
|
|
}
|
2018-08-25 16:54:28 +00:00
|
|
|
$('#xPos').html('0.00');
|
|
|
|
$('#yPos').html('0.00');
|
|
|
|
$('#zPos').html('0.00');
|
2018-08-28 15:22:12 +00:00
|
|
|
if (!isJogWidget && webgl) {
|
2018-08-28 15:09:20 +00:00
|
|
|
if (!simRunning) {
|
|
|
|
cone.visible = false;
|
|
|
|
}
|
|
|
|
}
|
2018-08-25 16:54:28 +00:00
|
|
|
|
|
|
|
} else if (val == 1 || val == 2) { // Connected, but not Playing yet
|
2018-06-27 19:23:34 +00:00
|
|
|
// Show panel and resize editor
|
2018-08-25 16:54:28 +00:00
|
|
|
$("#svgview").css('background-color', '#ffffff');
|
2018-08-08 12:31:59 +00:00
|
|
|
$("#editor").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
2018-08-07 19:25:56 +00:00
|
|
|
$("#console").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
2018-08-28 15:09:20 +00:00
|
|
|
$("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
2018-08-06 16:56:45 +00:00
|
|
|
// $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height());
|
2018-08-24 19:00:03 +00:00
|
|
|
if (editor) {
|
|
|
|
editor.resize()
|
|
|
|
}
|
2018-06-27 19:23:34 +00:00
|
|
|
$('.jogbtn').attr('disabled', false);
|
2018-06-27 20:53:07 +00:00
|
|
|
if ($('#jograte').attr('disabled')) {
|
|
|
|
$('#jograte').attr('disabled', false);
|
|
|
|
}
|
2018-08-28 15:22:12 +00:00
|
|
|
if (!isJogWidget && webgl) {
|
2018-08-28 15:09:20 +00:00
|
|
|
if (object) {
|
|
|
|
if (!simRunning) {
|
|
|
|
cone.visible = false;
|
2018-09-06 16:10:40 +00:00
|
|
|
// update3Dprogress(object.children.length)
|
2018-08-28 15:09:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-06-27 19:23:34 +00:00
|
|
|
} else if (val == 3) { // Busy Streaming GCODE
|
|
|
|
// Show panel and resize editor
|
2018-08-25 16:54:28 +00:00
|
|
|
$("#svgview").css('background-color', '#f5f6f7');
|
2018-08-08 12:31:59 +00:00
|
|
|
$("#editor").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
2018-08-07 19:25:56 +00:00
|
|
|
$("#console").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
2018-08-28 15:09:20 +00:00
|
|
|
$("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
2018-08-24 19:00:03 +00:00
|
|
|
if (editor) {
|
|
|
|
editor.resize()
|
|
|
|
}
|
2018-09-06 16:10:40 +00:00
|
|
|
// $("#jogcontrols").slideDown(20);
|
2018-06-27 19:23:34 +00:00
|
|
|
$('.jogbtn').attr('disabled', true);
|
2018-06-27 20:53:07 +00:00
|
|
|
if (!$('#jograte').attr('disabled')) {
|
|
|
|
$('#jograte').attr('disabled', true);
|
|
|
|
}
|
2018-08-28 15:22:12 +00:00
|
|
|
if (!isJogWidget && webgl) {
|
2018-08-28 15:09:20 +00:00
|
|
|
if (!simRunning) {
|
|
|
|
cone.visible = true;
|
|
|
|
}
|
|
|
|
}
|
2018-06-27 19:23:34 +00:00
|
|
|
} else if (val == 4) { // Paused
|
|
|
|
// Show panel and resize editor
|
2018-08-25 16:54:28 +00:00
|
|
|
$("#svgview").css('background-color', '#f5f6f7');
|
2018-08-08 12:31:59 +00:00
|
|
|
$("#editor").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
2018-08-07 19:25:56 +00:00
|
|
|
$("#console").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
2018-08-28 15:09:20 +00:00
|
|
|
$("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
2018-08-24 19:00:03 +00:00
|
|
|
if (editor) {
|
|
|
|
editor.resize()
|
|
|
|
}
|
2018-06-27 19:23:34 +00:00
|
|
|
$('.jogbtn').attr('disabled', true);
|
2018-06-27 20:53:07 +00:00
|
|
|
if (!$('#jograte').attr('disabled')) {
|
|
|
|
$('#jograte').attr('disabled', true);
|
|
|
|
}
|
2018-08-28 15:22:12 +00:00
|
|
|
if (!isJogWidget && webgl) {
|
2018-08-28 15:09:20 +00:00
|
|
|
if (!simRunning) {
|
|
|
|
cone.visible = true;
|
|
|
|
}
|
|
|
|
}
|
2018-06-27 19:23:34 +00:00
|
|
|
} else if (val == 5) { // Alarm State
|
|
|
|
// Show panel and resize editor
|
2018-08-25 16:54:28 +00:00
|
|
|
$("#svgview").css('background-color', '#f5f6f7');
|
2018-09-06 16:10:40 +00:00
|
|
|
$("#editor").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
|
|
|
$("#console").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
|
|
|
$("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
2018-08-06 16:56:45 +00:00
|
|
|
// $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height());
|
2018-08-24 19:00:03 +00:00
|
|
|
if (editor) {
|
|
|
|
editor.resize()
|
|
|
|
}
|
2018-06-27 19:23:34 +00:00
|
|
|
$('.jogbtn').attr('disabled', true);
|
2018-06-27 20:53:07 +00:00
|
|
|
if (!$('#jograte').attr('disabled')) {
|
|
|
|
$('#jograte').attr('disabled', true);
|
|
|
|
}
|
2018-08-28 15:22:12 +00:00
|
|
|
if (!isJogWidget && webgl) {
|
2018-08-28 15:09:20 +00:00
|
|
|
if (!simRunning) {
|
|
|
|
cone.visible = false;
|
|
|
|
}
|
|
|
|
}
|
2018-06-27 19:23:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function setConsole(val, status) {
|
|
|
|
if (val == 0) { // Not Connected Yet
|
|
|
|
if (!$('#command').attr('disabled')) {
|
|
|
|
$('#command').attr('disabled', true);
|
|
|
|
}
|
|
|
|
$("#sendCommand").prop('disabled', true);
|
|
|
|
} else if (val == 0 || val == 2) { // Connected, but not Playing yet
|
|
|
|
$("#command").attr('disabled', false);
|
|
|
|
$("#sendCommand").prop('disabled', false);
|
|
|
|
} else if (val == 3) { // Busy Streaming GCODE
|
2018-06-29 13:01:16 +00:00
|
|
|
if (!$('#command').attr('disabled')) {
|
|
|
|
$('#command').attr('disabled', true);
|
|
|
|
}
|
2018-06-27 19:23:34 +00:00
|
|
|
$("#sendCommand").prop('disabled', true);
|
|
|
|
} else if (val == 4) { // Paused
|
2018-06-29 13:01:16 +00:00
|
|
|
if (!$('#command').attr('disabled')) {
|
|
|
|
$('#command').attr('disabled', true);
|
|
|
|
}
|
2018-06-27 19:23:34 +00:00
|
|
|
$("#sendCommand").prop('disabled', false);
|
|
|
|
} else if (val == 5) { // Alarm State
|
|
|
|
$("#command").attr('disabled', false);
|
|
|
|
$("#sendCommand").prop('disabled', false);
|
|
|
|
}
|
|
|
|
}
|