Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
851c17a6d4 | ||
|
|
aa0780097c | ||
|
|
1ae7827f7e | ||
|
|
98950a2b9a | ||
|
|
3051c9a033 | ||
|
|
da7dc25b51 | ||
|
|
ea8d6cfb84 |
No files matched your search
@@ -1,24 +1,69 @@
|
||||
# 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.5/kwc-alpha-0.0.5.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
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
Example Klipper macros:
|
||||
```
|
||||
npm run build
|
||||
[pause_resume]
|
||||
|
||||
[gcode_macro CANCEL]
|
||||
default_parameter_X: 230
|
||||
default_parameter_Y: 230
|
||||
default_parameter_Z: 10
|
||||
gcode:
|
||||
M104 S0
|
||||
M140 S0
|
||||
M141 S0
|
||||
M106 S0
|
||||
CLEAR_PAUSE
|
||||
|
||||
[gcode_macro PAUSE]
|
||||
rename_existing: BASE_PAUSE
|
||||
default_parameter_X: 230
|
||||
default_parameter_Y: 230
|
||||
default_parameter_Z: 10
|
||||
gcode:
|
||||
SAVE_GCODE_STATE NAME=PAUSE_state
|
||||
BASE_PAUSE
|
||||
G91
|
||||
G1 E-1.7 F2100
|
||||
G1 Z{Z}
|
||||
G90
|
||||
G1 X{X} Y{Y} F6000
|
||||
G91
|
||||
|
||||
[gcode_macro RESUME]
|
||||
rename_existing: BASE_RESUME
|
||||
gcode:
|
||||
G91
|
||||
G1 E1.7 F2100
|
||||
G91
|
||||
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
|
||||
BASE_RESUME
|
||||
```
|
||||
|
||||
### Lints and fixes files
|
||||
## Update KWC to V0.0.5
|
||||
```
|
||||
npm run lint
|
||||
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
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||
and update your macros
|
||||
+13
-3
@@ -46,9 +46,18 @@
|
||||
</v-scroll-y-transition>
|
||||
</v-content>
|
||||
|
||||
<v-dialog v-model="isConnecting" persistent width="300">
|
||||
<v-card color="primary" dark >
|
||||
<v-card-text class="pt-2">
|
||||
Connecting to Klipper
|
||||
<v-progress-linear indeterminate color="white" class="mb-0"></v-progress-linear>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<v-footer app class="d-block">
|
||||
<span v-if="version">{{ version }}</span>
|
||||
<span class="float-right">© 2019</span>
|
||||
<span class="float-right">© 2020</span>
|
||||
</v-footer>
|
||||
</v-app>
|
||||
</template>
|
||||
@@ -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: {
|
||||
|
||||
@@ -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>
|
||||
@@ -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>{{ 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="(printer_state === 'Ready' && printer_is_paused)" :loading="btnStatusCancel" @click="btnCancelJob">cancel job</v-btn>
|
||||
<v-btn class="orange ml-2" v-if="(printer_state === 'Ready' && printer_is_paused)" :loading="btnStatusResume" @click="btnResumeJob">resume job</v-btn>
|
||||
</v-list-item>
|
||||
<v-divider class="my-2" ></v-divider>
|
||||
<v-card-text class="px-0 pt-0 pb-2 content">
|
||||
@@ -35,31 +35,55 @@
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-divider class="my-2" v-if="(toolhead && toolhead.status === 'Printing') || is_paused"></v-divider>
|
||||
<v-layout wrap class=" text-center" v-if="(toolhead && toolhead.status === 'Printing') || is_paused">
|
||||
<v-divider class="my-2" v-if="printer_is_printing || printer_is_paused"></v-divider>
|
||||
<v-layout wrap class=" text-center" v-if="printer_is_printing || printer_is_paused">
|
||||
<v-flex col tag="strong" class="category-header">
|
||||
Printstatus
|
||||
</v-flex>
|
||||
<v-flex grow class="equal-width">
|
||||
<v-layout column>
|
||||
<v-flex tag="strong">printing</v-flex>
|
||||
<v-flex tag="span">{{ formatTime(toolhead.printing_time) }}</v-flex>
|
||||
<v-flex tag="strong">Filament used</v-flex>
|
||||
<v-flex tag="span">{{ filament_used.toFixed(2) }}mm</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
<v-flex grow class="equal-width">
|
||||
<v-layout column>
|
||||
<v-flex tag="strong">estimated</v-flex>
|
||||
<v-flex tag="strong">Print Time</v-flex>
|
||||
<v-flex tag="span">{{ formatTime(print_time) }}</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
<v-flex grow class="equal-width">
|
||||
<v-layout column>
|
||||
<v-flex tag="strong">total</v-flex>
|
||||
<v-flex tag="span">{{ formatTime(print_time + toolhead.printing_time) }}</v-flex>
|
||||
<v-flex tag="strong">Total Time</v-flex>
|
||||
<v-flex tag="span">{{ formatTime(print_time_total) }}</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout wrap class=" text-center" v-if="(toolhead && toolhead.status === 'Printing') || is_paused">
|
||||
<v-divider class="my-2" v-if="printer_is_printing || printer_is_paused"></v-divider>
|
||||
<v-layout wrap class=" text-center" v-if="printer_is_printing || printer_is_paused">
|
||||
<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">Time</v-flex>
|
||||
<v-flex tag="span">{{ print_time > 0 && printProgress > 0 ? formatTime(print_time / printProgress) : '--' }}</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-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-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout wrap class=" text-center" v-if="printer_is_printing || printer_is_paused">
|
||||
<v-layout column class="mt-2" >
|
||||
<v-progress-linear
|
||||
:value="printProgress * 100"
|
||||
@@ -76,23 +100,36 @@
|
||||
</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'
|
||||
]),
|
||||
},
|
||||
methods: {
|
||||
btnPauseJob() {
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
<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>{{ heatersCount }} heaters</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>
|
||||
@@ -37,7 +41,8 @@
|
||||
datasets: state => state.temperaturChart.datasets,
|
||||
}),
|
||||
...mapGetters([
|
||||
'heatersCount'
|
||||
'heatersCount',
|
||||
'temperature_fans'
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -10,7 +10,11 @@
|
||||
<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>
|
||||
@@ -29,7 +33,20 @@
|
||||
</v-col>
|
||||
<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" ></toolInput>
|
||||
<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>
|
||||
|
||||
+118
-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,
|
||||
@@ -45,10 +51,17 @@ export default new Vuex.Store({
|
||||
is_paused: false
|
||||
},
|
||||
idle_timeout: {
|
||||
printing_time: 0
|
||||
printing_time: 0,
|
||||
state: "",
|
||||
},
|
||||
virtual_sdcard: {
|
||||
process: 0
|
||||
process: 0,
|
||||
current_file: "",
|
||||
is_active: false,
|
||||
filament_used: 0,
|
||||
file_position: 0,
|
||||
print_duration: 0,
|
||||
total_duration: 0,
|
||||
}
|
||||
},
|
||||
object: {
|
||||
@@ -97,7 +110,46 @@ 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;
|
||||
});
|
||||
},
|
||||
|
||||
current_file_size: state => {
|
||||
let current_file = state.printer.virtual_sdcard.current_file;
|
||||
let files = state.files;
|
||||
|
||||
if (current_file !== '') {
|
||||
files.filter(file => file.name == current_file);
|
||||
if (files.length) return files[0].size;
|
||||
}
|
||||
|
||||
return 0;
|
||||
},
|
||||
},
|
||||
|
||||
mutations: {
|
||||
@@ -107,18 +159,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 +226,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 +246,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 +287,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 +384,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,6 +448,26 @@ export default new Vuex.Store({
|
||||
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("/");
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export const hostname = window.location.host;
|
||||
//export const hostname = "kossel.local:8080";
|
||||
//export const hostname = window.location.host;
|
||||
export const hostname = "kossel.local:8080";
|
||||
Reference in new issue
Block a user