Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ae7827f7e | ||
|
|
98950a2b9a | ||
|
|
3051c9a033 | ||
|
|
da7dc25b51 | ||
|
|
ea8d6cfb84 | ||
|
|
21b56a9c55 |
No files matched your search
@@ -1,24 +1,66 @@
|
||||
# kwc
|
||||
# Klipper Web Control
|
||||
KWC is a responsive web interface for [Klipper](https://github.com/KevinOConnor/klipper) 3D printer firmware. It communicates with the klipper-api from [Arksine](https://github.com/arksine).
|
||||
|
||||
## Project setup
|
||||
```
|
||||
npm install
|
||||
## Installation
|
||||
At first install Arksine klipper-api fork/branch -> [install manual](https://github.com/Arksine/klipper/tree/work-web_server-20200131/klippy/extras/web_server)
|
||||
|
||||
Download and install KWC:
|
||||
```bash
|
||||
mkdir -p ~/kwc
|
||||
cd ~/kwc
|
||||
wget -q -O kwc.zip https://github.com/meteyou/kwc/releases/download/v0.0.3/kwc-alpha-0.0.3.zip && unzip kwc.zip && rm kwc.zip
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
Configure web_server in printer.cfg:
|
||||
```
|
||||
npm run serve
|
||||
[web_server]
|
||||
port: 8080
|
||||
trusted_clients:
|
||||
192.168.1.0/24
|
||||
web_path: ~/kwc
|
||||
pause_gcode: PAUSE_PRINT
|
||||
resume_gcode: RESUME_PRINT
|
||||
cancel_gcode: CANCEL_PRINT
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
Example Klipper macros:
|
||||
```
|
||||
npm run build
|
||||
[pause_resume]
|
||||
|
||||
[gcode_macro CANCEL_PRINT]
|
||||
gcode:
|
||||
M104 S0
|
||||
M140 S0
|
||||
M141 S0
|
||||
M106 S0
|
||||
CLEAR_PAUSE
|
||||
|
||||
[gcode_macro PAUSE_PRINT]
|
||||
default_parameter_X: 230
|
||||
default_parameter_Y: 230
|
||||
default_parameter_Z: 10
|
||||
gcode:
|
||||
SAVE_GCODE_STATE NAME=PAUSE_state
|
||||
PAUSE
|
||||
G91
|
||||
G1 E-1.7 F2100
|
||||
G1 Z{Z}
|
||||
G90
|
||||
G1 X{X} Y{Y} F6000
|
||||
G91
|
||||
|
||||
[gcode_macro RESUME_PRINT]
|
||||
gcode:
|
||||
G91
|
||||
G1 E1.7 F2100
|
||||
G91
|
||||
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
|
||||
RESUME
|
||||
```
|
||||
|
||||
### Lints and fixes files
|
||||
## Update KWC to V0.0.3
|
||||
```
|
||||
npm run lint
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||
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
|
||||
```
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 1.1 KiB |
+1
-1
@@ -5,7 +5,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title>kwc</title>
|
||||
<title>KlipperWebControl</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css">
|
||||
</head>
|
||||
|
||||
+18
-6
@@ -32,7 +32,7 @@
|
||||
elevate-on-scroll>
|
||||
<v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="green" v-if="!isConnected" :loading="loadingEmergencyStop" @click="emergencyStop"><v-icon class="mr-2">mdi-refresh-circle</v-icon> reconnect</v-btn>
|
||||
<!--<v-btn color="green" v-if="!isConnected" :loading="loadingEmergencyStop" @click="emergencyStop"><v-icon class="mr-2">mdi-refresh-circle</v-icon> reconnect</v-btn>-->
|
||||
<v-btn color="error" v-if="isConnected" :loading="loadingEmergencyStop" @click="emergencyStop">Emergency Stop</v-btn>
|
||||
</v-app-bar>
|
||||
|
||||
@@ -46,6 +46,15 @@
|
||||
</v-scroll-y-transition>
|
||||
</v-content>
|
||||
|
||||
<v-dialog v-model="isConnecting" persistent width="300">
|
||||
<v-card color="primary" dark >
|
||||
<v-card-text class="pt-2">
|
||||
Connecting to Klipper
|
||||
<v-progress-linear indeterminate color="white" class="mb-0"></v-progress-linear>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<v-footer app class="d-block">
|
||||
<span v-if="version">{{ version }}</span>
|
||||
<span class="float-right">© 2019</span>
|
||||
@@ -76,10 +85,10 @@ export default {
|
||||
this.$socket.sendObj('get_printer_objects', {}, 'getObjectInfo');
|
||||
this.$socket.sendObj('get_printer_status', { heater: [] }, 'getObjectInfo');
|
||||
this.$socket.sendObj('post_printer_subscriptions', {
|
||||
gcode: ["gcode_position", "speed", "speed_factor", "extrude_factor", "busy", "abs_extrude"],
|
||||
gcode: [],
|
||||
toolhead: [],
|
||||
virtual_sdcard: [],
|
||||
header: [],
|
||||
heater: [],
|
||||
heater_bed: [],
|
||||
extruder: ["temperature", "target"],
|
||||
fan: [],
|
||||
@@ -100,6 +109,7 @@ export default {
|
||||
version: state => state.printer.version,
|
||||
loadingEmergencyStop: state => state.socket.loadingEmergencyStop,
|
||||
isConnected: state => state.socket.isConnected,
|
||||
isConnecting: state => !state.socket.isConnected,
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
@@ -124,7 +134,10 @@ export default {
|
||||
text-align: center;
|
||||
border-bottom: 1px solid #ffffff40;
|
||||
margin-bottom: 1em;
|
||||
padding: .75em 0 .25em 0;
|
||||
padding: .75em 0 .75em 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#nav-header img {
|
||||
@@ -133,9 +146,8 @@ export default {
|
||||
}
|
||||
|
||||
#nav-header .v-toolbar__title {
|
||||
display: inline-block;
|
||||
line-height: 40px;
|
||||
font-size: 24px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.v-navigation-drawer__content {
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<v-card>
|
||||
<v-col xs12 md12>
|
||||
<v-row class="pl-3 pr-3 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-toggle>
|
||||
</v-row>
|
||||
<v-row class="pl-3 pr-3 mt-3 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-toggle>
|
||||
</v-row>
|
||||
<v-row class="pl-3 pr-3 mt-3 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-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-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState, mapMutations } from 'vuex'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
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,
|
||||
homedAxes: state => state.printer.toolhead.homed_axes,
|
||||
}),
|
||||
...mapMutations([
|
||||
'setLoadingHomeX',
|
||||
'setLoadingHomeY',
|
||||
'setLoadingHomeZ',
|
||||
'setLoadingRestart',
|
||||
'setLoadingRestartFirmware',
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
doHomeX() {
|
||||
this.$store.commit('setLoadingHomeX', true);
|
||||
this.$socket.sendObj('post_printer_gcode', { script: "G28 X" }, "responseHomeX");
|
||||
},
|
||||
doHomeY() {
|
||||
this.$store.commit('setLoadingHomeY', true);
|
||||
this.$socket.sendObj('post_printer_gcode', { script: "G28 Y" }, "responseHomeY");
|
||||
},
|
||||
doHomeZ() {
|
||||
this.$store.commit('setLoadingHomeZ', true);
|
||||
this.$socket.sendObj('post_printer_gcode', { script: "G28 Z" }, "responseHomeZ");
|
||||
},
|
||||
doSend(gcode) {
|
||||
gcode = "G91" + "\n" +
|
||||
"G1 " + gcode + " F6000" + "\n" +
|
||||
"G90";
|
||||
|
||||
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>
|
||||
@@ -7,8 +7,8 @@
|
||||
<v-list-item-subtitle>{{ toolhead !== null && 'status' in toolhead ? toolhead.status : "" }}</v-list-item-subtitle>
|
||||
</v-list-item-content>
|
||||
<v-btn class="orange" v-if="toolhead && toolhead.status === 'Printing'" @click="btnPauseJob" :loading="btnStatusPause">pause job</v-btn>
|
||||
<v-btn class="orange" v-if="(toolhead && toolhead.status === 'Ready') && is_paused" :loading="btnStatusResume" @click="btnResumeJob">resume job</v-btn>
|
||||
<v-btn class="red ml-2" v-if="(toolhead && toolhead.status === 'Ready') && is_paused" :loading="btnStatusCancel" @click="btnCancelJob">cancel job</v-btn>
|
||||
<v-btn class="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-list-item>
|
||||
<v-divider class="my-2" ></v-divider>
|
||||
<v-card-text class="px-0 pt-0 pb-2 content">
|
||||
@@ -35,8 +35,8 @@
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-divider class="my-2" v-if="(toolhead && toolhead.status === 'Printing') || is_paused"></v-divider>
|
||||
<v-layout wrap class=" text-center" v-if="(toolhead && toolhead.status === 'Printing') || is_paused">
|
||||
<v-divider class="my-2" v-if="(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-flex col tag="strong" class="category-header">
|
||||
Printstatus
|
||||
</v-flex>
|
||||
@@ -59,7 +59,7 @@
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout wrap class=" text-center" v-if="(toolhead && toolhead.status === 'Printing') || is_paused">
|
||||
<v-layout wrap class=" text-center" v-if="(toolhead && toolhead.status === 'Printing' && printProgress > 0) || is_paused">
|
||||
<v-layout column class="mt-2" >
|
||||
<v-progress-linear
|
||||
:value="printProgress * 100"
|
||||
|
||||
@@ -4,11 +4,15 @@
|
||||
<v-list-item-avatar color="grey"><v-icon dark>fa-thermometer-three-quarters</v-icon></v-list-item-avatar>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title class="headline">Temperature Chart</v-list-item-title>
|
||||
<v-list-item-subtitle>buxdehude</v-list-item-subtitle>
|
||||
<v-list-item-subtitle>
|
||||
<span>{{ heatersCount }} heaters</span>
|
||||
<span v-if="temperature_fans.length === 1">, {{ temperature_fans.length }} fan</span>
|
||||
<span v-if="temperature_fans.length > 1">, {{ temperature_fans.length }} fans</span>
|
||||
</v-list-item-subtitle>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-card-text class="px-0 pt-0 pb-2 content">
|
||||
<v-card-text class="pt-0 pb-2 content">
|
||||
<line-chart :chart-data="chartdata" v-if="loaded"></line-chart>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
@@ -16,7 +20,7 @@
|
||||
|
||||
<script>
|
||||
import LineChart from '../../charts/LineChart.js'
|
||||
import { mapState } from 'vuex'
|
||||
import {mapGetters, mapState} from 'vuex'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -35,7 +39,11 @@
|
||||
...mapState({
|
||||
labels: state => state.temperaturChart.labels,
|
||||
datasets: state => state.temperaturChart.datasets,
|
||||
})
|
||||
}),
|
||||
...mapGetters([
|
||||
'heatersCount',
|
||||
'temperature_fans'
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
fillData () {
|
||||
|
||||
@@ -10,26 +10,43 @@
|
||||
<v-list-item-avatar color="grey"><v-icon dark>fa-thermometer-three-quarters</v-icon></v-list-item-avatar>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title class="headline">Heaters</v-list-item-title>
|
||||
<v-list-item-subtitle>{{ heatersCount }} heaters</v-list-item-subtitle>
|
||||
<v-list-item-subtitle>
|
||||
{{ heatersCount }} heaters
|
||||
<span v-if="temperature_fans.length === 1">, {{ temperature_fans.length }} fan</span>
|
||||
<span v-if="temperature_fans.length > 1">, {{ temperature_fans.length }} fans</span>
|
||||
</v-list-item-subtitle>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-card-text class="px-0 pt-0 pb-2 content">
|
||||
<v-row class="pl-3 pr-3">
|
||||
<v-col class="text-center"><b>Heater</b></v-col>
|
||||
<v-col class="text-center"><b>Current</b></v-col>
|
||||
<v-col class="text-center"><b>Target</b></v-col>
|
||||
<v-col class="text-center py-0"><b>Heater</b></v-col>
|
||||
<v-col class="text-center py-0"><b>Current</b></v-col>
|
||||
<v-col class="text-center py-0"><b>Target</b></v-col>
|
||||
</v-row>
|
||||
<div v-for="(heater, index) in heaters" v-bind:key="index" >
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-row class="pl-3 pr-3 heater-row">
|
||||
<v-col class="text-center">
|
||||
<v-col class="text-center py-0">
|
||||
<b>{{ heater.name }}</b><br />
|
||||
<small>{{ heater.target > 0 ? "active" : "off" }}</small>
|
||||
</v-col>
|
||||
<v-col class="text-center vertical_align_center"><span>{{ heater.temperature.toFixed(1) }}°C</span></v-col>
|
||||
<v-col class="text-center vertical_align_center">
|
||||
<toolInput :name="heater.name" :target="heater.target" ></toolInput>
|
||||
<v-col class="text-center py-0 vertical_align_center"><span>{{ heater.temperature.toFixed(1) }}°C</span></v-col>
|
||||
<v-col class="text-center py-0 vertical_align_center">
|
||||
<toolInput :name="heater.name" :target="heater.target" command="SET_HEATER_TEMPERATURE" attribute-name="HEATER" ></toolInput>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
<div v-for="(fan, index) in temperature_fans" v-bind:key="index+99" >
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-row class="pl-3 pr-3 heater-row">
|
||||
<v-col class="text-center py-0">
|
||||
<b>{{ fan.name }}</b><br />
|
||||
<small>{{ fan.target > 0 && fan.speed > 0 ? (fan.speed * 100).toFixed(0)+"%" : (fan.target > 0 ? "standby" : "off") }}</small>
|
||||
</v-col>
|
||||
<v-col class="text-center py-0 vertical_align_center"><span>{{ fan.temperature.toFixed(1) }}°C</span></v-col>
|
||||
<v-col class="text-center py-0 vertical_align_center">
|
||||
<toolInput :name="fan.name" :target="fan.target" command="SET_TEMPERATURE_FAN_TARGET" attribute-name="temperature_fan" ></toolInput>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
@@ -41,7 +58,6 @@
|
||||
import { mapGetters } from 'vuex'
|
||||
import toolInput from '../../inputs/ToolInput'
|
||||
|
||||
|
||||
export default {
|
||||
components: {
|
||||
toolInput
|
||||
@@ -54,7 +70,8 @@
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'heaters',
|
||||
'heatersCount'
|
||||
'heatersCount',
|
||||
'temperature_fans'
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -3,10 +3,12 @@ import Vue from 'vue'
|
||||
import StatusPanel from './StatusPanel.vue'
|
||||
import ToolsPanel from './ToolsPanel.vue'
|
||||
import TempchartPanel from './TempchartPanel.vue'
|
||||
import ControlPanel from "./ControlPanel";
|
||||
|
||||
Vue.component('status-panel', StatusPanel);
|
||||
Vue.component('tools-panel', ToolsPanel);
|
||||
Vue.component('tempchart-panel', TempchartPanel);
|
||||
Vue.component('control-panel', ControlPanel);
|
||||
|
||||
export default {
|
||||
StatusPanel,
|
||||
|
||||
@@ -25,13 +25,15 @@
|
||||
props: {
|
||||
name: String,
|
||||
target: Number,
|
||||
command: String,
|
||||
attributeName: String,
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
methods: {
|
||||
setTemps() {
|
||||
this.$socket.sendObj('post_printer_gcode', {script: 'SET_HEATER_TEMPERATURE HEATER='+this.name+' TARGET='+this.value});
|
||||
this.$socket.sendObj('post_printer_gcode', {script: this.command+' '+this.attributeName+'='+this.name+' TARGET='+this.value});
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
+4
-1
@@ -10,7 +10,10 @@ import { hostname } from './store/variables'
|
||||
import 'vue-toast-notification/dist/index.css';
|
||||
|
||||
Vue.use(JRPCWS, 'ws://' + hostname + '/websocket', {
|
||||
store: store
|
||||
store: store,
|
||||
reconnectEnabled: true,
|
||||
reconnectInterval: 3000,
|
||||
recconectAttempts: 1000,
|
||||
});
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
+28
-1
@@ -34,6 +34,8 @@
|
||||
solo
|
||||
class="gcode-command-field"
|
||||
v-on:keyup.enter="doSend"
|
||||
v-on:keyup.up="onKeyUp"
|
||||
v-on:keyup.down="onKeyDown"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
@@ -99,7 +101,11 @@
|
||||
],
|
||||
options: {
|
||||
|
||||
}
|
||||
},
|
||||
lastCommands: [
|
||||
|
||||
],
|
||||
lastCommandNumber: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -119,11 +125,32 @@
|
||||
doSend() {
|
||||
this.loadingSendGcode = true;
|
||||
this.$socket.sendObj('post_printer_gcode', { script: this.gcode }, "sendGcode");
|
||||
this.lastCommands.push(this.gcode);
|
||||
this.gcode = "";
|
||||
this.lastCommandNumber = null;
|
||||
},
|
||||
formatMessage(message) {
|
||||
message = message.replace(/(?:\r\n|\r|\n)/g, '<br>');
|
||||
|
||||
return message;
|
||||
},
|
||||
onKeyUp() {
|
||||
if (this.lastCommandNumber === null && this.lastCommands.length) {
|
||||
this.lastCommandNumber = this.lastCommands.length - 1;
|
||||
this.gcode = this.lastCommands[this.lastCommandNumber];
|
||||
} else if (this.lastCommandNumber > 0) {
|
||||
this.lastCommandNumber--;
|
||||
this.gcode = this.lastCommands[this.lastCommandNumber];
|
||||
}
|
||||
},
|
||||
onKeyDown() {
|
||||
if (this.lastCommandNumber !== null && this.lastCommandNumber < (this.lastCommands.length - 1)) {
|
||||
this.lastCommandNumber++;
|
||||
this.gcode = this.lastCommands[this.lastCommandNumber];
|
||||
} else if (this.lastCommandNumber !== null && this.lastCommandNumber === (this.lastCommands.length - 1)) {
|
||||
this.lastCommandNumber = null;
|
||||
this.gcode = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<template>
|
||||
<v-row>
|
||||
<v-col xs12 sm6 md4>
|
||||
<v-col class="col-sm-12 col-md-7">
|
||||
<status-panel></status-panel>
|
||||
<div class="mt-6">
|
||||
<tools-panel></tools-panel>
|
||||
</div>
|
||||
<tools-panel class="mt-6"></tools-panel>
|
||||
<control-panel class="mt-6"></control-panel>
|
||||
</v-col>
|
||||
<v-col xs12 sm6 md8>
|
||||
<v-col class="col-sm-12 col-md-5">
|
||||
<tempchart-panel></tempchart-panel>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
+27
-4
@@ -1,3 +1,17 @@
|
||||
<style>
|
||||
.v-data-table .v-data-table-header__icon {
|
||||
margin-left: 7px;
|
||||
}
|
||||
|
||||
.v-data-table th:last-child .v-data-table-header__icon {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.v-data-table .file-list-cursor:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<v-card>
|
||||
@@ -22,7 +36,7 @@
|
||||
</template>
|
||||
|
||||
<template #item="{ item }">
|
||||
<tr @contextmenu="showContextMenu($event, item)" @click="dialog.show = true, dialog.filename = item.filename">
|
||||
<tr @contextmenu="showContextMenu($event, item)" @click="dialog.show = true, dialog.filename = item.filename" class="file-list-cursor">
|
||||
<td class=" ">
|
||||
{{ item.filename }}
|
||||
</td>
|
||||
@@ -38,9 +52,9 @@
|
||||
</v-card>
|
||||
<v-menu v-model="contextMenu.shown" :position-x="contextMenu.x" :position-y="contextMenu.y" absolute offset-y>
|
||||
<v-list>
|
||||
<!--<v-list-item>
|
||||
<v-list-item @click="downloadFile">
|
||||
<v-icon class="mr-1">mdi-cloud-download</v-icon> Download
|
||||
</v-list-item>-->
|
||||
</v-list-item>
|
||||
<v-list-item @click="removeFile">
|
||||
<v-icon class="mr-1">mdi-delete</v-icon> Delete
|
||||
</v-list-item>
|
||||
@@ -86,7 +100,7 @@
|
||||
{
|
||||
text: 'last modified',
|
||||
value: 'modified',
|
||||
align: 'end',
|
||||
align: 'end'
|
||||
},
|
||||
],
|
||||
options: {
|
||||
@@ -99,6 +113,7 @@
|
||||
y: 0,
|
||||
item: {}
|
||||
},
|
||||
hostname: hostname,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -168,6 +183,14 @@
|
||||
this.contextMenu.shown = true
|
||||
});
|
||||
},
|
||||
downloadFile() {
|
||||
let link = document.createElement("a");
|
||||
link.download = name;
|
||||
link.href = 'http://' + hostname + '/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
|
||||
|
||||
+98
-14
@@ -30,12 +30,18 @@ export default new Vuex.Store({
|
||||
loadingEmergencyStop: false,
|
||||
loadingPrintPause: false,
|
||||
loadingPrintResume: false,
|
||||
loadingHomeX: false,
|
||||
loadingHomeY: false,
|
||||
loadingHomeZ: false,
|
||||
loadingRestart: false,
|
||||
loadingRestartFirmware: false,
|
||||
},
|
||||
printer: {
|
||||
hostname: '',
|
||||
version: '',
|
||||
toolhead: {
|
||||
position: [],
|
||||
homed_axes: [],
|
||||
status: "",
|
||||
print_time: 0,
|
||||
printing_time: 0,
|
||||
@@ -97,7 +103,34 @@ export default new Vuex.Store({
|
||||
|
||||
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: {
|
||||
@@ -107,18 +140,23 @@ export default new Vuex.Store({
|
||||
|
||||
setDisconnected (state) {
|
||||
state.socket.isConnected = false
|
||||
Vue.prototype.$socket.reconnect();
|
||||
},
|
||||
|
||||
setPrinterData(state, data) {
|
||||
Object.assign(state.printer, data);
|
||||
|
||||
if (state.object.heater.available_heaters.length) {
|
||||
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)) {
|
||||
if (state.object.heater.available_heaters.includes(key)) {
|
||||
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));
|
||||
@@ -169,6 +207,14 @@ export default new Vuex.Store({
|
||||
|
||||
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) {
|
||||
@@ -181,11 +227,7 @@ export default new Vuex.Store({
|
||||
message: data
|
||||
});
|
||||
|
||||
if (data.substring(0,2) === "//") {
|
||||
data = data.replace("//", "");
|
||||
Vue.$toast.warning(data);
|
||||
} else if (data.substring(0,2) === "!!") {
|
||||
data = data.replace("!!", "");
|
||||
if (data.substring(0,2) === "!!") {
|
||||
Vue.$toast.error(data);
|
||||
}
|
||||
},
|
||||
@@ -226,8 +268,29 @@ export default new Vuex.Store({
|
||||
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);
|
||||
//Vue.$toast.error(data.message);
|
||||
window.console.log(data);
|
||||
},
|
||||
|
||||
setPausedState(state, data) {
|
||||
@@ -302,9 +365,11 @@ export default new Vuex.Store({
|
||||
break;
|
||||
|
||||
default:
|
||||
window.console.log("Default return");
|
||||
if (data.error) window.console.error("JSON-RPC: " + data.error.message);
|
||||
else window.console.log(data);
|
||||
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);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -364,8 +429,27 @@ export default new Vuex.Store({
|
||||
commit('sendGcode', data);
|
||||
},
|
||||
|
||||
switchToDashboard(state) {
|
||||
window.console.log(state);
|
||||
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("/");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export const hostname = window.location.host;
|
||||
//export const hostname = "kossel.local:8080";
|
||||
//export const hostname = "voron250.local:8080";
|
||||
Reference in new issue
Block a user