Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
beba547031 | ||
|
|
bb18992f80 | ||
|
|
572fbd7629 | ||
|
|
69fff8fe0e | ||
|
|
101904bd6d | ||
|
|
28177e35a7 | ||
|
|
54aaf8d0c7 | ||
|
|
851c17a6d4 | ||
|
|
aa0780097c | ||
|
|
1ae7827f7e | ||
|
|
98950a2b9a | ||
|
|
3051c9a033 | ||
|
|
da7dc25b51 | ||
|
|
ea8d6cfb84 | ||
|
|
21b56a9c55 |
No files matched your search
@@ -1,24 +1,131 @@
|
||||
# kwc
|
||||
# Klipper Web Control
|
||||
KWC is a responsive web interface for [Klipper](https://github.com/KevinOConnor/klipper) 3D printer firmware. It communicates with the klipper-api from [Arksine](https://github.com/arksine).
|
||||
|
||||
## Project setup
|
||||
```
|
||||
npm install
|
||||
## Installation
|
||||
At first install Arksine klipper-api fork/branch -> [install manual](https://github.com/Arksine/klipper/tree/work-web_server-20200131/klippy/extras/web_server)
|
||||
|
||||
Download and install KWC:
|
||||
```bash
|
||||
mkdir -p ~/kwc
|
||||
cd ~/kwc
|
||||
wget -q -O kwc.zip https://github.com/meteyou/kwc/releases/download/v0.0.7/kwc-alpha-0.0.7.zip && unzip kwc.zip && rm kwc.zip
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
Configure web_server in printer.cfg:
|
||||
```
|
||||
npm run serve
|
||||
[web_server]
|
||||
port: 8080
|
||||
enable_cors: true
|
||||
trusted_clients:
|
||||
192.168.1.0/24
|
||||
127.0.0.1
|
||||
allow_file_ops_when_printing: true
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
Example Klipper macros:
|
||||
```
|
||||
npm run build
|
||||
[pause_resume]
|
||||
|
||||
[gcode_macro CANCEL]
|
||||
default_parameter_X: 230
|
||||
default_parameter_Y: 230
|
||||
default_parameter_Z: 10
|
||||
gcode:
|
||||
M104 S0
|
||||
M140 S0
|
||||
M141 S0
|
||||
M106 S0
|
||||
CLEAR_PAUSE
|
||||
RESET_SD
|
||||
|
||||
[gcode_macro CANCEL_PRINT]
|
||||
gcode:
|
||||
CANCEL
|
||||
|
||||
[gcode_macro PAUSE]
|
||||
rename_existing: BASE_PAUSE
|
||||
default_parameter_X: 230
|
||||
default_parameter_Y: 230
|
||||
default_parameter_Z: 10
|
||||
gcode:
|
||||
SAVE_GCODE_STATE NAME=PAUSE_state
|
||||
BASE_PAUSE
|
||||
G91
|
||||
G1 E-1.7 F2100
|
||||
G1 Z{Z}
|
||||
G90
|
||||
G1 X{X} Y{Y} F6000
|
||||
G91
|
||||
|
||||
[gcode_macro RESUME]
|
||||
rename_existing: BASE_RESUME
|
||||
gcode:
|
||||
G91
|
||||
G1 E1.7 F2100
|
||||
G91
|
||||
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
|
||||
BASE_RESUME
|
||||
```
|
||||
|
||||
### Lints and fixes files
|
||||
## Installation lighttpd
|
||||
```bash
|
||||
sudo apt install lighttpd
|
||||
```
|
||||
npm run lint
|
||||
edit configfile `/etc/lighttpd/lighttpd.conf` and edit following lines:
|
||||
```
|
||||
server.document-root = "/home/pi/kwc"
|
||||
server.port = 81
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo usermod -a -G www-data pi
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||
## Installation haproxy
|
||||
haproxy is necessary to use port 80.
|
||||
|
||||
`sudo apt install haproxy`
|
||||
|
||||
add following lines at the end of `/etc/haproxy/haproxy.cfg`:
|
||||
```
|
||||
frontend public
|
||||
bind :::80 v4v6
|
||||
default_backend lighttpd
|
||||
use_backend printer if { path_beg /printer/ }
|
||||
# use_backend webcam if { path_beg /webcam1/ }
|
||||
|
||||
acl is_websocket path_beg /websocket
|
||||
acl is_websocket hdr(Upgrade) -i WebSocket
|
||||
acl is_websocket hdr_beg(Host) -i ws
|
||||
use_backend websocket if is_websocket
|
||||
|
||||
backend lighttpd
|
||||
reqrep ^([^\ :]*)\ /(.*) \1\ /\2
|
||||
option forwardfor
|
||||
server lighttpd1 127.0.0.1:81
|
||||
|
||||
backend printer
|
||||
reqrep ^([^\ :]*)\ /(.*) \1\ /\2
|
||||
option forwardfor
|
||||
server printer1 127.0.0.1:8080
|
||||
|
||||
backend websocket
|
||||
reqrep ^([^\ :]*)\ /(.*) \1\ /\2
|
||||
option forwardfor
|
||||
server websocket1 127.0.0.1:8080
|
||||
|
||||
#backend webcam
|
||||
# reqrep ^([^\ :]*)\ /webcam1/(.*) \1\ /\2
|
||||
# server webcam1 127.0.0.1:8081
|
||||
```
|
||||
|
||||
all comments are for webcam support. You can install MJPEG-Streamer with this [tutorial](https://github.com/cncjs/cncjs/wiki/Setup-Guide:-Raspberry-Pi-%7C-MJPEG-Streamer-Install-&-Setup-&-FFMpeg-Recording).
|
||||
|
||||
|
||||
## Update KWC to V0.0.7
|
||||
```
|
||||
rm -R ~/kwc/*
|
||||
cd ~/kwc
|
||||
wget -q -O kwc.zip https://github.com/meteyou/kwc/releases/download/v0.0.7/kwc-alpha-0.0.7.zip && unzip kwc.zip && rm kwc.zip
|
||||
```
|
||||
and update your macros
|
||||
Generated
+2039
-1628
File diff suppressed because it is too large.
Load diff
+19
-18
@@ -10,37 +10,38 @@
|
||||
"dependencies": {
|
||||
"axios": "^0.19.2",
|
||||
"chart.js": "^2.9.3",
|
||||
"core-js": "^3.1.2",
|
||||
"vue": "^2.6.10",
|
||||
"core-js": "^3.6.4",
|
||||
"object-assign-deep": "^0.4.0",
|
||||
"vue": "^2.6.11",
|
||||
"vue-chartjs": "^3.5.0",
|
||||
"vue-context": "^5.0.0",
|
||||
"vue-headful": "^2.1.0",
|
||||
"vue-json-rpc-websocket": "^1.0.5",
|
||||
"vue-json-rpc-websocket": "^1.1.1",
|
||||
"vue-resource": "^1.5.1",
|
||||
"vue-simple-upload": "^0.1.6",
|
||||
"vue-toast-notification": "0.0.3",
|
||||
"vuetify": "^2.1.0",
|
||||
"vuetify": "^2.2.17",
|
||||
"vuetify-toast-snackbar": "^0.6.1",
|
||||
"vuex": "^3.1.1"
|
||||
"vuex": "^3.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fortawesome/fontawesome-free": "^5.12.0",
|
||||
"@mdi/font": "^4.5.95",
|
||||
"@vue/cli-plugin-babel": "^4.0.0",
|
||||
"@vue/cli-plugin-eslint": "^4.0.0",
|
||||
"@vue/cli-service": "^4.0.0",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"css-loader": "^3.4.0",
|
||||
"@fortawesome/fontawesome-free": "^5.12.1",
|
||||
"@mdi/font": "^4.9.95",
|
||||
"@vue/cli-plugin-babel": "^4.2.3",
|
||||
"@vue/cli-plugin-eslint": "^4.2.3",
|
||||
"@vue/cli-service": "^4.2.3",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"css-loader": "^3.4.2",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-plugin-vue": "^5.0.0",
|
||||
"material-design-icons-iconfont": "^5.0.1",
|
||||
"sass": "^1.19.0",
|
||||
"sass-loader": "^8.0.0",
|
||||
"sass": "^1.26.3",
|
||||
"sass-loader": "^8.0.2",
|
||||
"vue-cli-plugin-route": "0.0.7",
|
||||
"vue-cli-plugin-vuetify": "^1.1.0",
|
||||
"vue-router": "^3.1.3",
|
||||
"vue-template-compiler": "^2.6.10",
|
||||
"vuetify-loader": "^1.3.0"
|
||||
"vue-cli-plugin-vuetify": "^1.1.2",
|
||||
"vue-router": "^3.1.6",
|
||||
"vue-template-compiler": "^2.6.11",
|
||||
"vuetify-loader": "^1.4.3"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"socket": {
|
||||
"hostname": "voron250.local",
|
||||
"port": 8080,
|
||||
"reconnectInterval": 3000,
|
||||
"reconnectAttempts": 1000
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 1.1 KiB |
+2
-2
@@ -4,8 +4,8 @@
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title>kwc</title>
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico" id="favicon" />
|
||||
<title>KlipperWebControl</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css">
|
||||
</head>
|
||||
|
||||
+82
-24
@@ -1,5 +1,8 @@
|
||||
<template>
|
||||
<v-app>
|
||||
<vue-headful
|
||||
:title="getTitle"
|
||||
/>
|
||||
<v-navigation-drawer
|
||||
class="sidebar-wrapper" persistent v-model="drawer" enable-resize-watcher fixed app
|
||||
:src="require('./assets/bg-navi.jpg')"
|
||||
@@ -9,8 +12,10 @@
|
||||
<v-toolbar-title>{{ hostname }}</v-toolbar-title>
|
||||
</div>
|
||||
<ul class="navi" :expand="$vuetify.breakpoint.mdAndUp">
|
||||
<li v-for="(category, index) in routes" :key="index" :prepend-icon="category.icon" :class="[category.path !== '/' && currentPage.includes(category.path) ? 'active' : '', 'nav-item']" :value="true">
|
||||
<router-link slot="activator" class="nav-link" exact :to="category.path" @click.prevent>
|
||||
<li v-for="(category, index) in routes" :key="index" :prepend-icon="category.icon"
|
||||
:class="[category.path !== '/' && currentPage.includes(category.path) ? 'active' : '', 'nav-item']"
|
||||
:value="true">
|
||||
<router-link slot="activator" class="nav-link" exact :to="category.path" @click.prevent v-if="(category.title === 'Webcam' && boolNaviWebcam) || category.title !== 'Webcam'">
|
||||
<v-icon>mdi-{{ category.icon }}</v-icon>
|
||||
<span class="nav-title">{{ category.title }}</span>
|
||||
<v-icon class="nav-arrow" v-if="category.children && category.children.length > 0">mdi-chevron-down</v-icon>
|
||||
@@ -32,7 +37,7 @@
|
||||
elevate-on-scroll>
|
||||
<v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="green" v-if="!isConnected" :loading="loadingEmergencyStop" @click="emergencyStop"><v-icon class="mr-2">mdi-refresh-circle</v-icon> reconnect</v-btn>
|
||||
<!--<v-btn color="green" v-if="!isConnected" :loading="loadingEmergencyStop" @click="emergencyStop"><v-icon class="mr-2">mdi-refresh-circle</v-icon> reconnect</v-btn>-->
|
||||
<v-btn color="error" v-if="isConnected" :loading="loadingEmergencyStop" @click="emergencyStop">Emergency Stop</v-btn>
|
||||
</v-app-bar>
|
||||
|
||||
@@ -46,16 +51,25 @@
|
||||
</v-scroll-y-transition>
|
||||
</v-content>
|
||||
|
||||
<v-dialog v-model="isConnecting" persistent width="300">
|
||||
<v-card color="primary" dark >
|
||||
<v-card-text class="pt-2">
|
||||
Connecting to Klipper
|
||||
<v-progress-linear indeterminate color="white" class="mb-0"></v-progress-linear>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<v-footer app class="d-block">
|
||||
<span v-if="version">{{ version }}</span>
|
||||
<span class="float-right">© 2019</span>
|
||||
<span class="float-right">© 2020</span>
|
||||
</v-footer>
|
||||
</v-app>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import routes from './routes';
|
||||
import { mapState } from 'vuex';
|
||||
import { mapState, mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@@ -70,24 +84,9 @@ export default {
|
||||
routes: routes
|
||||
}),
|
||||
created () {
|
||||
this.$vuetify.theme.dark = true,
|
||||
this.$vuetify.theme.dark = true;
|
||||
this.$socket.onOpen = () => {
|
||||
this.$socket.sendObj('get_printer_info', {}, 'getKlipperInfo');
|
||||
this.$socket.sendObj('get_printer_objects', {}, 'getObjectInfo');
|
||||
this.$socket.sendObj('get_printer_status', { heater: [] }, 'getObjectInfo');
|
||||
this.$socket.sendObj('post_printer_subscriptions', {
|
||||
gcode: ["gcode_position", "speed", "speed_factor", "extrude_factor", "busy", "abs_extrude"],
|
||||
toolhead: [],
|
||||
virtual_sdcard: [],
|
||||
header: [],
|
||||
heater_bed: [],
|
||||
extruder: ["temperature", "target"],
|
||||
fan: [],
|
||||
pause_resume: [],
|
||||
idle_timeout: [],
|
||||
|
||||
});
|
||||
this.$socket.sendObj('get_printer_files', {}, 'getFileList');
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -100,13 +99,70 @@ export default {
|
||||
version: state => state.printer.version,
|
||||
loadingEmergencyStop: state => state.socket.loadingEmergencyStop,
|
||||
isConnected: state => state.socket.isConnected,
|
||||
isConnecting: state => !state.socket.isConnected,
|
||||
progress: state => state.printer.virtual_sdcard.progress,
|
||||
boolNaviWebcam: state => state.gui.webcam.bool,
|
||||
}),
|
||||
...mapGetters([
|
||||
'getTitle'
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
emergencyStop: function() {
|
||||
this.$store.commit('setLoadingEmergencyStop', true);
|
||||
this.$socket.sendObj('post_printer_gcode', {script: 'M112'}, 'setLoadingEmergencyStop');
|
||||
},
|
||||
drawFavicon(val) {
|
||||
let favicon = document.getElementById('favicon');
|
||||
if (val === 0) favicon.href = "/favicon.ico";
|
||||
else {
|
||||
let faviconSize = 64;
|
||||
|
||||
let canvas = document.createElement('canvas');
|
||||
canvas.width = faviconSize;
|
||||
canvas.height = faviconSize;
|
||||
let context = canvas.getContext('2d');
|
||||
let centerX = canvas.width / 2;
|
||||
let centerY = canvas.height / 2;
|
||||
let radius = 32;
|
||||
let percent = val * 100;
|
||||
|
||||
/* draw the grey circle */
|
||||
context.beginPath();
|
||||
context.moveTo(centerX, centerY);
|
||||
context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
|
||||
context.closePath();
|
||||
context.fillStyle = "#ddd";
|
||||
context.fill();
|
||||
context.strokeStyle = "rgba(200, 208, 218, 0.66)";
|
||||
context.stroke();
|
||||
|
||||
/* draw the green circle based on percentage */
|
||||
let startAngle = 1.5 * Math.PI;
|
||||
let endAngle = 0;
|
||||
let unitValue = (Math.PI - 0.5 * Math.PI) / 25;
|
||||
if (percent >= 0 && percent <= 25) endAngle = startAngle + (percent * unitValue);
|
||||
else if (percent > 25 && percent <= 50) endAngle = startAngle + (percent * unitValue);
|
||||
else if (percent > 50 && percent <= 75) endAngle = startAngle + (percent * unitValue);
|
||||
else if (percent > 75 && percent <= 100) endAngle = startAngle + (percent * unitValue);
|
||||
|
||||
context.beginPath();
|
||||
context.moveTo(centerX, centerY);
|
||||
context.arc(centerX, centerY, radius, startAngle, endAngle, false);
|
||||
context.closePath();
|
||||
context.fillStyle = "#e41313";
|
||||
context.fill();
|
||||
|
||||
favicon.href = canvas.toDataURL('image/png');
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
progress: {
|
||||
handler: function(val) {
|
||||
this.drawFavicon(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -124,7 +180,10 @@ export default {
|
||||
text-align: center;
|
||||
border-bottom: 1px solid #ffffff40;
|
||||
margin-bottom: 1em;
|
||||
padding: .75em 0 .25em 0;
|
||||
padding: .75em 0 .75em 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#nav-header img {
|
||||
@@ -133,9 +192,8 @@ export default {
|
||||
}
|
||||
|
||||
#nav-header .v-toolbar__title {
|
||||
display: inline-block;
|
||||
line-height: 40px;
|
||||
font-size: 24px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.v-navigation-drawer__content {
|
||||
|
||||
+20
-1
@@ -23,7 +23,26 @@ export default {
|
||||
legend: {
|
||||
labels: {
|
||||
fontColor: 'rgb(203, 203, 203)',
|
||||
fontFamily: 'Roboto,sans-serif'
|
||||
fontFamily: 'Roboto,sans-serif',
|
||||
filter: function(item) {
|
||||
return !item.text.includes('_target');
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltips: {
|
||||
enabled: true,
|
||||
callbacks: {
|
||||
title: function (tooltipItem) {
|
||||
let date = new Date(tooltipItem[0].label);
|
||||
return date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
|
||||
},
|
||||
label: function (tooltipItem, data) {
|
||||
let label_target = data['datasets'][tooltipItem.datasetIndex].label+"_target";
|
||||
let target_dataset = data['datasets'].find(dataset => dataset.label === label_target);
|
||||
|
||||
if (target_dataset !== undefined) return tooltipItem.value+" / "+target_dataset.data[tooltipItem.index];
|
||||
return tooltipItem.value;
|
||||
},
|
||||
}
|
||||
},
|
||||
maintainAspectRatio: false,
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-card>
|
||||
<v-row class="">
|
||||
<v-col class="col-12 pb-0 text-center">
|
||||
<div class="d-inline-block mx-2 my-1"><v-btn @click="doHome" :loading="loadingHome" :color="homedAxes.includes('xyz') ? 'primary' : 'warning'" class=""><v-icon class="mr-1">mdi-home</v-icon><span class="d-none d-sm-inline">Home </span>all</v-btn></div>
|
||||
<div class="d-inline-block mx-2 my-1" v-if="config.hasOwnProperty('quad_gantry_level')"><v-btn @click="doQGL" :loading="loadingQGL" color="primary">QGL</v-btn></div>
|
||||
<div class="d-none d-sm-inline-block mx-2 my-1"><v-btn @click="doRestart" :loading="loadingRestart" color="error"><v-icon class="mr-sm-2">mdi-cached</v-icon>Restart</v-btn></div>
|
||||
<div class="d-inline-block mx-2 my-1"><v-btn @click="doRestartFirmware" :loading="loadingRestartFirmware" color="error"><v-icon class="mr-sm-2">mdi-cached</v-icon><span class="d-none d-sm-block">Firmware Restart</span></v-btn></div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="mt-3">
|
||||
<v-col class="col-12 py-0 px-6 text-center">
|
||||
<v-btn-toggle borderless no-gutters style="flex-wrap: nowrap; width: 100%;" >
|
||||
<v-btn @click="doSendMove('X-100')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><v-icon left class="d-sm-flex">mdi-chevron-left</v-icon><span>X-100</span></v-btn>
|
||||
<v-btn @click="doSendMove('X-10')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>X-10</span></v-btn>
|
||||
<v-btn @click="doSendMove('X-1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>X-1</span></v-btn>
|
||||
<v-btn @click="doHomeX" :color="homedAxes.includes('x') ? 'primary' : 'warning'" :loading="loadingHomeX"><v-icon class="mdi mdi-home"></v-icon></v-btn>
|
||||
<v-btn @click="doSendMove('X+1')" cols="1" class="flex-grow-1 flex-shrink-0"><span>X+1</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
|
||||
<v-btn @click="doSendMove('X+10')" cols="1" class="flex-grow-1 flex-shrink-0"><span>X+10</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
|
||||
<v-btn @click="doSendMove('X+100')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><span>X+100</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
|
||||
</v-btn-toggle>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="mt-3">
|
||||
<v-col class="col-12 py-0 px-6 text-center">
|
||||
<v-btn-toggle borderless no-gutters style="flex-wrap: nowrap; width: 100%;" >
|
||||
<v-btn @click="doSendMove('Y-100')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>Y-100</span></v-btn>
|
||||
<v-btn @click="doSendMove('Y-10')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>Y-10</span></v-btn>
|
||||
<v-btn @click="doSendMove('Y-1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>Y-1</span></v-btn>
|
||||
<v-btn @click="doHomeY" :color="homedAxes.includes('y') ? 'primary' : 'warning'" :loading="loadingHomeY"><v-icon class="mdi mdi-home"></v-icon></v-btn>
|
||||
<v-btn @click="doSendMove('Y+1')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Y+1</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
|
||||
<v-btn @click="doSendMove('Y+10')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Y+10</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
|
||||
<v-btn @click="doSendMove('Y+100')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><span>Y+100</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
|
||||
</v-btn-toggle>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="mt-3">
|
||||
<v-col class="col-12 py-0 px-6 text-center">
|
||||
<v-btn-toggle borderless no-gutters style="flex-wrap: nowrap; width: 100%;" >
|
||||
<v-btn @click="doSendMove('Z-25')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>Z-25</span></v-btn>
|
||||
<v-btn @click="doSendMove('Z-1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>Z-1</span></v-btn>
|
||||
<v-btn @click="doSendMove('Z-0.1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>Z-0.1</span></v-btn>
|
||||
<v-btn @click="doHomeZ" :color="homedAxes.includes('z') ? 'primary' : 'warning'" :loading="loadingHomeZ"><v-icon class="mdi mdi-home"></v-icon></v-btn>
|
||||
<v-btn @click="doSendMove('Z+0.1')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Z+0.1</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
|
||||
<v-btn @click="doSendMove('Z+1')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Z+1</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
|
||||
<v-btn @click="doSendMove('Z+25')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><span>Z+25</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
|
||||
</v-btn-toggle>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="" v-if="getMacros.length > 0">
|
||||
<v-col class="col-12 px-0 py-2 text-center">
|
||||
<div v-for="(macro, index) in getMacros" v-bind:key="index+99" class="d-inline-block mx-1 my-1">
|
||||
<v-btn color="primary" class="mx-1 my-1" @click="doSend(macro.name)">{{ macro.name }}</v-btn>
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState, mapGetters, mapMutations } from 'vuex'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
loadingHome: state => state.socket.loadingHome,
|
||||
loadingHomeX: state => state.socket.loadingHomeX,
|
||||
loadingHomeY: state => state.socket.loadingHomeY,
|
||||
loadingHomeZ: state => state.socket.loadingHomeZ,
|
||||
loadingQGL: state => state.socket.loadingQGL,
|
||||
loadingRestart: state => state.socket.loadingRestart,
|
||||
loadingRestartFirmware: state => state.socket.loadingRestartFirmware,
|
||||
homedAxes: state => state.printer.toolhead.homed_axes,
|
||||
config: state => state.config,
|
||||
}),
|
||||
...mapMutations([
|
||||
'setLoadingHome',
|
||||
'setLoadingHomeX',
|
||||
'setLoadingHomeY',
|
||||
'setLoadingHomeZ',
|
||||
'setLoadingQGL',
|
||||
'setLoadingRestart',
|
||||
'setLoadingRestartFirmware',
|
||||
]),
|
||||
...mapGetters([
|
||||
'getMacros',
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
doHome() {
|
||||
this.$store.commit('setLoadingHome', true);
|
||||
this.$socket.sendObj('post_printer_gcode', { script: "G28" }, "responseHome");
|
||||
},
|
||||
doHomeX() {
|
||||
this.$store.commit('setLoadingHomeX', true);
|
||||
this.$socket.sendObj('post_printer_gcode', { script: "G28 X" }, "responseHomeX");
|
||||
},
|
||||
doHomeY() {
|
||||
this.$store.commit('setLoadingHomeY', true);
|
||||
this.$socket.sendObj('post_printer_gcode', { script: "G28 Y" }, "responseHomeY");
|
||||
},
|
||||
doHomeZ() {
|
||||
this.$store.commit('setLoadingHomeZ', true);
|
||||
this.$socket.sendObj('post_printer_gcode', { script: "G28 Z" }, "responseHomeZ");
|
||||
},
|
||||
doQGL() {
|
||||
this.$store.commit('setLoadingQGL', true);
|
||||
this.$socket.sendObj('post_printer_gcode', { script: "quad_gantry_level" }, "responseQGL");
|
||||
},
|
||||
doSendMove(gcode) {
|
||||
gcode = "G91" + "\n" +
|
||||
"G1 " + gcode + " F6000" + "\n" +
|
||||
"G90";
|
||||
|
||||
this.doSend(gcode);
|
||||
},
|
||||
doSend(gcode) {
|
||||
this.$socket.sendObj('post_printer_gcode', { script: gcode }, "sendGcode");
|
||||
},
|
||||
doRestart() {
|
||||
this.$store.commit('setLoadingRestart', true);
|
||||
this.$socket.sendObj('post_printer_restart', { }, "responseRestart");
|
||||
},
|
||||
doRestartFirmware() {
|
||||
this.$store.commit('setLoadingRestartFirmware', true);
|
||||
this.$socket.sendObj('post_printer_firmware_restart', { }, "responseRestartFirmware");
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,48 @@
|
||||
<template>
|
||||
<v-card>
|
||||
<v-list-item>
|
||||
<v-list-item-avatar color="grey"><v-icon dark>fa-exclamation</v-icon></v-list-item-avatar>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title class="headline">Machinelimits</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-card-text class="px-0 pt-0 pb-2 content">
|
||||
<v-row class="px-6" >
|
||||
<v-col sm-12>
|
||||
<toolSlider label="VELOCITY" :target="max_velocity" :max="300" command="SET_VELOCITY_LIMIT" attribute-name="VELOCITY=" class="mt-5" ></toolSlider>
|
||||
<toolSlider label="ACCEL" :target="max_accel" :max="5000" command="SET_VELOCITY_LIMIT" attribute-name="ACCEL=" class="mt-5" ></toolSlider>
|
||||
<toolSlider label="DECEL" :target="max_accel_to_decel" :max="2500" command="SET_VELOCITY_LIMIT" attribute-name="ACCEL_TO_DECEL=" class="mt-5" ></toolSlider>
|
||||
<toolSlider label="SCV" :target="square_corner_velocity" :max="10" command="SET_VELOCITY_LIMIT" attribute-name="SQUARE_CORNER_VELOCITY=" class="mt-5" ></toolSlider>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import toolSlider from '../../inputs/ToolSlider'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
toolSlider
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
max_velocity: state => state.printer.toolhead.max_velocity,
|
||||
max_accel: state => state.printer.toolhead.max_accel,
|
||||
max_accel_to_decel: state => state.printer.toolhead.max_accel_to_decel,
|
||||
square_corner_velocity: state => state.printer.toolhead.square_corner_velocity,
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<v-card>
|
||||
<v-list-item>
|
||||
<v-list-item-avatar color="grey"><v-icon dark>fa-cogs</v-icon></v-list-item-avatar>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title class="headline">Macros</v-list-item-title>
|
||||
<v-list-item-subtitle>
|
||||
{{ getMacros.length }} Macros
|
||||
</v-list-item-subtitle>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-card-text class="px-0 pt-0 pb-2 content text-center">
|
||||
<div v-for="(macro, index) in getMacros" v-bind:key="index+99" class="d-inline-block mx-1 my-1">
|
||||
<v-btn color="primary" class="ml-3" @click="doSend(macro.name)">{{ macro.name }}</v-btn>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters} from 'vuex'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'getMacros',
|
||||
]),
|
||||
},
|
||||
methods: {
|
||||
doSend(gcode) {
|
||||
this.$socket.sendObj('post_printer_gcode', { script: gcode }, "sendGcode");
|
||||
},
|
||||
},
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,90 @@
|
||||
<style>
|
||||
.icon-rotate {
|
||||
animation-name: spin;
|
||||
animation-duration: 1000ms;
|
||||
animation-iteration-count: infinite;
|
||||
animation-timing-function: linear;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
} to {
|
||||
transform: rotate(-360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<v-card class="mt-4" v-if="bool_fan">
|
||||
<v-toolbar flat dense >
|
||||
<v-toolbar-title>
|
||||
<span class="subheading"><v-icon :class="fan_speed > 0 ? 'mdi mdi-fan icon-rotate' : 'mdi mdi-fan'" left></v-icon>Tool Fan</span>
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
|
||||
<v-card-text class="pb-0">
|
||||
<tool-slider :target="fan_speed" :multi="100" command="M106" attribute-name="S" :attribute-scale="2.55" ></tool-slider>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
<v-card class="mt-4" v-if="is_printing">
|
||||
<v-toolbar flat dense >
|
||||
<v-toolbar-title>
|
||||
<span class="subheading"><v-icon class="mdi mdi-timer" left></v-icon>Speed Factor</span>
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
|
||||
<v-card-text class="pb-0">
|
||||
<tool-slider :target="speed_factor" :max="200" :multi="100" command="M220" attribute-name="S" ></tool-slider>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
<v-card class="mt-4" v-if="is_printing">
|
||||
<v-toolbar flat dense >
|
||||
<v-toolbar-title>
|
||||
<span class="subheading"><v-icon class="mdi mdi-texture" left></v-icon>Extrusion Factor</span>
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
|
||||
<v-card-text class="pb-0">
|
||||
<tool-slider :target="extrude_factor" :max="200" :multi="100" command="M221" attribute-name="S" ></tool-slider>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters, mapState} from 'vuex'
|
||||
import ToolSlider from '../../inputs/ToolSlider'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
ToolSlider
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
fan_speed: state => state.printer.fan.speed,
|
||||
extrude_factor: state => state.printer.gcode.extrude_factor,
|
||||
speed_factor: state => state.printer.gcode.speed_factor,
|
||||
}),
|
||||
...mapGetters([
|
||||
'bool_fan',
|
||||
'is_printing'
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
|
||||
},
|
||||
mounted () {
|
||||
|
||||
},
|
||||
watch: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,58 @@
|
||||
|
||||
<template>
|
||||
<v-card>
|
||||
<v-list-item>
|
||||
<v-list-item-avatar color="grey"><v-icon dark>mdi-view-dashboard</v-icon></v-list-item-avatar>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title class="headline">Dashboard</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-card-text class="px-0 pb-0 pt-3 content">
|
||||
<v-row>
|
||||
<v-col class="px-10 py-0">
|
||||
<v-switch v-model="boolShowWebcamOnDashboard" label="Webcam"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="px-10 py-0">
|
||||
<v-switch v-model="boolShowTempchartOnDashboard" label="Tempchart"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
components: {
|
||||
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
boolShowWebcamOnDashboard: {
|
||||
get() {
|
||||
return this.$store.state.gui.dashboard.boolWebcam;
|
||||
},
|
||||
set(status) {
|
||||
return this.$store.dispatch('setSettings', { gui: { dashboard: { boolWebcam: status } } });
|
||||
}
|
||||
},
|
||||
boolShowTempchartOnDashboard: {
|
||||
get() {
|
||||
return this.$store.state.gui.dashboard.boolTempchart;
|
||||
},
|
||||
set(status) {
|
||||
return this.$store.dispatch('setSettings', { gui: { dashboard: { boolTempchart: status } } });
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,49 @@
|
||||
|
||||
<template>
|
||||
<v-card>
|
||||
<v-list-item>
|
||||
<v-list-item-avatar color="grey"><v-icon dark>mdi-code-tags</v-icon></v-list-item-avatar>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title class="headline">Macros</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-card-text class="px-0 pb-3 pt-3 content">
|
||||
<div v-for="(macro, index) in getAllMacros" v-bind:key="index">
|
||||
<v-row>
|
||||
<v-col class="px-10 py-0">
|
||||
<settings-macro-switch :name="macro.name"></settings-macro-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState, mapGetters } from 'vuex';
|
||||
import SettingsMacroSwitch from "../../../inputs/SettingsMacroSwitch";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
SettingsMacroSwitch
|
||||
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
hiddenMacros: state => state.gui.dashboard.hiddenMacros,
|
||||
}),
|
||||
...mapGetters([
|
||||
'getAllMacros',
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,66 @@
|
||||
<style>
|
||||
.webcamImage {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-card>
|
||||
<v-list-item>
|
||||
<v-list-item-avatar color="grey"><v-icon dark>mdi-webcam</v-icon></v-list-item-avatar>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title class="headline">Webcam</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-card-text class="px-0 pb-0 pt-3 content">
|
||||
<v-row>
|
||||
<v-col class="px-10 py-0">
|
||||
<v-text-field
|
||||
v-model="webcamUrl"
|
||||
label="Webcam URL"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="px-10 py-0">
|
||||
<v-switch v-model="boolNavi" label="Show in Navigation"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
components: {
|
||||
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
webcamUrl: {
|
||||
get() {
|
||||
return this.$store.state.webcam.url;
|
||||
},
|
||||
set(newWebcamUrl) {
|
||||
return this.$store.dispatch('setSettings', { webcam: { url: newWebcamUrl } });
|
||||
}
|
||||
},
|
||||
boolNavi: {
|
||||
get() {
|
||||
return this.$store.state.gui.webcam.bool;
|
||||
},
|
||||
set(bool) {
|
||||
return this.$store.dispatch('setSettings', { gui: { webcam: { bool: bool } } });
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,13 @@
|
||||
import Vue from 'vue'
|
||||
|
||||
import WebcamPanel from './WebcamPanel.vue'
|
||||
import DashboardPanel from "./DashboardPanel";
|
||||
import MacrosPanel from "./MacrosPanel";
|
||||
|
||||
Vue.component('settings-webcam-panel', WebcamPanel);
|
||||
Vue.component('settings-dashboard-panel', DashboardPanel);
|
||||
Vue.component('settings-macros-panel', MacrosPanel);
|
||||
|
||||
export default {
|
||||
|
||||
}
|
||||
@@ -4,11 +4,11 @@
|
||||
<v-list-item-avatar color="grey"><v-icon dark>fa-info</v-icon></v-list-item-avatar>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title class="headline">Status</v-list-item-title>
|
||||
<v-list-item-subtitle>{{ toolhead !== null && 'status' in toolhead ? toolhead.status : "" }}</v-list-item-subtitle>
|
||||
<v-list-item-subtitle class="mr-3">{{ printer_state }}{{ printer_is_printing ? " - "+current_file : "" }}</v-list-item-subtitle>
|
||||
</v-list-item-content>
|
||||
<v-btn class="orange" v-if="toolhead && toolhead.status === 'Printing'" @click="btnPauseJob" :loading="btnStatusPause">pause job</v-btn>
|
||||
<v-btn class="orange" v-if="(toolhead && toolhead.status === 'Ready') && is_paused" :loading="btnStatusResume" @click="btnResumeJob">resume job</v-btn>
|
||||
<v-btn class="red ml-2" v-if="(toolhead && toolhead.status === 'Ready') && is_paused" :loading="btnStatusCancel" @click="btnCancelJob">cancel job</v-btn>
|
||||
<v-btn class="orange" v-if="printer_state === 'Printing' && printer_is_printing" @click="btnPauseJob" :loading="btnStatusPause">pause job</v-btn>
|
||||
<v-btn class="red" v-if="(is_printing && printer_is_paused)" :loading="btnStatusCancel" @click="btnCancelJob">cancel job</v-btn>
|
||||
<v-btn class="orange ml-2" v-if="(is_printing && printer_is_paused)" :loading="btnStatusResume" @click="btnResumeJob">resume job</v-btn>
|
||||
</v-list-item>
|
||||
<v-divider class="my-2" ></v-divider>
|
||||
<v-card-text class="px-0 pt-0 pb-2 content">
|
||||
@@ -35,31 +35,55 @@
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-divider class="my-2" v-if="(toolhead && toolhead.status === 'Printing') || is_paused"></v-divider>
|
||||
<v-layout wrap class=" text-center" v-if="(toolhead && toolhead.status === 'Printing') || is_paused">
|
||||
<v-divider class="my-2" v-if="is_printing"></v-divider>
|
||||
<v-layout wrap class=" text-center" v-if="is_printing">
|
||||
<v-flex col tag="strong" class="category-header">
|
||||
Printstatus
|
||||
</v-flex>
|
||||
<v-flex grow class="equal-width">
|
||||
<v-layout column>
|
||||
<v-flex tag="strong">printing</v-flex>
|
||||
<v-flex tag="span">{{ formatTime(toolhead.printing_time) }}</v-flex>
|
||||
<v-flex tag="strong">Filament used</v-flex>
|
||||
<v-flex tag="span">{{ filament_used.toFixed(2) }}mm</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
<v-flex grow class="equal-width">
|
||||
<v-layout column>
|
||||
<v-flex tag="strong">estimated</v-flex>
|
||||
<v-flex tag="strong">Print Time</v-flex>
|
||||
<v-flex tag="span">{{ formatTime(print_time) }}</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
<v-flex grow class="equal-width">
|
||||
<v-layout column>
|
||||
<v-flex tag="strong">total</v-flex>
|
||||
<v-flex tag="span">{{ formatTime(print_time + toolhead.printing_time) }}</v-flex>
|
||||
<v-flex tag="strong">Total Time</v-flex>
|
||||
<v-flex tag="span">{{ formatTime(print_time_total) }}</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout wrap class=" text-center" v-if="(toolhead && toolhead.status === 'Printing') || is_paused">
|
||||
<v-divider class="my-2" v-if="is_printing"></v-divider>
|
||||
<v-layout wrap class=" text-center" v-if="is_printing">
|
||||
<v-flex col tag="strong" class="category-header py-0">
|
||||
Estimations<br />based on
|
||||
</v-flex>
|
||||
<v-flex grow class="equal-width">
|
||||
<v-layout column>
|
||||
<v-flex tag="strong">File</v-flex>
|
||||
<v-flex tag="span">{{ print_time > 0 && printProgress > 0 ? formatTime(print_time / printProgress - print_time) : '--' }}</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
<v-flex grow class="equal-width">
|
||||
<v-layout column>
|
||||
<v-flex tag="strong">Filament</v-flex>
|
||||
<v-flex tag="span">{{ filament_used > 0 && current_file_filament_used > 0 ? formatTime(print_time / (filament_used / current_file_filament_used) - print_time) : '--' }}</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
<v-flex grow class="equal-width">
|
||||
<v-layout column>
|
||||
<v-flex tag="strong">Slicer</v-flex>
|
||||
<v-flex tag="span">{{ current_file_estimated_time > print_time ? formatTime(current_file_estimated_time - print_time) : formatTime(0) }}</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout wrap class=" text-center" v-if="is_printing">
|
||||
<v-layout column class="mt-2" >
|
||||
<v-progress-linear
|
||||
:value="printProgress * 100"
|
||||
@@ -76,23 +100,41 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex';
|
||||
import { mapState, mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
data: () => ({
|
||||
progress: 0.15
|
||||
|
||||
|
||||
}),
|
||||
computed: {
|
||||
...mapState({
|
||||
toolhead: state => state.printer.toolhead,
|
||||
position: state => state.printer.toolhead.position,
|
||||
is_paused: state => state.printer.pause_resume.is_paused,
|
||||
btnStatusPause: state => state.socket.loadingPrintPause,
|
||||
btnStatusResume: state => state.socket.loadingPrintResume,
|
||||
btnStatusCancel: state => state.socket.loadingPrintCancel,
|
||||
|
||||
estimated_print_time: state => state.printer.toolhead.estimated_print_time,
|
||||
|
||||
printProgress: state => state.printer.virtual_sdcard.progress,
|
||||
print_time: state => state.printer.idle_timeout.printing_time,
|
||||
print_time: state => state.printer.virtual_sdcard.print_duration,
|
||||
print_time_total: state => state.printer.virtual_sdcard.total_duration,
|
||||
filament_used: state => state.printer.virtual_sdcard.filament_used,
|
||||
file_position: state => state.printer.virtual_sdcard.file_position,
|
||||
current_file: state => state.printer.virtual_sdcard.current_file,
|
||||
printer_state: state => state.printer.idle_timeout.state,
|
||||
printer_is_paused: state => state.printer.pause_resume.is_paused,
|
||||
printer_is_printing: state => state.printer.virtual_sdcard.is_active,
|
||||
}),
|
||||
|
||||
...mapGetters([
|
||||
'current_file_size',
|
||||
'current_file_metadata',
|
||||
'current_file_estimated_time',
|
||||
'current_file_filament_used',
|
||||
'is_printing',
|
||||
]),
|
||||
},
|
||||
methods: {
|
||||
btnPauseJob() {
|
||||
@@ -112,7 +154,7 @@
|
||||
date.setSeconds(seconds);
|
||||
|
||||
return date.toISOString().substr(11,8);
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,14 +1,24 @@
|
||||
<style>
|
||||
#line-chart {
|
||||
height: 250px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-card>
|
||||
<v-list-item>
|
||||
<v-list-item-avatar color="grey"><v-icon dark>fa-thermometer-three-quarters</v-icon></v-list-item-avatar>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title class="headline">Temperature Chart</v-list-item-title>
|
||||
<v-list-item-subtitle>buxdehude</v-list-item-subtitle>
|
||||
<v-list-item-subtitle>
|
||||
<span>{{ heatersCount }} heaters</span>
|
||||
<span v-if="temperature_fans.length === 1">, {{ temperature_fans.length }} fan</span>
|
||||
<span v-if="temperature_fans.length > 1">, {{ temperature_fans.length }} fans</span>
|
||||
</v-list-item-subtitle>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-card-text class="px-0 pt-0 pb-2 content">
|
||||
<v-card-text class="pt-0 pb-2 content">
|
||||
<line-chart :chart-data="chartdata" v-if="loaded"></line-chart>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
@@ -16,7 +26,7 @@
|
||||
|
||||
<script>
|
||||
import LineChart from '../../charts/LineChart.js'
|
||||
import { mapState } from 'vuex'
|
||||
import { mapGetters, mapState } from 'vuex'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -35,7 +45,11 @@
|
||||
...mapState({
|
||||
labels: state => state.temperaturChart.labels,
|
||||
datasets: state => state.temperaturChart.datasets,
|
||||
})
|
||||
}),
|
||||
...mapGetters([
|
||||
'heatersCount',
|
||||
'temperature_fans'
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
fillData () {
|
||||
|
||||
@@ -10,55 +10,104 @@
|
||||
<v-list-item-avatar color="grey"><v-icon dark>fa-thermometer-three-quarters</v-icon></v-list-item-avatar>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title class="headline">Heaters</v-list-item-title>
|
||||
<v-list-item-subtitle>{{ heatersCount }} heaters</v-list-item-subtitle>
|
||||
<v-list-item-subtitle>
|
||||
{{ heatersCount }} heaters
|
||||
<span v-if="temperature_fans.length === 1">, {{ temperature_fans.length }} fan</span>
|
||||
<span v-if="temperature_fans.length > 1">, {{ temperature_fans.length }} fans</span>
|
||||
</v-list-item-subtitle>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-card-text class="px-0 pt-0 pb-2 content">
|
||||
<v-row class="pl-3 pr-3">
|
||||
<v-col class="text-center"><b>Heater</b></v-col>
|
||||
<v-col class="text-center"><b>Current</b></v-col>
|
||||
<v-col class="text-center"><b>Target</b></v-col>
|
||||
<v-col class="text-center py-0"><b>Heater</b></v-col>
|
||||
<v-col class="text-center py-0"><b>Current</b></v-col>
|
||||
<v-col class="text-center py-0"><b>Target</b></v-col>
|
||||
</v-row>
|
||||
<div v-for="(heater, index) in heaters" v-bind:key="index" >
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-row class="pl-3 pr-3 heater-row">
|
||||
<v-col class="text-center">
|
||||
<v-col class="text-center py-0">
|
||||
<b>{{ heater.name }}</b><br />
|
||||
<small>{{ heater.target > 0 ? "active" : "off" }}</small>
|
||||
</v-col>
|
||||
<v-col class="text-center vertical_align_center"><span>{{ heater.temperature.toFixed(1) }}°C</span></v-col>
|
||||
<v-col class="text-center vertical_align_center">
|
||||
<toolInput :name="heater.name" :target="heater.target" ></toolInput>
|
||||
<v-col class="text-center py-0 vertical_align_center"><span>{{ heater.temperature.toFixed(1) }}°C</span></v-col>
|
||||
<v-col class="text-center py-0 vertical_align_center">
|
||||
<toolInput :name="heater.name" :target="heater.target" command="SET_HEATER_TEMPERATURE" attribute-name="HEATER" ></toolInput>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
<div v-for="(fan, index) in temperature_fans" v-bind:key="index+99" >
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-row class="pl-3 pr-3 heater-row">
|
||||
<v-col class="text-center py-0">
|
||||
<b>{{ fan.name }}</b><br />
|
||||
<small>{{ fan.target > 0 && fan.speed > 0 ? (fan.speed * 100).toFixed(0)+"%" : (fan.target > 0 ? "standby" : "off") }}</small>
|
||||
</v-col>
|
||||
<v-col class="text-center py-0 vertical_align_center"><span>{{ fan.temperature.toFixed(1) }}°C</span></v-col>
|
||||
<v-col class="text-center py-0 vertical_align_center">
|
||||
<toolInput :name="fan.name" :target="fan.target" command="SET_TEMPERATURE_FAN_TARGET" attribute-name="temperature_fan" ></toolInput>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
<v-divider class="my-2" v-if="boolTempchart"></v-divider>
|
||||
<v-row v-if="boolTempchart">
|
||||
<v-col>
|
||||
<line-chart :chart-data="chartdata" v-if="loaded"></line-chart>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import {mapGetters, mapState} from 'vuex'
|
||||
import toolInput from '../../inputs/ToolInput'
|
||||
|
||||
import LineChart from '../../charts/LineChart.js'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
toolInput
|
||||
toolInput,
|
||||
LineChart
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
extruderTemps: [250,215,195,0]
|
||||
extruderTemps: [250,215,195,0],
|
||||
loaded: false,
|
||||
chartdata: {
|
||||
labels: [],
|
||||
datasets: []
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
labels: state => state.temperaturChart.labels,
|
||||
datasets: state => state.temperaturChart.datasets,
|
||||
boolTempchart: state => state.gui.dashboard.boolTempchart,
|
||||
}),
|
||||
...mapGetters([
|
||||
'heaters',
|
||||
'heatersCount'
|
||||
'heatersCount',
|
||||
'temperature_fans',
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
|
||||
fillData () {
|
||||
this.loaded = true;
|
||||
this.chartdata = {
|
||||
labels: this.labels,
|
||||
datasets: this.datasets
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.fillData();
|
||||
},
|
||||
watch: {
|
||||
labels() {
|
||||
this.fillData();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<style>
|
||||
.webcamImage {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-card>
|
||||
<v-list-item>
|
||||
<v-list-item-avatar color="grey"><v-icon dark>mdi-webcam</v-icon></v-list-item-avatar>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title class="headline">Webcam</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-card-text class="px-0 py-0 content">
|
||||
<img :src="webcamUrl" class="webcamImage" />
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
webcamUrl: state => state.webcam.url,
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -3,11 +3,22 @@ import Vue from 'vue'
|
||||
import StatusPanel from './StatusPanel.vue'
|
||||
import ToolsPanel from './ToolsPanel.vue'
|
||||
import TempchartPanel from './TempchartPanel.vue'
|
||||
import ControlPanel from "./ControlPanel";
|
||||
import Peripherie from "./PeripheriePanel";
|
||||
import MacrosPanel from "./MacrosPanel";
|
||||
import LimitsPanel from "./LimitsPanel";
|
||||
import WebcamPanel from "./WebcamPanel";
|
||||
import Settings from "./Settings/";
|
||||
|
||||
Vue.component('status-panel', StatusPanel);
|
||||
Vue.component('tools-panel', ToolsPanel);
|
||||
Vue.component('tempchart-panel', TempchartPanel);
|
||||
Vue.component('control-panel', ControlPanel);
|
||||
Vue.component('peripherie-panel', Peripherie);
|
||||
Vue.component('macros-panel', MacrosPanel);
|
||||
Vue.component('limits-panel', LimitsPanel);
|
||||
Vue.component('webcam-panel', WebcamPanel);
|
||||
|
||||
export default {
|
||||
StatusPanel,
|
||||
Settings
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<style>
|
||||
.settings_macro_switch .v-messages {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-switch v-model="value" :label="name.toUpperCase()" @change="setValue" class="settings_macro_switch mt-0"></v-switch>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex';
|
||||
|
||||
export default {
|
||||
data: function() {
|
||||
return {
|
||||
value: false
|
||||
}
|
||||
},
|
||||
props: {
|
||||
name: String,
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
hiddenMacros: state => state.gui.dashboard.hiddenMacros
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
setValue() {
|
||||
if (this.value) {
|
||||
let index = this.hiddenMacros.indexOf(this.name);
|
||||
if (index > -1) this.hiddenMacros.splice(index, 1);
|
||||
} else this.hiddenMacros.push(this.name);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
hiddenMacros: function() {
|
||||
this.value = !this.hiddenMacros.includes(this.name);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.value = !this.hiddenMacros.includes(this.name);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -25,13 +25,15 @@
|
||||
props: {
|
||||
name: String,
|
||||
target: Number,
|
||||
command: String,
|
||||
attributeName: String,
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
methods: {
|
||||
setTemps() {
|
||||
this.$socket.sendObj('post_printer_gcode', {script: 'SET_HEATER_TEMPERATURE HEATER='+this.name+' TARGET='+this.value});
|
||||
this.$socket.sendObj('post_printer_gcode', {script: this.command+' '+this.attributeName+'='+this.name+' TARGET='+this.value});
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-row>
|
||||
<v-col class="col-auto"><v-icon @click="decrement">mdi-minus</v-icon></v-col>
|
||||
<v-col class="col"><v-slider v-model="value" thumb-label="always" :label="label" :min="min" :max="max" @change="sendCmd" hide-details></v-slider></v-col>
|
||||
<v-col class="col-auto"><v-icon @click="increment">mdi-plus</v-icon></v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data: function() {
|
||||
return {
|
||||
value: this.target * this.multi
|
||||
}
|
||||
},
|
||||
props: {
|
||||
target: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
command: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
attributeName: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: ''
|
||||
},
|
||||
label: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: ''
|
||||
},
|
||||
attributeScale: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 1
|
||||
},
|
||||
min: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 0
|
||||
},
|
||||
max: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 100
|
||||
},
|
||||
multi: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 1
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
methods: {
|
||||
sendCmd() {
|
||||
this.$socket.sendObj('post_printer_gcode', { script: this.command+' '+this.attributeName+(this.value*this.attributeScale).toFixed(0) });
|
||||
},
|
||||
decrement() {
|
||||
this.value--;
|
||||
this.sendCmd();
|
||||
},
|
||||
increment() {
|
||||
this.value++;
|
||||
this.sendCmd();
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
target: function() {
|
||||
this.value = this.target * this.multi;
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
+29
-11
@@ -6,12 +6,8 @@ import VueResource from 'vue-resource'
|
||||
import './components'
|
||||
import store from './store'
|
||||
import router from './plugins/router'
|
||||
import { hostname } from './store/variables'
|
||||
import 'vue-toast-notification/dist/index.css';
|
||||
|
||||
Vue.use(JRPCWS, 'ws://' + hostname + '/websocket', {
|
||||
store: store
|
||||
});
|
||||
import vueHeadful from 'vue-headful';
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
@@ -22,9 +18,31 @@ Vue.http.headers.common['Accept'] = 'application/json, text/plain, */*';
|
||||
Vue.http.headers.common['Access-Control-Allow-Headers'] = 'Origin, Accept, Content-Type, Authorization, Access-Control-Allow-Origin';
|
||||
Vue.http.headers.common['Access-Control-Allow-Methods'] = 'POST, GET, PUT, OPTIONS, DELETE, OPTIONS';
|
||||
|
||||
new Vue({
|
||||
vuetify,
|
||||
router,
|
||||
store,
|
||||
render: h => h(App)
|
||||
}).$mount('#app')
|
||||
Vue.component('vue-headful', vueHeadful);
|
||||
|
||||
fetch('/config.json').then(res => res.json()).then(file => {
|
||||
store.commit('setSettings', file);
|
||||
|
||||
Vue.use(JRPCWS, 'ws://' + store.state.socket.hostname + ':' + store.state.socket.port + '/websocket', {
|
||||
store: store,
|
||||
reconnectEnabled: true,
|
||||
reconnectInterval: store.state.socket.reconnectInterval,
|
||||
reconnectAttempts: store.state.socket.reconnectAttempts,
|
||||
});
|
||||
|
||||
new Vue({
|
||||
data(){
|
||||
return file
|
||||
},
|
||||
vuetify,
|
||||
router,
|
||||
store,
|
||||
render: h => h(App)
|
||||
}).$mount('#app')
|
||||
}).catch((error) => {
|
||||
let p = document.createElement("p");
|
||||
let content = document.createTextNode("config.json not found or cannot be decoded!");
|
||||
p.appendChild(content);
|
||||
document.getElementById('app').append(p);
|
||||
window.console.error('Error:', error);
|
||||
});
|
||||
+59
-7
@@ -29,11 +29,16 @@
|
||||
<v-row>
|
||||
<v-col class="col">
|
||||
<v-text-field
|
||||
v-model="gcode"
|
||||
label="Send code..."
|
||||
solo
|
||||
class="gcode-command-field"
|
||||
v-on:keyup.enter="doSend"
|
||||
v-model="gcode"
|
||||
:items="items"
|
||||
label="Send code..."
|
||||
solo
|
||||
class="gcode-command-field"
|
||||
ref="gcodeCommandField"
|
||||
v-on:keyup.enter="doSend"
|
||||
v-on:keyup.up="onKeyUp"
|
||||
v-on:keyup.down="onKeyDown"
|
||||
v-on:keydown.tab="getAutocomplete"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
@@ -76,7 +81,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapState } from 'vuex';
|
||||
import { mapState, mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
data () {
|
||||
@@ -99,13 +104,22 @@
|
||||
],
|
||||
options: {
|
||||
|
||||
}
|
||||
},
|
||||
lastCommands: [
|
||||
|
||||
],
|
||||
lastCommandNumber: null,
|
||||
items: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
events: state => state.events,
|
||||
helplist: state => state.helplist,
|
||||
}),
|
||||
...mapGetters([
|
||||
'getMacros'
|
||||
]),
|
||||
loadingSendGcode: {
|
||||
get() {
|
||||
return this.$store.state.socket.loadingSendGcode
|
||||
@@ -119,11 +133,49 @@
|
||||
doSend() {
|
||||
this.loadingSendGcode = true;
|
||||
this.$socket.sendObj('post_printer_gcode', { script: this.gcode }, "sendGcode");
|
||||
this.lastCommands.push(this.gcode);
|
||||
this.gcode = "";
|
||||
this.lastCommandNumber = null;
|
||||
},
|
||||
formatMessage(message) {
|
||||
message = message.replace(/(?:\r\n|\r|\n)/g, '<br>');
|
||||
|
||||
return message;
|
||||
},
|
||||
onKeyUp() {
|
||||
if (this.lastCommandNumber === null && this.lastCommands.length) {
|
||||
this.lastCommandNumber = this.lastCommands.length - 1;
|
||||
this.gcode = this.lastCommands[this.lastCommandNumber];
|
||||
} else if (this.lastCommandNumber > 0) {
|
||||
this.lastCommandNumber--;
|
||||
this.gcode = this.lastCommands[this.lastCommandNumber];
|
||||
}
|
||||
},
|
||||
onKeyDown() {
|
||||
if (this.lastCommandNumber !== null && this.lastCommandNumber < (this.lastCommands.length - 1)) {
|
||||
this.lastCommandNumber++;
|
||||
this.gcode = this.lastCommands[this.lastCommandNumber];
|
||||
} else if (this.lastCommandNumber !== null && this.lastCommandNumber === (this.lastCommands.length - 1)) {
|
||||
this.lastCommandNumber = null;
|
||||
this.gcode = "";
|
||||
}
|
||||
},
|
||||
getAutocomplete(e) {
|
||||
e.preventDefault();
|
||||
if (this.gcode.length) {
|
||||
let commands = this.helplist.filter((element) => element.commandLow.indexOf(this.gcode.toLowerCase()) === 0);
|
||||
if (commands && commands.length === 1) this.gcode = commands[0].command;
|
||||
else {
|
||||
let commands = this.helplist.filter((element) => element.commandLow.includes(this.gcode.toLowerCase()));
|
||||
if (commands && commands.length) {
|
||||
let output = "";
|
||||
commands.forEach(command => output += "<b>"+command.command+":</b> "+command.description+"<br />");
|
||||
|
||||
this.$store.commit('addGcodeResponse', output);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.$refs.gcodeCommandField.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+13
-7
@@ -1,19 +1,25 @@
|
||||
<template>
|
||||
<v-row>
|
||||
<v-col xs12 sm6 md4>
|
||||
<v-col class="col-sm-12 col-md-7">
|
||||
<status-panel></status-panel>
|
||||
<div class="mt-6">
|
||||
<tools-panel></tools-panel>
|
||||
</div>
|
||||
<webcam-panel v-if="showDashboardWebcam" class="mt-6"></webcam-panel>
|
||||
<control-panel class="mt-6"></control-panel>
|
||||
</v-col>
|
||||
<v-col xs12 sm6 md8>
|
||||
<tempchart-panel></tempchart-panel>
|
||||
<v-col class="col-sm-12 col-md-5">
|
||||
<tools-panel></tools-panel>
|
||||
<peripherie-panel></peripherie-panel>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'showDashboardWebcam'
|
||||
])
|
||||
},
|
||||
}
|
||||
</script>
|
||||
+223
-39
@@ -1,19 +1,66 @@
|
||||
<style>
|
||||
.v-data-table .v-data-table-header__icon {
|
||||
margin-left: 7px;
|
||||
}
|
||||
|
||||
.v-data-table th {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.v-data-table .file-list-cursor:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.fileupload-card {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.dragzone {
|
||||
display: table;
|
||||
position: absolute;
|
||||
top: 0; left: 0;
|
||||
width: 100%; height: 100%;
|
||||
z-index: 9999999999;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
transition: visibility 175ms, opacity 175ms;
|
||||
font: bold 42px Oswald, DejaVu Sans, Tahoma, sans-serif;
|
||||
}
|
||||
|
||||
.dragzone:before {
|
||||
display: block;
|
||||
content: ' ';
|
||||
position: absolute;
|
||||
top: 15px; right: 15px; bottom: 15px; left: 15px;
|
||||
border: 3px dashed white;
|
||||
border-radius: 15px;
|
||||
}
|
||||
|
||||
.dragzone .textnode {
|
||||
display: table-cell;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
transition: font-size 175ms;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<v-card>
|
||||
<v-card class="fileupload-card" @dragover="dragOver" @dragleave="dragLeave" @drop.prevent.stop="dragDrop">
|
||||
<v-card-title>
|
||||
G-Code Files
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn :loading="loadingRefresh" @click="refreshFileList"><v-icon class="mr-1">mdi-refresh</v-icon> Refresh</v-btn>
|
||||
<input type="file" ref="fileUpload" style="display: none" @change="uploadFile" />
|
||||
<v-btn color="primary ml-4 " v-if="printStatus == 'Ready'" :loading="loadingUpload" @click="clickUploadButton"><v-icon>mdi-upload</v-icon>Upload</v-btn>
|
||||
<v-btn color="primary ml-4 " v-if="!is_printing" :loading="loadingUpload" @click="clickUploadButton"><v-icon>mdi-upload</v-icon>Upload</v-btn>
|
||||
</v-card-title>
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:options="options"
|
||||
:custom-sort="sort"
|
||||
:sort-by.sync="sortBy"
|
||||
:sort-desc.sync="sortDesc"
|
||||
:items="files"
|
||||
:items-per-page="countPerPage"
|
||||
item-key="date"
|
||||
class="files-table"
|
||||
>
|
||||
@@ -22,25 +69,43 @@
|
||||
</template>
|
||||
|
||||
<template #item="{ item }">
|
||||
<tr @contextmenu="showContextMenu($event, item)" @click="dialog.show = true, dialog.filename = item.filename">
|
||||
<tr @contextmenu="showContextMenu($event, item)" @click="dialog.show = true, dialog.filename = item.filename" class="file-list-cursor">
|
||||
<td class=" ">
|
||||
{{ item.filename }}
|
||||
</td>
|
||||
<td class=" ">
|
||||
<td class="text-no-wrap text-right">
|
||||
{{ formatFilesize(item.size) }}
|
||||
</td>
|
||||
<td class="text-end ">
|
||||
<td class="text-right">
|
||||
{{ formatDate(item.modified) }}
|
||||
</td>
|
||||
<td class="text-no-wrap text-right">
|
||||
{{ item.object_height ? item.object_height.toFixed(2)+' mm' : '--' }}
|
||||
</td>
|
||||
<td class="text-no-wrap text-right">
|
||||
{{ item.layer_height ? item.layer_height.toFixed(2)+' mm' : '--' }}
|
||||
</td>
|
||||
<td class="text-no-wrap text-right">
|
||||
{{ item.filament_used ? item.filament_used.toFixed()+' mm' : '--' }}
|
||||
</td>
|
||||
<td class="text-no-wrap text-right">
|
||||
{{ formatPrintTime(item.estimated_time) }}
|
||||
</td>
|
||||
<td class="text-no-wrap text-right">
|
||||
{{ item.slicer ? item.slicer : '--' }}
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
<div class="dragzone" :style="'visibility: '+dropzone.visibility+'; opacity: '+dropzone.hidden">
|
||||
<div class="textnode">Drop files to add gcode.</div>
|
||||
</div>
|
||||
</v-card>
|
||||
<v-menu v-model="contextMenu.shown" :position-x="contextMenu.x" :position-y="contextMenu.y" absolute offset-y>
|
||||
<v-list>
|
||||
<!--<v-list-item>
|
||||
<v-list-item @click="downloadFile">
|
||||
<v-icon class="mr-1">mdi-cloud-download</v-icon> Download
|
||||
</v-list-item>-->
|
||||
</v-list-item>
|
||||
<v-list-item @click="removeFile">
|
||||
<v-icon class="mr-1">mdi-delete</v-icon> Delete
|
||||
</v-list-item>
|
||||
@@ -60,9 +125,8 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapState } from 'vuex';
|
||||
import { mapState, mapGetters } from 'vuex';
|
||||
import axios from 'axios';
|
||||
import { hostname } from '../store/variables';
|
||||
|
||||
export default {
|
||||
data () {
|
||||
@@ -77,16 +141,41 @@
|
||||
{
|
||||
text: 'Name',
|
||||
value: 'filename',
|
||||
width: '50%'
|
||||
},
|
||||
{
|
||||
text: 'Filesize',
|
||||
value: 'size',
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
text: 'last modified',
|
||||
text: 'Last modified',
|
||||
value: 'modified',
|
||||
align: 'end',
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
text: 'Object Height',
|
||||
value: 'object_height',
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
text: 'Layer Height',
|
||||
value: 'layer_height',
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
text: 'Filament Usage',
|
||||
value: 'filament_used',
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
text: 'Print Time',
|
||||
value: 'estimated_time',
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
text: 'Generated by',
|
||||
value: 'slicer',
|
||||
align: 'right',
|
||||
},
|
||||
],
|
||||
options: {
|
||||
@@ -99,6 +188,10 @@
|
||||
y: 0,
|
||||
item: {}
|
||||
},
|
||||
dropzone: {
|
||||
visibility: 'hidden',
|
||||
opacity: 0,
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -106,36 +199,43 @@
|
||||
files: state => state.files,
|
||||
loadingUpload: state => state.socket.loadingGcodeUpload,
|
||||
loadingRefresh: state => state.socket.loadingGcodeRefresh,
|
||||
printStatus: state => state.printer.toolhead.status,
|
||||
})
|
||||
countPerPage: state => state.gui.gcodefiles.countPerPage,
|
||||
hostname: state => state.socket.hostname,
|
||||
port: state => state.socket.port,
|
||||
}),
|
||||
...mapGetters([
|
||||
'is_printing'
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
uploadFile: function() {
|
||||
if (this.$refs.fileUpload.files.length) {
|
||||
let toast = this.$toast;
|
||||
let file = this.$refs.fileUpload.files[0];
|
||||
let formData = new FormData();
|
||||
formData.append('file', file);
|
||||
this.$store.commit('setLoadingGcodeUpload', true);
|
||||
|
||||
axios.post('http://' + hostname + '/printer/files/upload',
|
||||
formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
}
|
||||
).then((result) => {
|
||||
this.$store.commit('setLoadingGcodeUpload', false);
|
||||
toast.success("Upload of "+result.data.result+" successful!", {
|
||||
icon: 'fa-check'
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
this.$store.commit('setLoadingGcodeUpload', false);
|
||||
toast.error("Cannot upload the file!", {
|
||||
icon: 'fa-exclamation-triangle'
|
||||
});
|
||||
});
|
||||
this.doUploadFile(this.$refs.fileUpload.files[0]);
|
||||
}
|
||||
},
|
||||
doUploadFile: function(file) {
|
||||
let toast = this.$toast;
|
||||
let formData = new FormData();
|
||||
formData.append('file', file);
|
||||
this.$store.commit('setLoadingGcodeUpload', true);
|
||||
|
||||
axios.post('http://' + this.hostname + ':' + this.port + '/printer/files/upload',
|
||||
formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
}
|
||||
).then((result) => {
|
||||
this.$store.commit('setLoadingGcodeUpload', false);
|
||||
toast.success("Upload of "+result.data.result+" successful!", {
|
||||
icon: 'fa-check'
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
this.$store.commit('setLoadingGcodeUpload', false);
|
||||
toast.error("Cannot upload the file!", {
|
||||
icon: 'fa-exclamation-triangle'
|
||||
});
|
||||
});
|
||||
},
|
||||
clickUploadButton: function() {
|
||||
this.$refs.fileUpload.click();
|
||||
},
|
||||
@@ -146,7 +246,7 @@
|
||||
formatDate(date) {
|
||||
let tmp2 = new Date(date);
|
||||
|
||||
return tmp2.toLocaleString();
|
||||
return tmp2.toLocaleString().replace(',', '');
|
||||
},
|
||||
formatFilesize(fileSizeInBytes) {
|
||||
let i = -1;
|
||||
@@ -158,6 +258,23 @@
|
||||
|
||||
return Math.max(fileSizeInBytes, 0.1).toFixed(1) + byteUnits[i];
|
||||
},
|
||||
formatPrintTime(totalSeconds) {
|
||||
if (totalSeconds) {
|
||||
let output = "";
|
||||
|
||||
let hours = Math.floor(totalSeconds / 3600);
|
||||
totalSeconds %= 3600;
|
||||
if (hours) output += hours+"h";
|
||||
let minutes = Math.floor(totalSeconds / 60);
|
||||
if (minutes) output += " "+minutes+"m";
|
||||
let seconds = totalSeconds % 60;
|
||||
if (seconds) output += " "+seconds.toFixed(0)+"s";
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
return '--';
|
||||
},
|
||||
showContextMenu (e, item) {
|
||||
e.preventDefault();
|
||||
this.contextMenu.shown = true;
|
||||
@@ -168,9 +285,17 @@
|
||||
this.contextMenu.shown = true
|
||||
});
|
||||
},
|
||||
downloadFile() {
|
||||
let link = document.createElement("a");
|
||||
link.download = name;
|
||||
link.href = 'http://' + this.hostname + ':' + this.port + '/printer/files/' + this.contextMenu.item.filename;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
},
|
||||
removeFile() {
|
||||
axios.delete(
|
||||
'http://'+hostname+'/printer/files/'+this.contextMenu.item.filename
|
||||
'http://'+ this.hostname + ':' + this.port +'/printer/files/'+this.contextMenu.item.filename
|
||||
).then(() => {
|
||||
this.$toast(this.contextMenu.item.filename+" successfully deleted.", {
|
||||
icon: 'fa-trash'
|
||||
@@ -184,7 +309,66 @@
|
||||
startPrint(filename = "") {
|
||||
this.dialog.show = false;
|
||||
this.$socket.sendObj('post_printer_print_start', { filename: filename }, 'switchToDashboard');
|
||||
}
|
||||
},
|
||||
dragOver(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
this.dropzone.visibility = 'visible';
|
||||
this.dropzone.opacity = 1;
|
||||
},
|
||||
dragLeave(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
this.dropzone.visibility = 'hidden';
|
||||
this.dropzone.opacity = 0;
|
||||
},
|
||||
async dragDrop(e) {
|
||||
e.preventDefault();
|
||||
|
||||
this.dropzone.visibility = 'hidden';
|
||||
this.dropzone.opacity = 0;
|
||||
|
||||
if (!this.is_printing && e.dataTransfer.files.length) {
|
||||
await this.doUploadFile(e.dataTransfer.files[0]);
|
||||
}
|
||||
},
|
||||
sort(items, sortBy, sortDesc) {
|
||||
sortBy = sortBy.length ? sortBy[0] : 'name';
|
||||
sortDesc = sortDesc[0];
|
||||
|
||||
// Sort by index
|
||||
items.sort(function(a, b) {
|
||||
if (a[sortBy] === b[sortBy]) {
|
||||
return 0;
|
||||
}
|
||||
if (a[sortBy] === null || a[sortBy] === undefined) {
|
||||
return -1;
|
||||
}
|
||||
if (b[sortBy] === null || b[sortBy] === undefined) {
|
||||
return 1;
|
||||
}
|
||||
if (a[sortBy].constructor === String && b[sortBy].constructor === String) {
|
||||
return a[sortBy].localeCompare(b[sortBy], undefined, { sensivity: 'base' });
|
||||
}
|
||||
if (a[sortBy] instanceof Array && b[sortBy] instanceof Array) {
|
||||
const reducedA = a[sortBy].length ? a.filament.reduce((a, b) => a + b) : 0;
|
||||
const reducedB = b[sortBy].length ? b.filament.reduce((a, b) => a + b) : 0;
|
||||
return reducedA - reducedB;
|
||||
}
|
||||
return a[sortBy] - b[sortBy];
|
||||
});
|
||||
|
||||
// Deal with descending order
|
||||
if (sortDesc) {
|
||||
items.reverse();
|
||||
}
|
||||
|
||||
// Then make sure directories come first
|
||||
items.sort((a, b) => (a.isDirectory === b.isDirectory) ? 0 : (a.isDirectory ? -1 : 1));
|
||||
return items;
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||
|
||||
<template>
|
||||
<div>
|
||||
Settings - General
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@@ -0,0 +1,32 @@
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<v-row>
|
||||
<v-col col-12>
|
||||
<webcam-panel></webcam-panel>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapState } from 'vuex';
|
||||
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
webcamUrl: state => state.webcam.url,
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-row>
|
||||
<v-col class="col-6">
|
||||
<settings-dashboard-panel></settings-dashboard-panel>
|
||||
</v-col>
|
||||
<v-col class="col-6">
|
||||
<settings-webcam-panel></settings-webcam-panel>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="col-6">
|
||||
<settings-macros-panel></settings-macros-panel>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-fab-transition>
|
||||
<v-btn fab fixed large bottom right :loading="loadingUpload" @click="saveGuiSettings">
|
||||
<v-icon>mdi-check</v-icon>
|
||||
</v-btn>
|
||||
</v-fab-transition>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapState, mapActions } from 'vuex';
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
...mapState({
|
||||
loadingUpload: state => state.socket.loadingSaveGuiConfig,
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
...mapActions([
|
||||
'saveGuiSettings'
|
||||
]),
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,6 +1,10 @@
|
||||
<template>
|
||||
<div>
|
||||
Settings - Machine
|
||||
<v-row>
|
||||
<v-col class="col-sm-12 col-md-6">
|
||||
<limits-panel></limits-panel>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
+19
-12
@@ -1,22 +1,30 @@
|
||||
import Dashboard from '../pages/Dashboard.vue'
|
||||
//import Status from '../pages/Status.vue'
|
||||
import Webcam from '../pages/Webcam.vue'
|
||||
import Console from '../pages/Console.vue'
|
||||
import Files from '../pages/Files.vue'
|
||||
//import SettingsGeneral from '../pages/settings/general.vue'
|
||||
//import SettingsMachine from '../pages/settings/machine.vue'
|
||||
import Settings from '../pages/Settings.vue'
|
||||
import SettingsInterface from '../pages/settings/interface.vue'
|
||||
import SettingsMachine from '../pages/settings/machine.vue'
|
||||
|
||||
const routes = [
|
||||
{
|
||||
title: "Dashboard",
|
||||
path: '/',
|
||||
icon: 'view-dashboard',
|
||||
component: Dashboard
|
||||
component: Dashboard,
|
||||
},
|
||||
{
|
||||
title: "Webcam",
|
||||
path: '/webcam',
|
||||
icon: 'webcam',
|
||||
component: Webcam,
|
||||
},
|
||||
{
|
||||
title: "Console",
|
||||
path: '/console',
|
||||
icon: 'code-tags',
|
||||
component: Console
|
||||
component: Console,
|
||||
},
|
||||
/*{
|
||||
title: "Current Job",
|
||||
@@ -28,27 +36,26 @@ const routes = [
|
||||
title: "G-Code Files",
|
||||
path: '/files',
|
||||
icon: 'printer-3d-nozzle',
|
||||
component: Files
|
||||
component: Files,
|
||||
},
|
||||
/*{
|
||||
{
|
||||
title: "Settings",
|
||||
path: '/settings',
|
||||
icon: 'wrench',
|
||||
component: Settings,
|
||||
children: [
|
||||
{
|
||||
title: 'General',
|
||||
path: '/settings/general',
|
||||
icon: 'settings',
|
||||
component: SettingsGeneral
|
||||
title: 'Interface',
|
||||
path: '/settings/interface',
|
||||
component: SettingsInterface
|
||||
},
|
||||
{
|
||||
title: 'Machine',
|
||||
path: '/settings/machine',
|
||||
icon: 'settings-box',
|
||||
component: SettingsMachine
|
||||
},
|
||||
]
|
||||
},*/
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
import Vue from 'vue'
|
||||
import router from "../plugins/router";
|
||||
import store from "./index";
|
||||
import axios from "axios";
|
||||
|
||||
|
||||
export default {
|
||||
socket_on_open ({ commit }) {
|
||||
commit('setConnected');
|
||||
Vue.prototype.$socket.sendObj('get_printer_status', { }, 'getHelpData');
|
||||
|
||||
fetch('http://'+store.state.socket.hostname+':'+store.state.socket.port+'/printer/files/gui.json')
|
||||
.then(res => res.json()).then(file => {
|
||||
store.commit('setSettings', file);
|
||||
}).catch(function() {
|
||||
window.console.warn('No kwc config file found.');
|
||||
});
|
||||
|
||||
Vue.prototype.$socket.sendObj('get_printer_info', {}, 'getKlipperInfo');
|
||||
Vue.prototype.$socket.sendObj('get_printer_objects', {}, 'getObjectInfo');
|
||||
Vue.prototype.$socket.sendObj('get_printer_status', { heater: [] }, 'getObjectInfo');
|
||||
Vue.prototype.$socket.sendObj('get_printer_status', { configfile: ['config'] }, 'getPrinterConfig');
|
||||
Vue.prototype.$socket.sendObj('post_printer_subscriptions', {
|
||||
gcode: [],
|
||||
toolhead: [],
|
||||
virtual_sdcard: [],
|
||||
heater: [],
|
||||
heater_bed: [],
|
||||
extruder: ["temperature", "target"],
|
||||
fan: [],
|
||||
pause_resume: [],
|
||||
idle_timeout: [],
|
||||
|
||||
});
|
||||
Vue.prototype.$socket.sendObj('get_printer_files', {}, 'getFileList');
|
||||
Vue.prototype.$socket.sendObj('get_printer_gcode_help', {}, 'getHelpList');
|
||||
},
|
||||
|
||||
socket_on_close ({ commit }, event) {
|
||||
commit('setDisconnected');
|
||||
if (event.wasClean) {
|
||||
window.console.log('Socket closed clear')
|
||||
} else {
|
||||
window.console.error('Connection failure')
|
||||
}
|
||||
window.console.error('Code: ' + event.code)
|
||||
},
|
||||
|
||||
socket_on_error ({ commit }, data) {
|
||||
commit('reportError', data);
|
||||
},
|
||||
|
||||
socket_on_message ({ commit, state }, data) {
|
||||
if (!state.socket.isConnected) commit('setConnected');
|
||||
switch(data.method) {
|
||||
case 'notify_status_update':
|
||||
commit('setPrinterData', data.params[0]);
|
||||
break;
|
||||
|
||||
case 'notify_gcode_response':
|
||||
commit('addGcodeResponse', data.params[0]);
|
||||
break;
|
||||
|
||||
case 'notify_printer_state_changed':
|
||||
commit('setPrinterStatus', data.params[0]);
|
||||
break;
|
||||
|
||||
/*case 'notify_klippy_state_changed':
|
||||
commit('setPrinterStatus', data.params[0]);
|
||||
break;*/
|
||||
|
||||
case 'notify_filelist_changed':
|
||||
commit('setFileList', data.params[0].filelist);
|
||||
break;
|
||||
|
||||
case 'notify_paused_state_changed':
|
||||
commit('setPausedState', data.params[0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (data.result !== "ok") {
|
||||
window.console.log("Default return");
|
||||
if (data.error) window.console.error("JSON-RPC: " + data.error.message);
|
||||
else window.console.log(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
socket_reconnect ({ commit }, count) {
|
||||
commit('setConnected');
|
||||
window.console.log(count);
|
||||
Vue.prototype.$socket.sendObj('get_printer_status', { heater: [] }, 'getObjectInfo');
|
||||
Vue.prototype.$socket.sendObj('get_printer_status', { configfile: ['config'] }, 'getPrinterConfig');
|
||||
Vue.prototype.$socket.sendObj('post_printer_subscriptions', {
|
||||
gcode: [],
|
||||
toolhead: [],
|
||||
virtual_sdcard: [],
|
||||
heater: [],
|
||||
heater_bed: [],
|
||||
extruder: ["temperature", "target"],
|
||||
fan: [],
|
||||
pause_resume: [],
|
||||
idle_timeout: [],
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
socket_reconnect_error ({ commit }) {
|
||||
commit('setDisconnected');
|
||||
window.console.error('Socket disconnected')
|
||||
},
|
||||
|
||||
saveGuiSettings({ commit, state }) {
|
||||
commit('setLoadingSaveGuiConfige', true);
|
||||
let file = new File([JSON.stringify({ webcam: state.webcam, gui: state.gui })], 'gui.json');
|
||||
|
||||
let formData = new FormData();
|
||||
formData.append('file', file);
|
||||
|
||||
axios.post('http://' + state.socket.hostname + ':' + state.socket.port + '/printer/files/upload',
|
||||
formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
}
|
||||
).then(() => {
|
||||
commit('setLoadingSaveGuiConfige', false);
|
||||
}).catch(() => {
|
||||
window.console.error("Error save gui.json!");
|
||||
});
|
||||
},
|
||||
|
||||
getKlipperInfo({ commit }, data) {
|
||||
commit('setPrinterData', {
|
||||
hostname: data.hostname,
|
||||
version: data.version
|
||||
});
|
||||
},
|
||||
|
||||
getObjectInfo({ commit }, data) {
|
||||
commit('setObjectData', data);
|
||||
},
|
||||
|
||||
getPrinterConfig({commit}, data) {
|
||||
commit('setPrinterConfig', data);
|
||||
},
|
||||
|
||||
addSubscription(state, data) {
|
||||
window.console.log(state);
|
||||
window.console.log(data);
|
||||
},
|
||||
|
||||
getFileList({ commit }, data) {
|
||||
commit('setFileList', data);
|
||||
commit('setLoadingGcodeRefresh', false);
|
||||
},
|
||||
|
||||
getHelpList({ commit }, data) {
|
||||
commit('setHelpList', data);
|
||||
},
|
||||
|
||||
setLoadingSendGcode({commit}, value) {
|
||||
commit('setLoadingSendGcode', value);
|
||||
},
|
||||
|
||||
setLoadingEmergencyStop({commit}) {
|
||||
commit('setLoadingEmergencyStop', false);
|
||||
},
|
||||
|
||||
setLoadingPrintPause({commit}) {
|
||||
commit('setLoadingPrintPause', false);
|
||||
},
|
||||
|
||||
setLoadingPrintResume({commit}) {
|
||||
commit('setLoadingPrintResume', false);
|
||||
},
|
||||
|
||||
setLoadingPrintCancel({commit}) {
|
||||
commit('setLoadingPrintCancel', false);
|
||||
},
|
||||
|
||||
sendGcode({commit}, data) {
|
||||
commit('setLoadingSendGcode', false);
|
||||
commit('sendGcode', data);
|
||||
},
|
||||
|
||||
responseHome({commit}) {
|
||||
commit('setLoadingHome', false);
|
||||
},
|
||||
|
||||
responseHomeX({commit}) {
|
||||
commit('setLoadingHomeX', false);
|
||||
},
|
||||
|
||||
responseHomeY({commit}) {
|
||||
commit('setLoadingHomeY', false);
|
||||
},
|
||||
|
||||
responseHomeZ({commit}) {
|
||||
commit('setLoadingHomeZ', false);
|
||||
},
|
||||
|
||||
responseQGL({commit}) {
|
||||
commit('setLoadingQGL', false);
|
||||
},
|
||||
|
||||
responseRestart({commit}) {
|
||||
commit('setLoadingRestart', false);
|
||||
},
|
||||
|
||||
responseRestartFirmware({commit}) {
|
||||
commit('setLoadingRestartFirmware', false);
|
||||
},
|
||||
|
||||
switchToDashboard() {
|
||||
router.push("/");
|
||||
},
|
||||
|
||||
getHelpData({ commit }, data) {
|
||||
commit('voidMutation', data);
|
||||
},
|
||||
|
||||
setSettings({ commit }, data) {
|
||||
commit('setSettings', data);
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
export default {
|
||||
toolhead(state) {
|
||||
return (state.socket.isConnected) ? state.printer.toolhead : null;
|
||||
},
|
||||
|
||||
heaters: state => {
|
||||
let heaters = [];
|
||||
|
||||
if (state.object.heater.available_heaters) {
|
||||
for (let [key, value] of Object.entries(state.printer)) {
|
||||
if (state.object.heater.available_heaters.includes(key)) {
|
||||
heaters.push({
|
||||
name: key,
|
||||
target: value.target,
|
||||
temperature: value.temperature,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return heaters.sort((a, b) => {
|
||||
let nameA = a.name.toUpperCase();
|
||||
let nameB = b.name.toUpperCase();
|
||||
|
||||
if (nameA < nameB) return -1;
|
||||
if (nameA > nameB) return 1;
|
||||
|
||||
return 0;
|
||||
});
|
||||
},
|
||||
|
||||
heatersCount: (state, getters) => {
|
||||
return getters.heaters.length;
|
||||
},
|
||||
|
||||
temperature_fans: state => {
|
||||
let fans = [];
|
||||
|
||||
for (let [key, value] of Object.entries(state.printer)) {
|
||||
let nameSplit = key.split(" ");
|
||||
|
||||
if (nameSplit[0] === "temperature_fan") {
|
||||
fans.push({
|
||||
name: nameSplit[1],
|
||||
target: value.target,
|
||||
temperature: value.temperature,
|
||||
speed: value.speed,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return fans.sort((a, b) => {
|
||||
let nameA = a.name.toUpperCase();
|
||||
let nameB = b.name.toUpperCase();
|
||||
|
||||
if (nameA < nameB) return -1;
|
||||
if (nameA > nameB) return 1;
|
||||
|
||||
return 0;
|
||||
});
|
||||
},
|
||||
|
||||
current_file_size: state => {
|
||||
let file = state.files.filter((file) => file.filename === state.printer.virtual_sdcard.current_file);
|
||||
|
||||
if (file.length) return file[0]['size'];
|
||||
|
||||
return 0;
|
||||
},
|
||||
|
||||
current_file_metadata: state => {
|
||||
let file = state.files.filter((file) => file.filename === state.printer.virtual_sdcard.current_file);
|
||||
|
||||
if (file.length) return file[0];
|
||||
|
||||
return []
|
||||
},
|
||||
|
||||
current_file_estimated_time: state => {
|
||||
let file = state.files.filter((file) => file.filename === state.printer.virtual_sdcard.current_file);
|
||||
|
||||
if (file.length) return file[0]['estimated_time'];
|
||||
|
||||
return 0;
|
||||
},
|
||||
|
||||
current_file_filament_used: state => {
|
||||
let file = state.files.filter((file) => file.filename === state.printer.virtual_sdcard.current_file);
|
||||
|
||||
if (file.length) return file[0]['filament_used'];
|
||||
|
||||
return 0;
|
||||
},
|
||||
|
||||
bool_fan: state => {
|
||||
return Object.entries(state.object).indexOf('fan');
|
||||
},
|
||||
|
||||
is_printing: state => {
|
||||
return (state.printer.virtual_sdcard.current_file !== "");
|
||||
},
|
||||
|
||||
getMacros: state => {
|
||||
let array = [];
|
||||
let hiddenMacros = [];
|
||||
state.gui.dashboard.hiddenMacros.forEach(function(item,index) {
|
||||
hiddenMacros[index] = item.toLowerCase();
|
||||
});
|
||||
|
||||
for (let prop in state.config) {
|
||||
if (prop.startsWith('gcode_macro') &&
|
||||
!state.config[prop].hasOwnProperty('rename_existing') &&
|
||||
!(hiddenMacros.indexOf(prop.replace('gcode_macro ', '').toLowerCase()) > -1)
|
||||
) {
|
||||
array.push({
|
||||
'name': prop.replace('gcode_macro ', ''),
|
||||
'prop': state.config[prop]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return array.sort((a, b) => {
|
||||
let nameA = a.name.toUpperCase();
|
||||
let nameB = b.name.toUpperCase();
|
||||
|
||||
if (nameA < nameB) return -1;
|
||||
if (nameA > nameB) return 1;
|
||||
|
||||
return 0;
|
||||
});
|
||||
},
|
||||
|
||||
getAllMacros: state => {
|
||||
let array = [];
|
||||
|
||||
for (let prop in state.config) {
|
||||
if (prop.startsWith('gcode_macro') && !state.config[prop].hasOwnProperty('rename_existing')) {
|
||||
array.push({
|
||||
'name': prop.replace('gcode_macro ', ''),
|
||||
'prop': state.config[prop]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return array.sort((a, b) => {
|
||||
let nameA = a.name.toUpperCase();
|
||||
let nameB = b.name.toUpperCase();
|
||||
|
||||
if (nameA < nameB) return -1;
|
||||
if (nameA > nameB) return 1;
|
||||
|
||||
return 0;
|
||||
});
|
||||
},
|
||||
|
||||
getTitle: state => {
|
||||
if (state.socket.isConnected) {
|
||||
if (state.printer.pause_resume.is_paused) return "Pause Print";
|
||||
else if (state.printer.virtual_sdcard.is_active) return (state.printer.virtual_sdcard.progress * 100).toFixed(0)+"% Printing - "+state.printer.virtual_sdcard.current_file;
|
||||
|
||||
return state.printer.hostname;
|
||||
} else return "KlipperWebControl";
|
||||
},
|
||||
|
||||
showDashboardWebcam: state => {
|
||||
return (state.webcam.url !== "" && state.gui.dashboard.boolWebcam);
|
||||
}
|
||||
}
|
||||
+59
-323
@@ -1,54 +1,91 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
import VueToast from 'vue-toast-notification';
|
||||
import router from '../plugins/router'
|
||||
import actions from './actions'
|
||||
import mutations from './mutations'
|
||||
import getters from './getters'
|
||||
|
||||
Vue.use(Vuex);
|
||||
Vue.use(VueToast);
|
||||
|
||||
let colorArray = [
|
||||
'#F44336',
|
||||
'#E91E63',
|
||||
'#9C27B0',
|
||||
'#673AB7',
|
||||
'#3F51B5',
|
||||
'#00BCD4',
|
||||
'#009688',
|
||||
];
|
||||
|
||||
const colorHeaterBed = '#2196F3';
|
||||
const colorChamber = '#4CAF50';
|
||||
const temperaturChartSampleInterval = 1000;
|
||||
const temperaturChartSampleLength = 600;
|
||||
|
||||
export default new Vuex.Store({
|
||||
state: {
|
||||
socket: {
|
||||
hostname: window.location.hostname,
|
||||
port: 8080,
|
||||
reconnectInterval: 3000,
|
||||
reconnectAttempts: 1000,
|
||||
isConnected: false,
|
||||
loadingGcodeUpload: false,
|
||||
loadingGcodeRefresh: false,
|
||||
loadingEmergencyStop: false,
|
||||
loadingPrintPause: false,
|
||||
loadingPrintResume: false,
|
||||
loadingHome: false,
|
||||
loadingHomeX: false,
|
||||
loadingHomeY: false,
|
||||
loadingHomeZ: false,
|
||||
loadingQGL: false,
|
||||
loadingRestart: false,
|
||||
loadingRestartFirmware: false,
|
||||
loadingSaveGuiConfig: false,
|
||||
},
|
||||
webcam: {
|
||||
url: ""
|
||||
},
|
||||
gui: {
|
||||
dashboard: {
|
||||
boolWebcam: true,
|
||||
boolTempchart: true,
|
||||
hiddenMacros: [],
|
||||
},
|
||||
webcam: {
|
||||
bool: false,
|
||||
},
|
||||
gcodefiles: {
|
||||
countPerPage: 10,
|
||||
}
|
||||
},
|
||||
config: {
|
||||
|
||||
},
|
||||
printer: {
|
||||
hostname: '',
|
||||
version: '',
|
||||
toolhead: {
|
||||
position: [],
|
||||
homed_axes: [],
|
||||
status: "",
|
||||
print_time: 0,
|
||||
printing_time: 0,
|
||||
estimated_print_time: 0,
|
||||
max_velocity: 0,
|
||||
max_accel: 0,
|
||||
max_accel_to_decel: 0,
|
||||
square_corner_velocity: 0,
|
||||
},
|
||||
pause_resume: {
|
||||
is_paused: false
|
||||
},
|
||||
idle_timeout: {
|
||||
printing_time: 0
|
||||
printing_time: 0,
|
||||
state: "",
|
||||
},
|
||||
virtual_sdcard: {
|
||||
process: 0
|
||||
progress: 0,
|
||||
current_file: "",
|
||||
is_active: false,
|
||||
filament_used: 0,
|
||||
file_position: 0,
|
||||
print_duration: 0,
|
||||
total_duration: 0,
|
||||
},
|
||||
gcode: {
|
||||
extrude_factor: 1,
|
||||
speed_factor: 1,
|
||||
},
|
||||
fan: {
|
||||
speed: 0,
|
||||
}
|
||||
},
|
||||
object: {
|
||||
@@ -60,313 +97,12 @@ export default new Vuex.Store({
|
||||
labels: [],
|
||||
datasets: [],
|
||||
},
|
||||
helplist: [],
|
||||
files: [],
|
||||
events: []
|
||||
},
|
||||
|
||||
getters: {
|
||||
toolhead(state) {
|
||||
return (state.socket.isConnected) ? state.printer.toolhead : null;
|
||||
},
|
||||
|
||||
heaters: state => {
|
||||
let heaters = [];
|
||||
|
||||
if (state.object.heater.available_heaters) {
|
||||
for (let [key, value] of Object.entries(state.printer)) {
|
||||
if (state.object.heater.available_heaters.includes(key)) {
|
||||
heaters.push({
|
||||
name: key,
|
||||
target: value.target,
|
||||
temperature: value.temperature,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return heaters.sort((a, b) => {
|
||||
let nameA = a.name.toUpperCase();
|
||||
let nameB = b.name.toUpperCase();
|
||||
|
||||
if (nameA < nameB) return -1;
|
||||
if (nameA > nameB) return 1;
|
||||
|
||||
return 0;
|
||||
});
|
||||
},
|
||||
|
||||
heatersCount: (state, getters) => {
|
||||
return getters.heaters.length;
|
||||
}
|
||||
},
|
||||
|
||||
mutations: {
|
||||
setConnected (state) {
|
||||
state.socket.isConnected = true;
|
||||
},
|
||||
|
||||
setDisconnected (state) {
|
||||
state.socket.isConnected = false
|
||||
},
|
||||
|
||||
setPrinterData(state, data) {
|
||||
Object.assign(state.printer, data);
|
||||
|
||||
if (state.object.heater.available_heaters.length) {
|
||||
let boolAddValues = false;
|
||||
let now = new Date();
|
||||
|
||||
if (state.temperaturChart.labels.length === 0 || now - state.temperaturChart.labels[state.temperaturChart.labels.length - 1] > temperaturChartSampleInterval) {
|
||||
for (let [key, value] of Object.entries(data)) {
|
||||
if (state.object.heater.available_heaters.includes(key)) {
|
||||
let index = state.temperaturChart.datasets.findIndex(element => element.label === key);
|
||||
|
||||
if (index >= 0) state.temperaturChart.datasets[index].data.push(value.temperature.toFixed(1));
|
||||
else {
|
||||
let color = '#f87979';
|
||||
|
||||
switch (key) {
|
||||
case 'heater_bed': color = colorHeaterBed; break;
|
||||
case 'chamber': color = colorChamber; break;
|
||||
default: color = colorArray[state.temperaturChart.datasets.length]; break;
|
||||
}
|
||||
|
||||
state.temperaturChart.datasets.push({
|
||||
label: key,
|
||||
data: [value.temperature.toFixed(1)],
|
||||
borderColor: color,
|
||||
backgroundColor: color,
|
||||
fill: false,
|
||||
borderDash: undefined,
|
||||
borderWidth: 2,
|
||||
pointRadius: 0,
|
||||
pointHitRadius: 0,
|
||||
showLine: true
|
||||
});
|
||||
}
|
||||
|
||||
boolAddValues = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (boolAddValues) {
|
||||
state.temperaturChart.labels.push(now);
|
||||
|
||||
if (state.temperaturChart.labels.length > temperaturChartSampleLength) {
|
||||
state.temperaturChart.labels.splice(0, state.temperaturChart.labels.length-temperaturChartSampleLength)
|
||||
}
|
||||
}
|
||||
|
||||
for (let [key, dataset] of Object.entries(state.temperaturChart.datasets)) {
|
||||
if (dataset.data.length > temperaturChartSampleLength) {
|
||||
state.temperaturChart.datasets[key].data.splice(0, dataset.data.length-temperaturChartSampleLength)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
setObjectData(state, data) {
|
||||
Object.assign(state.object, data);
|
||||
},
|
||||
|
||||
setFileList(state, data) {
|
||||
state.files = data;
|
||||
},
|
||||
|
||||
addGcodeResponse(state, data) {
|
||||
state.events.push({
|
||||
date: new Date(),
|
||||
message: data
|
||||
});
|
||||
|
||||
if (data.substring(0,2) === "//") {
|
||||
data = data.replace("//", "");
|
||||
Vue.$toast.warning(data);
|
||||
} else if (data.substring(0,2) === "!!") {
|
||||
data = data.replace("!!", "");
|
||||
Vue.$toast.error(data);
|
||||
}
|
||||
},
|
||||
|
||||
setLoadingSendGcode(state, value) {
|
||||
state.socket.loadingSendGcode = value;
|
||||
},
|
||||
|
||||
sendGcode(state) {
|
||||
state.socket.loadingSendGcode = false;
|
||||
},
|
||||
|
||||
setPrinterStatus(state, value) {
|
||||
state.printer.toolhead.status = value;
|
||||
},
|
||||
|
||||
setLoadingGcodeUpload(state, value) {
|
||||
state.socket.loadingGcodeUpload = value;
|
||||
},
|
||||
|
||||
setLoadingGcodeRefresh(state, value) {
|
||||
state.socket.loadingGcodeRefresh = value;
|
||||
},
|
||||
|
||||
setLoadingEmergencyStop(state, value) {
|
||||
state.socket.loadingEmergencyStop = value;
|
||||
},
|
||||
|
||||
setLoadingPrintPause(state, value) {
|
||||
state.socket.loadingPrintPause = value;
|
||||
},
|
||||
|
||||
setLoadingPrintResume(state, value) {
|
||||
state.socket.loadingPrintResume = value;
|
||||
},
|
||||
|
||||
setLoadingPrintCancel(state, value) {
|
||||
state.socket.loadingPrintCancel = value;
|
||||
},
|
||||
|
||||
reportError(state, data) {
|
||||
Vue.$toast.error(data.message);
|
||||
},
|
||||
|
||||
setPausedState(state, data) {
|
||||
switch (data) {
|
||||
case 'paused':
|
||||
state.printer.pause_resume.is_paused = true;
|
||||
break;
|
||||
|
||||
case 'resumed':
|
||||
state.printer.pause_resume.is_paused = false;
|
||||
break;
|
||||
|
||||
case 'cleared':
|
||||
state.printer.pause_resume.is_paused = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
window.console.log('setPausedState -> Default: '+data);
|
||||
}
|
||||
},
|
||||
|
||||
voidMutation() {
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
actions: {
|
||||
socket_on_open ({ commit }) {
|
||||
commit('setConnected');
|
||||
window.console.log('Socket connected');
|
||||
},
|
||||
|
||||
socket_on_close ({ commit }, event) {
|
||||
commit('setDisconnected')
|
||||
if (event.wasClean) {
|
||||
window.console.log('Socket closed clear')
|
||||
} else {
|
||||
window.console.error('Connection failure')
|
||||
}
|
||||
window.console.error('Code: ' + event.code)
|
||||
},
|
||||
|
||||
socket_on_error ({ commit }, data) {
|
||||
commit('reportError', data);
|
||||
},
|
||||
|
||||
socket_on_message ({ commit, state }, data) {
|
||||
if (!state.socket.isConnected) commit('setConnected');
|
||||
switch(data.method) {
|
||||
case 'notify_status_update':
|
||||
commit('setPrinterData', data.params[0]);
|
||||
break;
|
||||
|
||||
case 'notify_gcode_response':
|
||||
commit('addGcodeResponse', data.params[0]);
|
||||
break;
|
||||
|
||||
case 'notify_printer_state_changed':
|
||||
commit('setPrinterStatus', data.params[0]);
|
||||
break;
|
||||
|
||||
/*case 'notify_klippy_state_changed':
|
||||
commit('setPrinterStatus', data.params[0]);
|
||||
break;*/
|
||||
|
||||
case 'notify_filelist_changed':
|
||||
commit('setFileList', data.params[0].filelist);
|
||||
break;
|
||||
|
||||
case 'notify_paused_state_changed':
|
||||
commit('setPausedState', data.params[0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
window.console.log("Default return");
|
||||
if (data.error) window.console.error("JSON-RPC: " + data.error.message);
|
||||
else window.console.log(data);
|
||||
}
|
||||
},
|
||||
|
||||
socket_reconnect ({ commit }, count) {
|
||||
commit('setConnected');
|
||||
window.console.log(count)
|
||||
},
|
||||
|
||||
socket_reconnect_error ({ commit }) {
|
||||
commit('setDisconnected');
|
||||
window.console.error('Socket disconnected')
|
||||
},
|
||||
|
||||
getKlipperInfo({ commit }, data) {
|
||||
commit('setPrinterData', {
|
||||
hostname: data.hostname,
|
||||
version: data.version
|
||||
});
|
||||
},
|
||||
|
||||
getObjectInfo({ commit }, data) {
|
||||
commit('setObjectData', data);
|
||||
},
|
||||
|
||||
addSubscription(state, data) {
|
||||
window.console.log(state);
|
||||
window.console.log(data);
|
||||
},
|
||||
|
||||
getFileList({ commit }, data) {
|
||||
commit('setFileList', data);
|
||||
commit('setLoadingGcodeRefresh', false);
|
||||
},
|
||||
|
||||
setLoadingSendGcode({commit}, value) {
|
||||
commit('setLoadingSendGcode', value);
|
||||
},
|
||||
|
||||
setLoadingEmergencyStop({commit}) {
|
||||
commit('setLoadingEmergencyStop', false);
|
||||
},
|
||||
|
||||
setLoadingPrintPause({commit}) {
|
||||
commit('setLoadingPrintPause', false);
|
||||
},
|
||||
|
||||
setLoadingPrintResume({commit}) {
|
||||
commit('setLoadingPrintResume', false);
|
||||
},
|
||||
|
||||
setLoadingPrintCancel({commit}) {
|
||||
commit('setLoadingPrintCancel', false);
|
||||
},
|
||||
|
||||
sendGcode({commit}, data) {
|
||||
commit('setLoadingSendGcode', false);
|
||||
commit('sendGcode', data);
|
||||
},
|
||||
|
||||
switchToDashboard(state) {
|
||||
window.console.log(state);
|
||||
router.push("/");
|
||||
}
|
||||
}
|
||||
getters: getters,
|
||||
mutations: mutations,
|
||||
actions: actions
|
||||
});
|
||||
@@ -0,0 +1,260 @@
|
||||
import Vue from "vue";
|
||||
const objectAssignDeep = require(`object-assign-deep`);
|
||||
import { colorArray, colorChamber, colorHeaterBed, temperaturChartSampleInterval, temperaturChartSampleLength } from './variables';
|
||||
|
||||
export default {
|
||||
setConnected (state) {
|
||||
state.socket.isConnected = true;
|
||||
|
||||
Vue.prototype.$socket
|
||||
},
|
||||
|
||||
setDisconnected (state) {
|
||||
state.socket.isConnected = false
|
||||
Vue.prototype.$socket.reconnect();
|
||||
},
|
||||
|
||||
setPrinterData(state, data) {
|
||||
Object.assign(state.printer, data);
|
||||
|
||||
if (Array.isArray(state.object.heater.available_heaters) && state.object.heater.available_heaters.length) {
|
||||
let boolAddValues = false;
|
||||
let now = new Date();
|
||||
|
||||
if (state.temperaturChart.labels.length === 0 || now - state.temperaturChart.labels[state.temperaturChart.labels.length - 1] > temperaturChartSampleInterval) {
|
||||
for (let [key, value] of Object.entries(data)) {
|
||||
let keySplit = key.split(" ");
|
||||
|
||||
if (state.object.heater.available_heaters.includes(key) || keySplit[0] === "temperature_fan") {
|
||||
if (keySplit[0] === "temperature_fan") key = keySplit[1];
|
||||
|
||||
let index = state.temperaturChart.datasets.findIndex(element => element.label === key);
|
||||
let index_target = state.temperaturChart.datasets.findIndex(element => element.label === key+'_target');
|
||||
|
||||
if (index >= 0) {
|
||||
state.temperaturChart.datasets[index].data.push(value.temperature.toFixed(1));
|
||||
state.temperaturChart.datasets[index_target].data.push(value.target.toFixed(1));
|
||||
} else {
|
||||
let color = '#f87979';
|
||||
|
||||
switch (key) {
|
||||
case 'heater_bed': color = colorHeaterBed; break;
|
||||
case 'chamber': color = colorChamber; break;
|
||||
default: color = colorArray[state.temperaturChart.datasets.length]; break;
|
||||
}
|
||||
|
||||
state.temperaturChart.datasets.push({
|
||||
label: key,
|
||||
data: [value.temperature.toFixed(1)],
|
||||
borderColor: color,
|
||||
backgroundColor: color,
|
||||
fill: false,
|
||||
borderDash: undefined,
|
||||
borderWidth: 2,
|
||||
pointRadius: 0,
|
||||
pointHitRadius: 5,
|
||||
showLine: true
|
||||
});
|
||||
|
||||
state.temperaturChart.datasets.push({
|
||||
label: key+"_target",
|
||||
data: [value.target.toFixed(1)],
|
||||
borderColor: color,
|
||||
backgroundColor: color+'20',
|
||||
fill: true,
|
||||
borderDash: undefined,
|
||||
borderWidth: 0,
|
||||
pointRadius: 0,
|
||||
pointHitRadius: 0,
|
||||
showLine: true
|
||||
});
|
||||
}
|
||||
|
||||
boolAddValues = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (boolAddValues) {
|
||||
state.temperaturChart.labels.push(now);
|
||||
|
||||
if (state.temperaturChart.labels.length > temperaturChartSampleLength) {
|
||||
state.temperaturChart.labels.splice(0, state.temperaturChart.labels.length-temperaturChartSampleLength)
|
||||
}
|
||||
}
|
||||
|
||||
for (let [key, dataset] of Object.entries(state.temperaturChart.datasets)) {
|
||||
if (dataset.data.length > temperaturChartSampleLength) {
|
||||
state.temperaturChart.datasets[key].data.splice(0, dataset.data.length-temperaturChartSampleLength)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
setSettings(state, data) {
|
||||
state = objectAssignDeep(state, data);
|
||||
},
|
||||
|
||||
setObjectData(state, data) {
|
||||
Object.assign(state.object, data);
|
||||
|
||||
for (let key of Object.keys(data)) {
|
||||
let nameSplit = key.split(" ");
|
||||
|
||||
if (nameSplit[0] === "temperature_fan") {
|
||||
Vue.prototype.$socket.sendObj('post_printer_subscriptions', { [key]: [] });
|
||||
}
|
||||
|
||||
if (nameSplit[0] === "filament_switch_sensor") {
|
||||
Vue.prototype.$socket.sendObj('post_printer_subscriptions', { [key]: [] });
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
setPrinterConfig(state, data) {
|
||||
Vue.set(state, 'config', data.configfile.config);
|
||||
},
|
||||
|
||||
setFileList(state, data) {
|
||||
state.files = [];
|
||||
let array = Object.entries(data);
|
||||
|
||||
for (let [key, file] of array) {
|
||||
if (file.filename !== "gui.json") {
|
||||
state.files.push({
|
||||
number: key,
|
||||
filename: file.filename,
|
||||
modified: Date.parse(file.modified),
|
||||
size: file.size,
|
||||
slicer: file.slicer,
|
||||
filament_used: file.filament_used,
|
||||
estimated_time: file.estimated_time,
|
||||
layer_height: file.layer_height,
|
||||
first_layer_height: file.first_layer_height,
|
||||
object_height: file.object_height,
|
||||
});
|
||||
}
|
||||
}
|
||||
//state.files = data;
|
||||
},
|
||||
|
||||
setHelpList(state, data) {
|
||||
state.helplist = [];
|
||||
|
||||
for (let [command, description] of Object.entries(data)) {
|
||||
state.helplist.push({
|
||||
'commandLow': command.toLowerCase(),
|
||||
'command': command,
|
||||
'description': description,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
addGcodeResponse(state, data) {
|
||||
state.events.push({
|
||||
date: new Date(),
|
||||
message: data
|
||||
});
|
||||
|
||||
if (data.substring(0,2) === "!!") {
|
||||
Vue.$toast.error(data);
|
||||
}
|
||||
},
|
||||
|
||||
setLoadingSendGcode(state, value) {
|
||||
state.socket.loadingSendGcode = value;
|
||||
},
|
||||
|
||||
sendGcode(state) {
|
||||
state.socket.loadingSendGcode = false;
|
||||
},
|
||||
|
||||
setPrinterStatus(state, value) {
|
||||
state.printer.toolhead.status = value;
|
||||
},
|
||||
|
||||
setLoadingGcodeUpload(state, value) {
|
||||
state.socket.loadingGcodeUpload = value;
|
||||
},
|
||||
|
||||
setLoadingGcodeRefresh(state, value) {
|
||||
state.socket.loadingGcodeRefresh = value;
|
||||
},
|
||||
|
||||
setLoadingEmergencyStop(state, value) {
|
||||
state.socket.loadingEmergencyStop = value;
|
||||
},
|
||||
|
||||
setLoadingPrintPause(state, value) {
|
||||
state.socket.loadingPrintPause = value;
|
||||
},
|
||||
|
||||
setLoadingPrintResume(state, value) {
|
||||
state.socket.loadingPrintResume = value;
|
||||
},
|
||||
|
||||
setLoadingPrintCancel(state, value) {
|
||||
state.socket.loadingPrintCancel = value;
|
||||
},
|
||||
|
||||
setLoadingHome(state, value) {
|
||||
state.socket.loadingHome = value;
|
||||
},
|
||||
|
||||
setLoadingHomeX(state, value) {
|
||||
state.socket.loadingHomeX = value;
|
||||
},
|
||||
|
||||
setLoadingHomeY(state, value) {
|
||||
state.socket.loadingHomeY = value;
|
||||
},
|
||||
|
||||
setLoadingHomeZ(state, value) {
|
||||
state.socket.loadingHomeZ = value;
|
||||
},
|
||||
|
||||
setLoadingQGL(state, value) {
|
||||
state.socket.loadingQGL = value;
|
||||
},
|
||||
|
||||
setLoadingRestart(state, value) {
|
||||
state.socket.loadingRestart = value;
|
||||
},
|
||||
|
||||
setLoadingRestartFirmware(state, value) {
|
||||
state.socket.loadingRestartFirmware = value;
|
||||
},
|
||||
|
||||
setLoadingSaveGuiConfige(state, value) {
|
||||
state.socket.loadingSaveGuiConfig = value;
|
||||
},
|
||||
|
||||
reportError(state, data) {
|
||||
//Vue.$toast.error(data.message);
|
||||
window.console.log(data);
|
||||
},
|
||||
|
||||
setPausedState(state, data) {
|
||||
switch (data) {
|
||||
case 'paused':
|
||||
state.printer.pause_resume.is_paused = true;
|
||||
break;
|
||||
|
||||
case 'resumed':
|
||||
state.printer.pause_resume.is_paused = false;
|
||||
break;
|
||||
|
||||
case 'cleared':
|
||||
state.printer.pause_resume.is_paused = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
window.console.log('setPausedState -> Default: '+data);
|
||||
}
|
||||
},
|
||||
|
||||
voidMutation() {
|
||||
|
||||
},
|
||||
}
|
||||
+18
-2
@@ -1,2 +1,18 @@
|
||||
export const hostname = window.location.host;
|
||||
//export const hostname = "kossel.local:8080";
|
||||
//export const hostname = window.location.host;
|
||||
export const hostname = "voron250.local:8080";
|
||||
//export const hostname = "kossel.local:8080";
|
||||
|
||||
export const colorArray = [
|
||||
'#F44336',
|
||||
'#E91E63',
|
||||
'#9C27B0',
|
||||
'#673AB7',
|
||||
'#3F51B5',
|
||||
'#00BCD4',
|
||||
'#009688',
|
||||
];
|
||||
|
||||
export const colorHeaterBed = '#2196F3';
|
||||
export const colorChamber = '#4CAF50';
|
||||
export const temperaturChartSampleInterval = 1000;
|
||||
export const temperaturChartSampleLength = 600;
|
||||
Reference in new issue
Block a user