Compare commits

...
4 Commits
Author SHA1 Message Date
Stefan Dej 851c17a6d4 update to API .03 2020-03-14 00:52:23 +01:00
Stefan Dej aa0780097c update README.md for v0.0.4 2020-03-10 00:48:40 +01:00
Stefan Dej 1ae7827f7e fix: disable respond for '//' messages
add feature: history in console input
2020-03-10 00:42:54 +01:00
Stefan Dej 98950a2b9a update README.md to v0.0.3 2020-03-09 00:56:08 +01:00
6 changed files with 120 additions and 38 deletions

No files matched your search

+15 -12
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.2/kwc-alpha-0.0.2.zip && unzip kwc.zip && rm kwc.zip
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
```
Configure web_server in printer.cfg:
@@ -18,16 +18,16 @@ port: 8080
trusted_clients:
192.168.1.0/24
web_path: ~/kwc
pause_gcode: PAUSE_PRINT
resume_gcode: RESUME_PRINT
cancel_gcode: CANCEL_PRINT
```
Example Klipper macros:
```
[pause_resume]
[gcode_macro CANCEL_PRINT]
[gcode_macro CANCEL]
default_parameter_X: 230
default_parameter_Y: 230
default_parameter_Z: 10
gcode:
M104 S0
M140 S0
@@ -35,13 +35,14 @@ gcode:
M106 S0
CLEAR_PAUSE
[gcode_macro PAUSE_PRINT]
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
default_parameter_X: 230
default_parameter_Y: 230
default_parameter_Z: 10
gcode:
SAVE_GCODE_STATE NAME=PAUSE_state
PAUSE
BASE_PAUSE
G91
G1 E-1.7 F2100
G1 Z{Z}
@@ -49,18 +50,20 @@ gcode:
G1 X{X} Y{Y} F6000
G91
[gcode_macro RESUME_PRINT]
[gcode_macro RESUME]
rename_existing: BASE_RESUME
gcode:
G91
G1 E1.7 F2100
G91
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
RESUME
BASE_RESUME
```
## Update KWC to V0.0.2
## Update KWC to V0.0.5
```
rm -R ~/kwc/*
cd ~/kwc
wget -q -O kwc.zip https://github.com/meteyou/kwc/releases/download/V0.0.2/kwc-alpha-0.0.2.zip && unzip kwc.zip && rm kwc.zip
```
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
```
and update your macros
+1 -1
View File
@@ -57,7 +57,7 @@
<v-footer app class="d-block">
<span v-if="version">{{ version }}</span>
<span class="float-right">&copy; 2019</span>
<span class="float-right">&copy; 2020</span>
</v-footer>
</v-app>
</template>
+53 -16
View File
@@ -4,11 +4,11 @@
<v-list-item-avatar color="grey"><v-icon dark>fa-info</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Status</v-list-item-title>
<v-list-item-subtitle>{{ toolhead !== null && 'status' in toolhead ? toolhead.status : "" }}</v-list-item-subtitle>
<v-list-item-subtitle>{{ 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' && printProgress > 0) || is_paused"></v-divider>
<v-layout wrap class=" text-center" v-if="(toolhead && toolhead.status === 'Printing' && printProgress > 0) || is_paused">
<v-divider class="my-2" v-if="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' && printProgress > 0) || 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() {
+28 -1
View File
@@ -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 = "";
}
}
}
}
+22 -7
View File
@@ -51,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: {
@@ -131,6 +138,18 @@ export default new Vuex.Store({
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: {
@@ -227,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);
}
},
+1 -1
View File
@@ -1,2 +1,2 @@
//export const hostname = window.location.host;
export const hostname = "voron250.local:8080";
export const hostname = "kossel.local:8080";