Compare commits

..
12 Commits
Author SHA1 Message Date
Stefan Dej 6bc72dcb8c modify nginx config in README;
Settings > Machine > Endstop Status
Settings > Machine > Runout Sensor
2020-04-18 03:13:44 +02:00
Stefan Dej d0f78196c5 modify nginx config in README 2020-04-14 13:48:33 +02:00
Stefan Dej ec827bbea4 add nginx config in README 2020-04-14 13:34:32 +02:00
Stefan Dej beba547031 clean settings and last API corrections 2020-04-14 00:43:32 +02:00
Stefan Dej bb18992f80 add interface settings and save gui.json on virtual_sdcard 2020-04-14 00:08:52 +02:00
Stefan Dej 572fbd7629 edit README.md: including lighttpd and optimize haproxy 2020-04-12 17:42:23 +02:00
Stefan Dej 69fff8fe0e dashboard:
- temp combine table+chart;
- add estimated time by: filament, slicer
- format control buttons

gcode files:
- add meta data
2020-04-12 03:56:32 +02:00
Stefan Dej 101904bd6d console autocomplete;
tempchart target temp;
settings machinelimits
add webcamsupport
2020-04-12 00:13:40 +02:00
Stefan Dej 28177e35a7 update README.md to V0.0.6 2020-03-26 01:50:54 +01:00
Stefan Dej 54aaf8d0c7 add tool fan, extrusion factor and speed factor to dashbaord; add macro buttons to dashboard; show printer stats in title & favicon 2020-03-26 01:34:51 +01:00
Stefan Dej 851c17a6d4 update to API .03 2020-03-14 00:52:23 +01:00
Stefan Dej aa0780097c update README.md for v0.0.4 2020-03-10 00:48:40 +01:00
40 changed files with 4492 additions and 2238 deletions

No files matched your search

+145 -13
View File
@@ -6,42 +6,54 @@ At first install Arksine klipper-api fork/branch -> [install manual](https://git
Download and install KWC:
```bash
mkdir -p ~/sdcard
mkdir -p ~/kwc
cd ~/kwc
wget -q -O kwc.zip https://github.com/meteyou/kwc/releases/download/v0.0.3/kwc-alpha-0.0.3.zip && unzip kwc.zip && rm kwc.zip
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
```
Configure web_server in printer.cfg:
```
[web_server]
port: 8080
enable_cors: true
trusted_clients:
192.168.1.0/24
web_path: ~/kwc
pause_gcode: PAUSE_PRINT
resume_gcode: RESUME_PRINT
cancel_gcode: CANCEL_PRINT
127.0.0.1
allow_file_ops_when_printing: true
[virtual_sdcard]
path: /home/pi/sdcard
```
Example Klipper macros:
```
[pause_resume]
[gcode_macro CANCEL_PRINT]
[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 PAUSE_PRINT]
[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
PAUSE
BASE_PAUSE
G91
G1 E-1.7 F2100
G1 Z{Z}
@@ -49,18 +61,138 @@ gcode:
G1 X{X} Y{Y} F6000
G91
[gcode_macro RESUME_PRINT]
[gcode_macro RESUME]
rename_existing: BASE_RESUME
gcode:
G91
G1 E1.7 F2100
G91
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
RESUME
BASE_RESUME
```
## Update KWC to V0.0.3
## Installation lighttpd & haproxy (out-dated)
```bash
sudo apt install lighttpd haproxy
```
edit configfile `/etc/lighttpd/lighttpd.conf` and edit following lines:
```
server.document-root = "/home/pi/kwc"
server.bind = "127.0.0.1"
server.port = 81
```
```bash
sudo usermod -a -G www-data pi
```
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).
## Installation nginx
If you have installed lighttpd & haproxy before:
```bash
sudo service haproxy stop
sudo update-rc.d -f haproxy remove
sudo service lighttpd stop
sudo update-rc.d -f lighttpd remove
```
and now install nginx:
```bash
sudo apt install nginx
```
create configfile `/etc/nginx/sites-available/kwc`:
```
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream apiserver {
#edit your api port here
server 127.0.0.1:8080;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
access_log /var/log/nginx/kwc-access.log;
error_log /var/log/nginx/kwc-error.log;
#web_path from kwc static files
root /home/pi/kwc;
index index.html;
server_name _;
#max upload size for gcodes
client_max_body_size 128M;
location / {
try_files $uri $uri/ /index.html;
}
location /printer {
proxy_pass http://apiserver/printer;
}
location /websocket {
proxy_pass http://apiserver/websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
}
}
```
change api port & root path.
```bash
sudo rm /etc/nginx/sites-enabled/default
sudo ln -s /etc/nginx/sites-available/kwc /etc/nginx/sites-enabled/
sudo service nginx restart
```
## 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.3/kwc-alpha-0.0.3.zip && unzip kwc.zip && rm kwc.zip
```
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 & nginx config.
+2039 -1628
View File
File diff suppressed because it is too large. Load diff
+19 -18
View File
@@ -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,
+7
View File
@@ -0,0 +1,7 @@
{
"socket": {
"hostname": "kossel.local",
"reconnectInterval": 5000,
"reconnectAttempts": 1000
}
}
+1 -1
View File
@@ -4,7 +4,7 @@
<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">
<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">
+66 -20
View File
@@ -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>
@@ -57,14 +62,14 @@
<v-footer app class="d-block">
<span v-if="version">{{ version }}</span>
<span class="float-right">&copy; 2019</span>
<span class="float-right">&copy; 2020</span>
</v-footer>
</v-app>
</template>
<script>
import routes from './routes';
import { mapState } from 'vuex';
import { mapState, mapGetters } from 'vuex';
export default {
props: {
@@ -79,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: [],
toolhead: [],
virtual_sdcard: [],
heater: [],
heater_bed: [],
extruder: ["temperature", "target"],
fan: [],
pause_resume: [],
idle_timeout: [],
});
this.$socket.sendObj('get_printer_files', {}, 'getFileList');
}
},
computed: {
@@ -110,13 +100,69 @@ export default {
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>
+35 -1
View File
@@ -23,7 +23,41 @@ 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');
}
},
onClick: function(e, legendItem) {
let ci = this.chart;
let index = legendItem.datasetIndex;
let index_target = ci.data.datasets.findIndex(dataset => dataset.label === legendItem.text+'_target');
let meta = ci.getDatasetMeta(index);
// See controller.isDatasetVisible comment
meta.hidden = meta.hidden === null ? !ci.data.datasets[index].hidden : null;
if (index_target) {
let meta_target = ci.getDatasetMeta(index_target);
meta_target.hidden = meta.hidden;
}
ci.update();
}
},
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,
+67 -48
View File
@@ -4,51 +4,63 @@
<template>
<v-card>
<v-col xs12 md12>
<v-row class="pl-3 pr-3 text-center">
<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>
</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="doSend('X-100')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left>mdi-chevron-left</v-icon><span>X-100</span></v-btn>
<v-btn @click="doSend('X-10')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left>mdi-chevron-left</v-icon><span>X-10</span></v-btn>
<v-btn @click="doSend('X-1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left>mdi-chevron-left</v-icon><span>X-1</span></v-btn>
<v-btn @click="doHomeX" :color="homedAxes.includes('x') ? 'primary' : 'warning'" :loading="loadingHomeX"><span>Home X</span></v-btn>
<v-btn @click="doSend('X+1')" cols="1" class="flex-grow-1 flex-shrink-0"><span>X+1</span><v-icon right>mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSend('X+10')" cols="1" class="flex-grow-1 flex-shrink-0"><span>X+10</span><v-icon right>mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSend('X+100')" cols="1" class="flex-grow-1 flex-shrink-0"><span>X+100</span><v-icon right>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"><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-row>
<v-row class="pl-3 pr-3 mt-3 text-center">
</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="doSend('Y-100')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left>mdi-chevron-left</v-icon><span>Y-100</span></v-btn>
<v-btn @click="doSend('Y-10')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left>mdi-chevron-left</v-icon><span>Y-10</span></v-btn>
<v-btn @click="doSend('Y-1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left>mdi-chevron-left</v-icon><span>Y-1</span></v-btn>
<v-btn @click="doHomeY" :color="homedAxes.includes('y') ? 'primary' : 'warning'" :loading="loadingHomeY"><span>Home Y</span></v-btn>
<v-btn @click="doSend('Y+1')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Y+1</span><v-icon right>mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSend('Y+10')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Y+10</span><v-icon right>mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSend('Y+100')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Y+100</span><v-icon right>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"><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-row>
<v-row class="pl-3 pr-3 mt-3 text-center">
</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="doSend('Z-25')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left>mdi-chevron-left</v-icon><span>Z-25</span></v-btn>
<v-btn @click="doSend('Z-1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left>mdi-chevron-left</v-icon><span>Z-1</span></v-btn>
<v-btn @click="doSend('Z-0.1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left>mdi-chevron-left</v-icon><span>Z-0.1</span></v-btn>
<v-btn @click="doHomeZ" :color="homedAxes.includes('z') ? 'primary' : 'warning'" :loading="loadingHomeZ"><span>Home Z</span></v-btn>
<v-btn @click="doSend('Z+0.1')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Z+0.1</span><v-icon right>mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSend('Z+1')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Z+1</span><v-icon right>mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSend('Z+25')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Z+25</span><v-icon right>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"><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-row>
<v-row class="px-3 mt-3">
<v-spacer></v-spacer>
<v-btn @click="doRestart" :loading="loadingRestart" color="error"><v-icon left>mdi-cached</v-icon>Restart</v-btn>
<v-btn @click="doRestartFirmware" :loading="loadingRestartFirmware" color="error" class="ml-3"><v-icon left>mdi-cached</v-icon>Firmware Restart</v-btn>
</v-row>
</v-col>
</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, mapMutations } from 'vuex'
import { mapState, mapGetters, mapMutations } from 'vuex'
export default {
components: {
@@ -61,22 +73,30 @@
},
computed: {
...mapState({
loadingHome: state => state.socket.loadingHome,
loadingHomeX: state => state.socket.loadingHomeX,
loadingHomeY: state => state.socket.loadingHomeY,
loadingHomeZ: state => state.socket.loadingHomeZ,
loadingRestart: state => state.socket.loadingRestart,
loadingRestartFirmware: state => state.socket.loadingRestartFirmware,
loadingQGL: state => state.socket.loadingQGL,
homedAxes: state => state.printer.toolhead.homed_axes,
config: state => state.config,
}),
...mapMutations([
'setLoadingHome',
'setLoadingHomeX',
'setLoadingHomeY',
'setLoadingHomeZ',
'setLoadingRestart',
'setLoadingRestartFirmware',
'setLoadingQGL',
]),
...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");
@@ -89,21 +109,20 @@
this.$store.commit('setLoadingHomeZ', true);
this.$socket.sendObj('post_printer_gcode', { script: "G28 Z" }, "responseHomeZ");
},
doSend(gcode) {
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,81 @@
<style>
.minievent-table {
max-height: 250px;
overflow-y: auto;
}
</style>
<template>
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-console-line</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Console</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider class="mt-2"></v-divider>
<v-card-text class="px-0 py-0 content">
<v-data-table
:headers="headers"
:options="options"
:sort-by.sync="sortBy"
:sort-desc.sync="sortDesc"
:items="events"
item-key="date"
hide-default-footer
disable-pagination
class="minievent-table"
>
<template #no-data>
<div class="text-center">empty</div>
</template>
<template #item="{ item }">
<tr>
<td class="log-cell title-cell">
{{ item.date.toLocaleString() }}
</td>
<td class="log-cell content-cell" colspan="2">
<span v-if="item.message" class="message" v-html="formatMessage(item.message)"></span>
</td>
</tr>
</template>
</v-data-table>
</v-card-text>
</v-card>
</template>
<script>
import { mapState } from 'vuex'
export default {
components: {
},
data: function() {
return {
sortBy: 'date',
sortDesc: true,
headers: [
],
options: {
},
}
},
computed: {
...mapState({
events: state => state.events,
})
},
methods: {
formatMessage(message) {
message = message.replace(/(?:\r\n|\r|\n)/g, '<br>');
return message;
},
}
}
</script>
+90
View File
@@ -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 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-6" 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-6" 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,71 @@
<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-row>
<v-col class="px-10 py-0">
<v-switch v-model="boolShowConsoleOnDashboard" label="Console"></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 } } });
}
},
boolShowConsoleOnDashboard: {
get() {
return this.$store.state.gui.dashboard.boolConsole;
},
set(status) {
return this.$store.dispatch('setSettings', { gui: { dashboard: { boolConsole: status } } });
}
},
},
methods: {
}
}
</script>
@@ -0,0 +1,73 @@
<template>
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-arrow-expand-vertical</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Endstops</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">
<div v-for="(status, index) of sortEndstops" v-bind:key="index">
<v-row class="px-6" >
<v-col sm-12>
<label class="mt-1 d-inline-block">Endstop <b>{{ index.toUpperCase() }}</b></label>
<v-chip class="float-right" :color="status === 'open' ? 'green' : 'red' " text-color="white">{{ status }}</v-chip>
</v-col>
</v-row>
</div>
<v-row class="px-6" v-if="(Object.keys(endstops).length === 0 && endstops.constructor === Object)" >
<v-col sm-12>
<p>Press the sync-button on the right-bottom to load the current endstop status.</p>
</v-col>
</v-row>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn icon @click="syncEndstops" :loading="loading">
<v-icon>mdi-sync</v-icon>
</v-btn>
</v-card-actions>
</v-card>
</template>
<script>
import { mapState } from 'vuex'
export default {
components: {
},
data: function() {
return {
sortEndstops: {}
}
},
computed: {
...mapState({
loading: state => state.socket.loadingEndstopStatus,
endstops: state => state.printer.endstops,
})
},
methods: {
syncEndstops() {
this.$store.commit('setLoadingEndstopStatus', true);
this.$socket.sendObj('get_printer_endstops', { }, "responseEndstopStatus");
}
},
watch: {
endstops: function() {
this.sortEndstops = {};
let keys = Object.keys(this.endstops);
keys.sort();
for (let i = 0; i < keys.length; i++) {
let k = keys[i];
this.sortEndstops[k] = this.endstops[k];
}
}
}
}
</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" v-bind:target="max_velocity" :max="500" :extender-steps="100" command="SET_VELOCITY_LIMIT" attribute-name="VELOCITY=" class="mt-5" ></toolSlider>
<toolSlider label="ACCEL" v-bind:target="max_accel" :max="5000" :extender-steps="500" command="SET_VELOCITY_LIMIT" attribute-name="ACCEL=" class="mt-5" ></toolSlider>
<toolSlider label="DECEL" v-bind:target="max_accel_to_decel" :max="5000" :extender-steps="500" command="SET_VELOCITY_LIMIT" attribute-name="ACCEL_TO_DECEL=" class="mt-5" ></toolSlider>
<toolSlider label="SCV" v-bind:target="square_corner_velocity" :max="10" :extender-steps="5" 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,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,42 @@
<template>
<div>
<div v-for="(runout, index) of getFilamentSwitchSensors" v-bind:key="index">
<v-card class="mt-6">
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-printer-3d-nozzle-alert</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">{{ runout.name }}</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">
<settings-runout-switch :name="runout.name "></settings-runout-switch>
</v-card-text>
</v-card>
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import SettingsRunoutSwitch from "../../../inputs/SettingsRunoutSwitch";
export default {
components: {
SettingsRunoutSwitch
},
data: function() {
return {
}
},
computed: {
...mapGetters([
'getFilamentSwitchSensors'
])
},
methods: {
}
}
</script>
@@ -0,0 +1,53 @@
<template>
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-cpu-64-bit</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">System</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider class="my-2"></v-divider>
<v-card-text class="">
<div><v-btn :href="'http://'+hostname+':'+port+'/printer/log'" color="primary"><v-icon class="mr-sm-2">mdi-download</v-icon>Download Log</v-btn></div>
<div><v-btn @click="doRestart" :loading="loadingRestart" color="error" class="mt-3"><v-icon class="mr-sm-2">mdi-cached</v-icon>Restart</v-btn></div>
<div><v-btn @click="doRestartFirmware" :loading="loadingRestartFirmware" class="mt-3" color="error"><v-icon class="mr-sm-2">mdi-cached</v-icon><span class="d-none d-sm-block">FW Restart</span></v-btn></div>
</v-card-text>
</v-card>
</template>
<script>
import {mapMutations, mapState} from 'vuex'
export default {
components: {
},
data: function() {
return {
}
},
computed: {
...mapState({
hostname: state => state.socket.hostname,
port: state => state.socket.port,
loadingRestart: state => state.socket.loadingRestart,
loadingRestartFirmware: state => state.socket.loadingRestartFirmware,
}),
...mapMutations([
'setLoadingRestart',
'setLoadingRestartFirmware',
]),
},
methods: {
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,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>
+21
View File
@@ -0,0 +1,21 @@
import Vue from 'vue'
import WebcamPanel from './WebcamPanel.vue'
import DashboardPanel from "./DashboardPanel";
import MacrosPanel from "./MacrosPanel";
import EndstopPanel from "./EndstopPanel";
import LimitsPanel from "./LimitsPanel";
import RunoutPanel from "./RunoutPanel";
import SystemPanel from "./SystemPanel";
Vue.component('settings-webcam-panel', WebcamPanel);
Vue.component('settings-dashboard-panel', DashboardPanel);
Vue.component('settings-macros-panel', MacrosPanel);
Vue.component('settings-endstop-panel', EndstopPanel);
Vue.component('settings-limits-panel', LimitsPanel);
Vue.component('settings-runout-panel', RunoutPanel);
Vue.component('settings-system-panel', SystemPanel);
export default {
}
+59 -17
View File
@@ -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="red" v-if="(toolhead && toolhead.status === 'Ready') && is_paused" :loading="btnStatusCancel" @click="btnCancelJob">cancel job</v-btn>
<v-btn class="orange ml-2" v-if="(toolhead && toolhead.status === 'Ready') && is_paused" :loading="btnStatusResume" @click="btnResumeJob">resume 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' && printProgress > 0) || is_paused"></v-divider>
<v-layout wrap class=" text-center" v-if="(toolhead && toolhead.status === 'Printing' && printProgress > 0) || 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' && printProgress > 0) || 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>
+7 -1
View File
@@ -1,3 +1,9 @@
<style>
#line-chart {
height: 250px;
}
</style>
<template>
<v-card>
<v-list-item>
@@ -20,7 +26,7 @@
<script>
import LineChart from '../../charts/LineChart.js'
import {mapGetters, mapState} from 'vuex'
import { mapGetters, mapState } from 'vuex'
export default {
components: {
+37 -5
View File
@@ -50,32 +50,64 @@
</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',
'temperature_fans'
'temperature_fans',
])
},
methods: {
fillData () {
this.loaded = true;
this.chartdata = {
labels: this.labels,
datasets: this.datasets
}
}
},
mounted () {
this.fillData();
},
watch: {
labels() {
this.fillData();
}
}
}
</script>
+43
View File
@@ -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>
+8 -1
View File
@@ -4,12 +4,19 @@ import StatusPanel from './StatusPanel.vue'
import ToolsPanel from './ToolsPanel.vue'
import TempchartPanel from './TempchartPanel.vue'
import ControlPanel from "./ControlPanel";
import Peripherie from "./PeripheriePanel";
import WebcamPanel from "./WebcamPanel";
import MiniconsolePanel from "./MiniconsolePanel";
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('webcam-panel', WebcamPanel);
Vue.component('miniconsole-panel', MiniconsolePanel);
export default {
StatusPanel,
Settings
}
+46
View File
@@ -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.toUpperCase());
if (index > -1) this.hiddenMacros.splice(index, 1);
} else this.hiddenMacros.push(this.name.toUpperCase());
}
},
watch: {
hiddenMacros: function() {
this.value = !this.hiddenMacros.includes(this.name.toUpperCase());
}
},
created() {
this.value = !this.hiddenMacros.includes(this.name.toUpperCase());
}
}
</script>
+67
View File
@@ -0,0 +1,67 @@
<style>
.settingsRunoutSwitchInput .v-messages {
display: none;
}
</style>
<template>
<div>
<v-row class="px-6" >
<v-col sm-12>
<v-switch v-model="enabled" :label="enabled ? 'enabled' : 'disabled'" @change="changeSensor()" class="settingsRunoutSwitchInput my-0"></v-switch>
</v-col>
</v-row>
<v-row class="px-6" v-if="enabled" >
<v-col sm-12>
<label class="mt-1 d-inline-block">Filament:</label>
<v-chip class="float-right" :color="filament_detected ? 'green' : 'red' " text-color="white">{{ filament_detected ? 'detected' : 'empty' }}</v-chip>
</v-col>
</v-row>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
export default {
data: function() {
return {
value: false,
enabled: false,
filament_detected: false,
}
},
props: {
name: String,
},
computed: {
...mapGetters([
'getFilamentSwitchSensors'
])
},
methods: {
changeSensor() {
this.$socket.sendObj('post_printer_gcode', { script: 'SET_FILAMENT_SENSOR SENSOR='+this.name+' ENABLE='+(this.enabled ? 0 : 1) });
}
},
watch: {
getFilamentSwitchSensors: function() {
let sensor = this.getFilamentSwitchSensors.find(sensor => sensor.name === this.name);
if (sensor) {
this.enabled = sensor.enabled;
this.filament_detected = sensor.filament_detected;
}
}
},
created() {
let sensor = this.getFilamentSwitchSensors.find(sensor => sensor.name === this.name);
if (sensor) {
this.enabled = sensor.enabled;
this.filament_detected = sensor.filament_detected;
}
}
}
</script>
+106
View File
@@ -0,0 +1,106 @@
<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,
variableMax: 0,
}
},
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
},
extenderSteps: {
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;
},
/*value: function() {
if (this.value > 0) {
if (this.value > (this.variableMax - this.extenderSteps) && this.value < (this.variableMax + this.extenderSteps)) this.variableMax += this.extenderSteps;
else if (this.value > (this.variableMax - this.extenderSteps)) {
this.variableMax = (this.value / this.extenderSteps).toFixed(0) * this.extenderSteps;
if (this.variableMax < this.max) this.variableMax = this.max;
}
}
}*/
},
/*created: function() {
/!*window.console.log("Test");
window.console.log(this.target+' * '+this.multi);
this.value = this.target * this.multi;*!/
window.console.log(this.target+' * '+this.multi);
this.variableMax = (this.value / this.extenderSteps + 1).toFixed(0) * this.extenderSteps;
if (this.variableMax < this.max) this.variableMax = this.max;
}*/
}
</script>
+27 -14
View File
@@ -6,15 +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,
reconnectEnabled: true,
reconnectInterval: 3000,
recconectAttempts: 1000,
});
import vueHeadful from 'vue-headful';
Vue.config.productionTip = false;
@@ -25,9 +18,29 @@ 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({
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);
});
+34 -9
View File
@@ -29,13 +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-on:keyup.up="onKeyUp"
v-on:keyup.down="onKeyDown"
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>
@@ -78,7 +81,7 @@
</div>
</template>
<script>
import { mapState } from 'vuex';
import { mapState, mapGetters } from 'vuex';
export default {
data () {
@@ -105,13 +108,18 @@
lastCommands: [
],
lastCommandNumber: null
lastCommandNumber: null,
items: []
}
},
computed: {
...mapState({
events: state => state.events,
helplist: state => state.helplist,
}),
...mapGetters([
'getMacros'
]),
loadingSendGcode: {
get() {
return this.$store.state.socket.loadingSendGcode
@@ -151,6 +159,23 @@
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();
}
}
}
+14 -3
View File
@@ -2,17 +2,28 @@
<v-row>
<v-col class="col-sm-12 col-md-7">
<status-panel></status-panel>
<tools-panel class="mt-6"></tools-panel>
<webcam-panel v-if="showDashboardWebcam" class="mt-6"></webcam-panel>
<control-panel class="mt-6"></control-panel>
</v-col>
<v-col class="col-sm-12 col-md-5">
<tempchart-panel></tempchart-panel>
<tools-panel></tools-panel>
<peripherie-panel class="mt-6"></peripherie-panel>
<miniconsole-panel class="mt-6" v-if="showDashboardConsole"></miniconsole-panel>
</v-col>
</v-row>
</template>
<script>
export default {
import { mapState, mapGetters } from 'vuex'
export default {
computed: {
...mapState({
showDashboardConsole: state => state.gui.dashboard.boolConsole,
}),
...mapGetters([
'showDashboardWebcam'
])
},
}
</script>
+201 -40
View File
@@ -3,31 +3,64 @@
margin-left: 7px;
}
.v-data-table th:last-child .v-data-table-header__icon {
float: right;
.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"
>
@@ -40,15 +73,33 @@
<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>
@@ -74,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 () {
@@ -91,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: {
@@ -113,7 +188,10 @@
y: 0,
item: {}
},
hostname: hostname,
dropzone: {
visibility: 'hidden',
opacity: 0,
}
}
},
computed: {
@@ -121,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();
},
@@ -161,7 +246,7 @@
formatDate(date) {
let tmp2 = new Date(date);
return tmp2.toLocaleString();
return tmp2.toLocaleString().replace(',', '');
},
formatFilesize(fileSizeInBytes) {
let i = -1;
@@ -173,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;
@@ -186,14 +288,14 @@
downloadFile() {
let link = document.createElement("a");
link.download = name;
link.href = 'http://' + hostname + '/printer/files/' + this.contextMenu.item.filename;
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'
@@ -207,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>
+32
View File
@@ -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>
+36
View File
@@ -0,0 +1,36 @@
<template>
<div>
<v-row>
<v-col class="col-12 col-md-6 col-lg-4">
<settings-dashboard-panel></settings-dashboard-panel>
</v-col>
<v-col class="col-12 col-md-6 col-lg-4">
<settings-webcam-panel></settings-webcam-panel>
</v-col>
<v-col class="col-12 col-md-6 col-lg-4">
<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>
+12 -1
View File
@@ -1,6 +1,17 @@
<template>
<div>
Settings - Machine
<v-row>
<v-col class="col-sm-12 col-md-6">
<settings-limits-panel></settings-limits-panel>
</v-col>
<v-col class="col-sm-12 col-md-3">
<settings-endstop-panel></settings-endstop-panel>
<settings-runout-panel></settings-runout-panel>
</v-col>
<v-col class="col-sm-12 col-md-3">
<settings-system-panel></settings-system-panel>
</v-col>
</v-row>
</div>
</template>
<script>
+21 -13
View File
@@ -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
icon: 'console-line',
component: Console,
},
/*{
title: "Current Job",
@@ -28,27 +36,27 @@ const routes = [
title: "G-Code Files",
path: '/files',
icon: 'printer-3d-nozzle',
component: Files
component: Files,
},
/*{
{
title: "Settings",
path: '/settings',
redirect: '/settings/interface',
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
},
]
},*/
},
];
+229
View File
@@ -0,0 +1,229 @@
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);
},
responseEndstopStatus({ commit }, data) {
commit('setLoadingEndstopStatus', false);
commit('setEndstopStatus', data);
},
switchToDashboard() {
router.push("/");
},
getHelpData({ commit }, data) {
commit('voidMutation', data);
},
setSettings({ commit }, data) {
commit('setSettings', data);
},
}
+194
View File
@@ -0,0 +1,194 @@
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;
});
},
getFilamentSwitchSensors: state => {
let sensors = [];
for (let [key, value] of Object.entries(state.printer)) {
let nameSplit = key.split(" ");
if (nameSplit[0] === "filament_switch_sensor") {
sensors.push({
name: nameSplit[1],
enabled: value.enabled,
filament_detected: value.filament_detected,
});
}
}
return sensors.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);
}
}
+57 -402
View File
@@ -1,40 +1,55 @@
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: window.location.port,
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,
loadingEndstopStatus: false,
},
webcam: {
url: ""
},
gui: {
dashboard: {
boolWebcam: true,
boolTempchart: true,
boolConsole: false,
hiddenMacros: [],
},
webcam: {
bool: false,
},
gcodefiles: {
countPerPage: 10,
}
},
config: {
},
printer: {
hostname: '',
@@ -46,16 +61,35 @@ export default new Vuex.Store({
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,
},
endstops: {},
},
object: {
heater: {
@@ -66,391 +100,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;
},
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;
});
},
},
mutations: {
setConnected (state) {
state.socket.isConnected = true;
},
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);
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);
for (let key of Object.keys(data)) {
let nameSplit = key.split(" ");
if (nameSplit[0] === "temperature_fan") {
Vue.prototype.$socket.sendObj('post_printer_subscriptions', { [key]: [] });
}
}
},
setFileList(state, data) {
state.files = data;
},
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;
},
setLoadingHomeX(state, value) {
state.socket.loadingHomeX = value;
},
setLoadingHomeY(state, value) {
state.socket.loadingHomeY = value;
},
setLoadingHomeZ(state, value) {
state.socket.loadingHomeZ = value;
},
setLoadingRestart(state, value) {
state.socket.loadingRestart = value;
},
setLoadingRestartFirmware(state, value) {
state.socket.loadingRestartFirmware = 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() {
},
},
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:
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)
},
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);
},
responseHomeX({commit}) {
commit('setLoadingHomeX', false);
},
responseHomeY({commit}) {
commit('setLoadingHomeY', false);
},
responseHomeZ({commit}) {
commit('setLoadingHomeZ', false);
},
responseRestart({commit}) {
commit('setLoadingRestart', false);
},
responseRestartFirmware({commit}) {
commit('setLoadingRestartFirmware', false);
},
switchToDashboard() {
router.push("/");
}
}
getters: getters,
mutations: mutations,
actions: actions
});
+268
View File
@@ -0,0 +1,268 @@
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);
}
},
setEndstopStatus(state, data) {
Vue.set(state.printer, 'endstops', 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;
},
setLoadingEndstopStatus(state, value) {
state.socket.loadingEndstopStatus = 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
View File
@@ -1,2 +1,18 @@
export const hostname = window.location.host;
//export const hostname = "voron250.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;