OpenBuilds-CONTROL/app/js/ui.js

482 wiersze
17 KiB
JavaScript
Czysty Zwykły widok Historia

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-12-20 19:22:02 +00:00
$("#flashBtn").hide();
2018-08-01 19:04:27 +00:00
$('#portUSB').parent().show();
2018-06-27 19:23:34 +00:00
$("#connectBtn").show();
2020-03-06 15:59:58 +00:00
$("#driverBtn").show();
2018-06-27 19:23:34 +00:00
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')
2020-04-14 17:57:56 +00:00
$('.macrobtn').addClass('disabled')
2018-06-27 19:23:34 +00:00
// 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();
2020-03-06 15:59:58 +00:00
$("#driverBtn").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();
2018-12-20 19:22:02 +00:00
$("#flashBtn").hide();
2018-06-27 19:23:34 +00:00
// 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);
2020-04-14 17:57:56 +00:00
$('.macrobtn').removeClass('disabled')
2018-06-27 19:23:34 +00:00
} else if (val == 3) { // Busy Streaming GCODE
// Status Badge
$('#connectStatus').html("Port: Connected");
// Connect/Disconnect Button
$("#connectBtn").hide();
2020-03-06 15:59:58 +00:00
$("#driverBtn").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();
2018-12-20 19:22:02 +00:00
$("#flashBtn").hide();
2018-06-27 19:23:34 +00:00
// 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);
2020-04-14 17:57:56 +00:00
$('.macrobtn').addClass('disabled')
2018-06-27 19:23:34 +00:00
} else if (val == 4) { // Paused
// Status Badge
$('#connectStatus').html("Port: Connected");
// Connect/Disconnect Button
$("#connectBtn").hide();
2020-03-06 15:59:58 +00:00
$("#driverBtn").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();
2018-12-20 19:22:02 +00:00
$("#flashBtn").hide();
2018-06-27 19:23:34 +00:00
// 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);
2020-04-14 17:57:56 +00:00
$('.macrobtn').addClass('disabled')
2018-06-27 19:23:34 +00:00
} else if (val == 5) { // Alarm State
// Status Badge
$('#connectStatus').html("Port: Connected");
// Connect/Disconnect Button
$("#connectBtn").hide();
2020-03-06 15:59:58 +00:00
$("#driverBtn").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();
2018-12-20 19:22:02 +00:00
$("#flashBtn").hide();
// 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);
2020-04-14 17:57:56 +00:00
$('.macrobtn').addClass('disabled')
2018-12-20 19:22:02 +00:00
} else if (val == 6) { // Firmware Upgrade State
// Status Badge
$('#connectStatus').html("Port: Flashing");
// Connect/Disconnect Button
$("#connectBtn").hide();
2020-03-06 15:59:58 +00:00
$("#driverBtn").hide();
2018-12-20 19:22:02 +00:00
$('#portUSB').parent().hide();
$("#connectBtn").attr('disabled', false);
$("#disconnectBtn").hide();
$("#flashBtn").show();
2018-06-27 19:23:34 +00:00
// 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);
2020-04-14 17:57:56 +00:00
$('.macrobtn').addClass('disabled')
2018-06-27 19:23:34 +00:00
}
}
// Toolbar with play/pause/stop
function setControlBar(val, status) {
if (val == 0) { // Not Connected Yet
2019-09-13 18:39:59 +00:00
if (toolchanges && toolchanges.length) {
2019-09-03 18:36:09 +00:00
$('#runToolsBtn').hide().attr('disabled', true);
$('#runBtn').hide().attr('disabled', true);
} else {
$('#runToolsBtn').hide().attr('disabled', true);
$('#runBtn').hide().attr('disabled', true);
}
2020-03-30 15:26:11 +00:00
$('#grblProbeMenu').show().attr('disabled', true);
2018-09-06 21:08:06 +00:00
$('#chkSize').show().attr('disabled', true);
2018-06-27 19:23:34 +00:00
$('#resumeBtn').hide().attr('disabled', true);
$('#pauseBtn').hide().attr('disabled', true);
$('#stopBtn').hide().attr('disabled', true);
$('#toolBtn').hide().attr('disabled', true);
2018-12-19 19:32:15 +00:00
$('#toolBtn2').hide().attr('disabled', true);
2019-01-30 13:13:33 +00:00
if (laststatus != undefined && laststatus.machine.firmware.type == 'grbl') {
2019-01-30 08:39:36 +00:00
if (grblParams['$22'] == 1) {
$('#homeBtn').hide().attr('disabled', true);
} else {
$('#homeBtn').hide().attr('disabled', true);
}
2019-01-18 19:01:53 +00:00
}
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
2020-03-30 15:26:11 +00:00
$('#grblProbeMenu').show().attr('disabled', false);
2018-08-24 19:00:03 +00:00
if (typeof ace !== 'undefined') {
2019-09-03 18:36:09 +00:00
if (toolchanges.length) {
2020-06-23 17:55:56 +00:00
if (status.machine.inputs.includes('D')) {
$('#runToolsBtn').show().attr('disabled', true);
$('#runBtn').hide().attr('disabled', true);
} else {
$('#runToolsBtn').show().attr('disabled', editor.session.getLength() < 2);
$('#runBtn').hide().attr('disabled', editor.session.getLength() < 2);
}
2020-02-06 18:02:06 +00:00
if (webgl) {
$('#chkSize').show().attr('disabled', editor.session.getLength() < 2);
} else {
$('#chkSize').show().attr('disabled', true);
}
2019-09-03 18:36:09 +00:00
} else {
$('#runToolsBtn').hide().attr('disabled', editor.session.getLength() < 2);
2020-06-23 17:55:56 +00:00
if (status.machine.inputs.includes('D')) {
$('#runBtn').show().attr('disabled', true);
} else {
$('#runBtn').show().attr('disabled', editor.session.getLength() < 2);
}
2020-02-06 18:02:06 +00:00
if (webgl) {
$('#chkSize').show().attr('disabled', editor.session.getLength() < 2);
} else {
$('#chkSize').show().attr('disabled', true);
}
2019-09-03 18:36:09 +00:00
}
2018-08-24 19:00:03 +00:00
} else {
2020-06-23 17:55:56 +00:00
if (status.machine.inputs.includes('D')) {
$('#runBtn').show().attr('disabled', true);
} else {
$('#runBtn').show().attr('disabled', false);
}
2019-09-03 18:36:09 +00:00
$('#runToolsBtn').hide().attr('disabled', false);
2018-08-24 19:00:03 +00:00
}
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);
2018-12-19 19:32:15 +00:00
$('#toolBtn2').show().attr('disabled', false);
2019-01-30 08:39:36 +00:00
if (laststatus != undefined && laststatus.machine.firmware.type == 'grbl') {
if (grblParams['$22'] == 1) {
$('#homeBtn').show().attr('disabled', false);
} else {
$('#homeBtn').show().attr('disabled', true);
}
2019-01-18 19:01:53 +00:00
}
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
2020-03-30 15:26:11 +00:00
$('#grblProbeMenu').show().attr('disabled', true);
2019-09-03 18:36:09 +00:00
if (toolchanges.length) {
$('#runToolsBtn').hide().attr('disabled', true);
$('#runBtn').hide().attr('disabled', true);
} else {
$('#runToolsBtn').hide().attr('disabled', true);
$('#runBtn').hide().attr('disabled', true);
}
2018-09-06 21:08:06 +00:00
$('#chkSize').show().attr('disabled', true);
2018-06-27 19:23:34 +00:00
$('#resumeBtn').hide().attr('disabled', true);
$('#pauseBtn').show().attr('disabled', false);
$('#stopBtn').show().attr('disabled', false);
$('#toolBtn').show().attr('disabled', false);
2018-12-19 19:32:15 +00:00
$('#toolBtn2').show().attr('disabled', false);
2019-01-30 08:39:36 +00:00
if (laststatus != undefined && laststatus.machine.firmware.type == 'grbl') {
if (grblParams['$22'] == 1) {
$('#homeBtn').show().attr('disabled', true);
} else {
$('#homeBtn').show().attr('disabled', true);
}
2019-01-18 19:01:53 +00:00
}
2018-08-24 19:00:03 +00:00
$('.estop').show()
2018-06-27 19:23:34 +00:00
} else if (val == 4) { // Paused
2020-03-30 15:26:11 +00:00
$('#grblProbeMenu').show().attr('disabled', true);
2019-09-03 18:36:09 +00:00
if (toolchanges.length) {
$('#runToolsBtn').hide().attr('disabled', true);
$('#runBtn').hide().attr('disabled', true);
} else {
$('#runToolsBtn').hide().attr('disabled', true);
$('#runBtn').hide().attr('disabled', true);
}
2018-09-06 21:08:06 +00:00
$('#chkSize').show().attr('disabled', true);
2020-06-23 17:55:56 +00:00
if (status.machine.inputs.includes('D')) {
$('#resumeBtn').show().attr('disabled', true);
} else {
$('#resumeBtn').show().attr('disabled', false);
}
2018-06-27 19:23:34 +00:00
$('#pauseBtn').hide().attr('disabled', true);
$('#stopBtn').show().attr('disabled', false);
$('#toolBtn').show().attr('disabled', false);
2018-12-19 19:32:15 +00:00
$('#toolBtn2').show().attr('disabled', false);
2019-01-30 08:39:36 +00:00
if (laststatus != undefined && laststatus.machine.firmware.type == 'grbl') {
if (grblParams['$22'] == 1) {
$('#homeBtn').show().attr('disabled', true);
} else {
$('#homeBtn').show().attr('disabled', true);
}
2019-01-18 19:01:53 +00:00
}
2018-08-24 19:00:03 +00:00
$('.estop').show()
2018-06-27 19:23:34 +00:00
} else if (val == 5) { // Alarm State
2020-03-30 15:26:11 +00:00
$('#grblProbeMenu').show().attr('disabled', true);
2019-09-03 18:36:09 +00:00
if (toolchanges.length) {
$('#runToolsBtn').show().attr('disabled', true);
$('#runBtn').hide().attr('disabled', true);
} else {
$('#runToolsBtn').hide().attr('disabled', true);
$('#runBtn').show().attr('disabled', true);
}
// $('#runBtn').show().attr('disabled', true);
2018-09-06 21:08:06 +00:00
$('#chkSize').show().attr('disabled', true);
2018-06-27 19:23:34 +00:00
$('#resumeBtn').hide().attr('disabled', true);
$('#pauseBtn').hide().attr('disabled', true);
2020-04-17 21:07:39 +00:00
$('#stopBtn').show().attr('disabled', true);
2018-06-27 19:23:34 +00:00
$('#toolBtn').show().attr('disabled', true);
2018-12-19 19:32:15 +00:00
$('#toolBtn2').show().attr('disabled', true);
2019-01-30 08:39:36 +00:00
if (laststatus != undefined && laststatus.machine.firmware.type == 'grbl') {
if (grblParams['$22'] == 1) {
2020-04-17 21:07:39 +00:00
$('#homeBtn').show().attr('disabled', false);
2019-01-30 08:39:36 +00:00
} else {
$('#homeBtn').show().attr('disabled', true);
}
2019-01-18 19:01:53 +00:00
}
2018-08-24 19:00:03 +00:00
$('.estop').show()
2018-12-20 19:22:02 +00:00
} else if (val == 6) { // Firmware Upgrade State
2020-03-30 15:26:11 +00:00
$('#grblProbeMenu').show().attr('disabled', true);
2019-09-03 18:36:09 +00:00
if (toolchanges.length) {
$('#runToolsBtn').hide().attr('disabled', true);
$('#runBtn').hide().attr('disabled', true);
} else {
$('#runToolsBtn').hide().attr('disabled', true);
$('#runBtn').hide().attr('disabled', true);
}
2018-12-20 19:22:02 +00:00
$('#chkSize').show().attr('disabled', true);
$('#resumeBtn').hide().attr('disabled', true);
$('#pauseBtn').hide().attr('disabled', true);
$('#stopBtn').hide().attr('disabled', true);
$('#toolBtn').hide().attr('disabled', true);
$('#toolBtn2').hide().attr('disabled', true);
2019-01-30 08:39:36 +00:00
if (laststatus != undefined && laststatus.machine.firmware.type == 'grbl') {
if (grblParams['$22'] == 1) {
$('#homeBtn').hide().attr('disabled', true);
} else {
$('#homeBtn').show().attr('disabled', true);
}
2019-01-18 19:01:53 +00:00
}
2018-12-20 19:22:02 +00:00
$('.estop').hide()
2018-06-27 19:23:34 +00:00
}
}
function setJogPanel(val, status) {
if (val == 0) { // Not Connected Yet
// Show panel and resize editor
// $("#jogcontrols").slideUp(20);
2019-04-24 17:47:21 +00:00
// $("#editor").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
// $("#macros").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
// $("#console").css('height', 'calc(' + 100 + 'vh - ' + 505 + 'px)');
// $("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 448 + '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) {
2019-10-18 18:55:41 +00:00
if (webgl) {
if (!disable3Drealtimepos) {
cone.visible = false;
}
2019-10-16 13:57:56 +00:00
}
2018-08-28 15:09:20 +00:00
}
}
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
2019-04-24 17:47:21 +00:00
// $("#editor").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
// $("#macros").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
// $("#console").css('height', 'calc(' + 100 + 'vh - ' + 505 + 'px)');
// $("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 448 + '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) {
2019-10-18 18:55:41 +00:00
if (!disable3Drealtimepos) {
cone.visible = false;
}
// 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
2019-04-24 17:47:21 +00:00
// $("#editor").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
// $("#macros").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
// $("#console").css('height', 'calc(' + 100 + 'vh - ' + 505 + 'px)');
// $("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 448 + 'px)');
2018-08-24 19:00:03 +00:00
if (editor) {
editor.resize()
}
// $("#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) {
2019-10-18 18:55:41 +00:00
if (webgl) {
if (!disable3Drealtimepos) {
cone.visible = true;
}
2019-10-16 13:57:56 +00:00
}
2018-08-28 15:09:20 +00:00
}
}
2018-06-27 19:23:34 +00:00
} else if (val == 4) { // Paused
// Show panel and resize editor
2019-04-24 17:47:21 +00:00
// $("#editor").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
// $("#macros").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
// $("#console").css('height', 'calc(' + 100 + 'vh - ' + 505 + 'px)');
// $("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 448 + '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) {
2019-10-18 18:55:41 +00:00
if (!disable3Drealtimepos) {
cone.visible = true;
}
2018-08-28 15:09:20 +00:00
}
}
2018-06-27 19:23:34 +00:00
} else if (val == 5) { // Alarm State
// Show panel and resize editor
2019-04-24 17:47:21 +00:00
// $("#editor").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
// $("#macros").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
// $("#console").css('height', 'calc(' + 100 + 'vh - ' + 505 + 'px)');
// $("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 448 + '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) {
2019-10-18 18:55:41 +00:00
if (webgl) {
if (!disable3Drealtimepos) {
cone.visible = false;
}
2019-10-16 13:57:56 +00:00
}
2018-08-28 15:09:20 +00:00
}
}
2018-12-20 19:22:02 +00:00
} else if (val == 6) { // Firmware Upgrade State
// Show panel and resize editor
// $("#jogcontrols").slideUp(20);
2019-04-24 17:47:21 +00:00
// $("#editor").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
// $("#macros").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
// $("#console").css('height', 'calc(' + 100 + 'vh - ' + 505 + 'px)');
// $("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 448 + 'px)');
2018-12-20 19:22:02 +00:00
// $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height());
if (editor) {
editor.resize()
}
$('.jogbtn').attr('disabled', true);
if ($('#jograte').attr('disabled')) {
$('#jograte').attr('disabled', false);
}
$('#xPos').html('0.00');
$('#yPos').html('0.00');
$('#zPos').html('0.00');
if (!isJogWidget && webgl) {
if (!simRunning) {
2019-10-18 18:55:41 +00:00
if (!disable3Drealtimepos) {
cone.visible = false;
}
2018-12-20 19:22:02 +00:00
}
}
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);
2018-12-20 19:22:02 +00:00
} else if (val == 6) { // Firmware Upgrade State
if (!$('#command').attr('disabled')) {
$('#command').attr('disabled', true);
}
$("#sendCommand").prop('disabled', true);
2018-06-27 19:23:34 +00:00
}
}