Compare commits

..
6 Commits
Author SHA1 Message Date
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
34 changed files with 962 additions and 157 deletions

No files matched your search

+42 -10
View File
@@ -8,7 +8,7 @@ Download and install KWC:
```bash
mkdir -p ~/kwc
cd ~/kwc
wget -q -O kwc.zip https://github.com/meteyou/kwc/releases/download/v0.0.5/kwc-alpha-0.0.5.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:
@@ -19,7 +19,7 @@ enable_cors: true
trusted_clients:
192.168.1.0/24
127.0.0.1
web_path: ~/kwc
allow_file_ops_when_printing: true
```
Example Klipper macros:
@@ -67,6 +67,20 @@ gcode:
BASE_RESUME
```
## Installation lighttpd
```bash
sudo apt install lighttpd
```
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
```
## Installation haproxy
haproxy is necessary to use port 80.
@@ -76,24 +90,42 @@ add following lines at the end of `/etc/haproxy/haproxy.cfg`:
```
frontend public
bind :::80 v4v6
# use_backend webcam if { path_beg /webcam/ }
default_backend kwc
default_backend lighttpd
use_backend printer if { path_beg /printer/ }
# use_backend webcam if { path_beg /webcam1/ }
backend kwc
reqrep ^([^\ :]*)\ /(.*)     \1\ /\2
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 kwc1 127.0.0.1:8080
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 ^([^\ :]*)\ /webcam/(.*) \1\ /\2
# 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.5
## 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.5/kwc-alpha-0.0.5.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
+5
View File
@@ -7981,6 +7981,11 @@
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
},
"object-assign-deep": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/object-assign-deep/-/object-assign-deep-0.4.0.tgz",
"integrity": "sha512-54Uvn3s+4A/cMWx9tlRez1qtc7pN7pbQ+Yi7mjLjcBpWLlP+XbSHiHbQW6CElDiV4OvuzqnMrBdkgxI1mT8V/Q=="
},
"object-copy": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz",
+1
View File
@@ -11,6 +11,7 @@
"axios": "^0.19.2",
"chart.js": "^2.9.3",
"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",
+8
View File
@@ -0,0 +1,8 @@
{
"socket": {
"hostname": "voron250.local",
"port": 8080,
"reconnectInterval": 3000,
"reconnectAttempts": 1000
}
}
+6 -19
View File
@@ -12,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>
@@ -82,25 +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('get_printer_status', { configfile: ['config'] }, 'getPrinterConfig');
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: {
@@ -115,6 +101,7 @@ export default {
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'
+12 -4
View File
@@ -23,17 +23,25 @@ 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, data) {
return data['labels'][tooltipItem[0]['index']];
title: function (tooltipItem) {
let date = new Date(tooltipItem[0].label);
return date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
},
label: function (tooltipItem, data) {
return data['datasets'][0]['data'][tooltipItem['index']];
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;
},
}
},
+53 -35
View File
@@ -4,53 +4,65 @@
<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>
<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="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="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="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+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="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="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+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="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="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+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="doHome" :loading="loadingHome" :color="homedAxes.includes('xyz') ? 'primary' : 'warning'"><v-icon left>mdi-home</v-icon>Home all</v-btn>
<v-btn v-if="config.hasOwnProperty('quad_gantry_level')" @click="doQGL" :loading="loadingQGL" color="primary" class="ml-3">QGL</v-btn>
<v-btn @click="doRestart" :loading="loadingRestart" color="error" class="ml-3"><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: {
@@ -82,6 +94,9 @@
'setLoadingRestart',
'setLoadingRestartFirmware',
]),
...mapGetters([
'getMacros',
])
},
methods: {
doHome() {
@@ -104,11 +119,14 @@
this.$store.commit('setLoadingQGL', true);
this.$socket.sendObj('post_printer_gcode', { script: "quad_gantry_level" }, "responseQGL");
},
doSend(gcode) {
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() {
+48
View File
@@ -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>
+2 -2
View File
@@ -1,7 +1,7 @@
<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-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>
@@ -11,7 +11,7 @@
</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" style="display: inline-block;" class="mx-1 my-1">
<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>
+1 -1
View File
@@ -10,7 +10,7 @@
from {
transform: rotate(0deg);
} to {
transform: rotate(360deg);
transform: rotate(-360deg);
}
}
</style>
@@ -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>
+13
View File
@@ -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 {
}
+7 -5
View File
@@ -4,7 +4,7 @@
<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>{{ printer_state }}{{ printer_is_printing ? " - "+current_file : "" }}</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="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>
@@ -66,20 +66,20 @@
</v-flex>
<v-flex grow class="equal-width">
<v-layout column>
<v-flex tag="strong">Time</v-flex>
<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">File Progress</v-flex>
<v-flex tag="span">{{ print_time > 0 && file_position > 0 ? formatTime(print_time / (file_position / current_file_size) - print_time) : '--' }}</v-flex>
<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"><i>coming soon</i></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>
@@ -131,6 +131,8 @@
...mapGetters([
'current_file_size',
'current_file_metadata',
'current_file_estimated_time',
'current_file_filament_used',
'is_printing',
]),
},
+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>
+6 -1
View File
@@ -6,6 +6,9 @@ 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);
@@ -13,7 +16,9 @@ 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
}
+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);
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>
+6 -1
View File
@@ -5,7 +5,7 @@
<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" :min="min" :max="max" @change="sendCmd" hide-details></v-slider></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>
@@ -32,6 +32,11 @@
required: false,
default: ''
},
label: {
type: String,
required: false,
default: ''
},
attributeScale: {
type: Number,
required: false,
+26 -14
View File
@@ -6,17 +6,9 @@ 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';
import vueHeadful from 'vue-headful';
Vue.use(JRPCWS, 'ws://' + hostname + '/websocket', {
store: store,
reconnectEnabled: true,
reconnectInterval: 3000,
recconectAttempts: 1000,
});
Vue.config.productionTip = false;
Vue.use(VueResource);
@@ -28,9 +20,29 @@ Vue.http.headers.common['Access-Control-Allow-Methods'] = 'POST, GET, PUT, OPTIO
Vue.component('vue-headful', vueHeadful);
new Vue({
vuetify,
router,
store,
render: h => h(App)
}).$mount('#app')
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);
});
+22 -11
View File
@@ -28,25 +28,18 @@
<div>
<v-row>
<v-col class="col">
<v-combobox
<v-text-field
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-combobox>
<!--<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-text-field>-->
v-on:keydown.tab="getAutocomplete"
></v-text-field>
</v-col>
<v-col class="col-auto align-content-center">
@@ -122,6 +115,7 @@
computed: {
...mapState({
events: state => state.events,
helplist: state => state.helplist,
}),
...mapGetters([
'getMacros'
@@ -165,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();
}
}
}
+8 -3
View File
@@ -2,19 +2,24 @@
<v-row>
<v-col class="col-sm-12 col-md-7">
<status-panel></status-panel>
<webcam-panel v-if="showDashboardWebcam" class="mt-6"></webcam-panel>
<control-panel class="mt-6"></control-panel>
<macros-panel class="mt-6"></macros-panel>
</v-col>
<v-col class="col-sm-12 col-md-5">
<tools-panel></tools-panel>
<tempchart-panel class="mt-6"></tempchart-panel>
<peripherie-panel></peripherie-panel>
</v-col>
</v-row>
</template>
<script>
export default {
import { mapGetters } from 'vuex'
export default {
computed: {
...mapGetters([
'showDashboardWebcam'
])
},
}
</script>
+72 -13
View File
@@ -3,8 +3,8 @@
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 {
@@ -60,6 +60,7 @@
:sort-by.sync="sortBy"
:sort-desc.sync="sortDesc"
:items="files"
:items-per-page="countPerPage"
item-key="date"
class="files-table"
>
@@ -72,12 +73,27 @@
<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>
@@ -111,7 +127,6 @@
<script>
import { mapState, mapGetters } from 'vuex';
import axios from 'axios';
import { hostname } from '../store/variables';
export default {
data () {
@@ -126,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: {
@@ -148,7 +188,6 @@
y: 0,
item: {}
},
hostname: hostname,
dropzone: {
visibility: 'hidden',
opacity: 0,
@@ -160,6 +199,9 @@
files: state => state.files,
loadingUpload: state => state.socket.loadingGcodeUpload,
loadingRefresh: state => state.socket.loadingGcodeRefresh,
countPerPage: state => state.gui.gcodefiles.countPerPage,
hostname: state => state.socket.hostname,
port: state => state.socket.port,
}),
...mapGetters([
'is_printing'
@@ -177,7 +219,7 @@
formData.append('file', file);
this.$store.commit('setLoadingGcodeUpload', true);
axios.post('http://' + hostname + '/printer/files/upload',
axios.post('http://' + this.hostname + ':' + this.port + '/printer/files/upload',
formData, {
headers: { 'Content-Type': 'multipart/form-data' }
}
@@ -204,7 +246,7 @@
formatDate(date) {
let tmp2 = new Date(date);
return tmp2.toLocaleString();
return tmp2.toLocaleString().replace(',', '');
},
formatFilesize(fileSizeInBytes) {
let i = -1;
@@ -216,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;
@@ -229,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'
@@ -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>
+38
View File
@@ -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>
+5 -1
View File
@@ -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
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
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
},
]
},*/
},
];
+77 -4
View File
@@ -1,14 +1,43 @@
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');
window.console.log('Socket connected');
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')
commit('setDisconnected');
if (event.wasClean) {
window.console.log('Socket closed clear')
} else {
@@ -59,7 +88,21 @@ export default {
socket_reconnect ({ commit }, count) {
commit('setConnected');
window.console.log(count)
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 }) {
@@ -67,6 +110,24 @@ export default {
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,
@@ -92,6 +153,10 @@ export default {
commit('setLoadingGcodeRefresh', false);
},
getHelpList({ commit }, data) {
commit('setHelpList', data);
},
setLoadingSendGcode({commit}, value) {
commit('setLoadingSendGcode', value);
},
@@ -147,5 +212,13 @@ export default {
switchToDashboard() {
router.push("/");
}
},
getHelpData({ commit }, data) {
commit('voidMutation', data);
},
setSettings({ commit }, data) {
commit('setSettings', data);
},
}
+59 -1
View File
@@ -76,6 +76,22 @@ export default {
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');
},
@@ -86,6 +102,36 @@ export default {
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')) {
@@ -96,7 +142,15 @@ export default {
}
}
return array;
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 => {
@@ -106,5 +160,9 @@ export default {
return state.printer.hostname;
} else return "KlipperWebControl";
},
showDashboardWebcam: state => {
return (state.webcam.url !== "" && state.gui.dashboard.boolWebcam);
}
}
+29 -3
View File
@@ -11,6 +11,10 @@ Vue.use(VueToast);
export default new Vuex.Store({
state: {
socket: {
hostname: window.location.hostname,
port: 8080,
reconnectInterval: 3000,
reconnectAttempts: 1000,
isConnected: false,
loadingGcodeUpload: false,
loadingGcodeRefresh: false,
@@ -24,6 +28,26 @@ export default new Vuex.Store({
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: '',
@@ -35,6 +59,10 @@ 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
@@ -64,14 +92,12 @@ export default new Vuex.Store({
heater: {
available_heaters: []
}
},
config: {
},
temperaturChart: {
labels: [],
datasets: [],
},
helplist: [],
files: [],
events: []
},
+61 -9
View File
@@ -1,9 +1,12 @@
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) {
@@ -26,9 +29,12 @@ export default {
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));
else {
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) {
@@ -46,6 +52,19 @@ export default {
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
});
@@ -73,6 +92,10 @@ export default {
}
},
setSettings(state, data) {
state = objectAssignDeep(state, data);
},
setObjectData(state, data) {
Object.assign(state.object, data);
@@ -82,6 +105,10 @@ export default {
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]: [] });
}
}
},
@@ -91,18 +118,39 @@ export default {
setFileList(state, data) {
state.files = [];
let array = Object.entries(data);
for (let [key, file] of Object.entries(data)) {
state.files.push({
number: key,
filename: file.filename,
modified: Date.parse(file.modified),
size: file.size,
});
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(),
@@ -178,6 +226,10 @@ export default {
state.socket.loadingRestartFirmware = value;
},
setLoadingSaveGuiConfige(state, value) {
state.socket.loadingSaveGuiConfig = value;
},
reportError(state, data) {
//Vue.$toast.error(data.message);
window.console.log(data);
+2 -2
View File
@@ -1,5 +1,5 @@
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 = [