Skip to content

Commit

Permalink
Update all klipper/moonraker communication to Moonraker 'August 16 20…
Browse files Browse the repository at this point in the history
…20' Version. The Klippy state is more definied and should work better now. This work is not finished!

feature: display print complete with time and filament used + reprint button

bugfix: Fix issue #48. Tempchart need to many load
bugfix: Fix issue #46. Print time > 1 day (was a moonraker bug) + format time to "1d 1h" and not "25h"
bugfix: Fix issue #39. Mainsail title will show filename
Signed-off-by: Stefan Dej <meteyou@gmail.com>
  • Loading branch information
meteyou committed Aug 30, 2020
1 parent f6873bd commit c0472df
Show file tree
Hide file tree
Showing 16 changed files with 327 additions and 293 deletions.
11 changes: 5 additions & 6 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
(
category.title !== 'Webcam' &&
category.title !== 'Heightmap' &&
(is_ready || category.alwaysShow)
(klippy_state !== 'error' || category.alwaysShow)
)
">
<v-icon>mdi-{{ category.icon }}</v-icon>
Expand All @@ -38,7 +38,7 @@

<ul class="child">
<li v-for="(page, pageIndex) in category.children" class="nav-item" v-bind:key="`${index}-${pageIndex}`">
<router-link :to="page.path" class="nav-link" @click.prevent v-if="is_ready || page.alwaysShow">
<router-link :to="page.path" class="nav-link" @click.prevent v-if="klippy_state !== 'error' || page.alwaysShow">
<v-icon>mdi-{{ page.icon }}</v-icon>
<span class="nav-title">{{ page.title }}</span>
</router-link>
Expand Down Expand Up @@ -113,16 +113,15 @@ export default {
toolhead: state => state.printer.toolhead,
hostname: state => state.printer.hostname,
printername: state => state.gui.general.printername,
version: state => state.printer.version,
version: state => state.printer.software_version,
loadingEmergencyStop: state => state.socket.loadingEmergencyStop,
isConnected: state => state.socket.isConnected,
isConnecting: state => !state.socket.isConnected,
virtual_sdcard: state => state.printer.virtual_sdcard,
current_file: state => state.printer.print_stats.filename,
boolNaviWebcam: state => state.gui.webcam.bool,
klippy_state: state => state.socket.klippy_state,
is_ready: state => state.socket.is_ready,
config: state => state.config,
klippy_state: state => state.printer.webhooks.state,
config: state => state.printer.configfile.config,
}),
...mapGetters([
'getTitle'
Expand Down
80 changes: 43 additions & 37 deletions src/charts/LineChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,26 @@ export default {
props: ['chartData'],
data() {
return {
timer: '',
options: {
events: ['onHover'],
animation: {
duration: 0 // general animation time
},
hover: {
animationDuration: 0 // duration of animations when hovering an item
},
elements: {
line: {
tension: 0 // disable bezier curves
tension: 0.4, // disable bezier curves
borderDash: undefined,
},
point: {
radius: 0,
hoverRadius: 0,
}
},
showLines: true,
legend: {
labels: {
fontColor: 'rgb(203, 203, 203)',
Expand Down Expand Up @@ -49,16 +60,19 @@ export default {
},
tooltips: {
enabled: true,
mode: 'nearest',
caretPadding: 20,
intersect: false,
callbacks: {
title: function (tooltipItem) {
let date = new Date(tooltipItem[0].label);
return date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
return date.getHours()+":"+(date.getMinutes() < 10 ? "0" : "")+date.getMinutes()+":"+(date.getSeconds() < 10 ? "0" : "")+date.getSeconds();
},
label: function (tooltipItem, data) {
let label_target = data['datasets'][tooltipItem.datasetIndex].label+"_target";
label: function (tooltipItem/*, data*/) {
/*let label_target = data['datasets'][tooltipItem.datasetIndex].label+"_target";
let target_dataset = data['datasets'].find(dataset => dataset.label === label_target);
if (target_dataset !== undefined) return tooltipItem.value+" / "+target_dataset.data[tooltipItem.index];
if (target_dataset !== undefined && target_dataset.data[tooltipItem.index] !== undefined) return tooltipItem.value+" / "+target_dataset.data[tooltipItem.index].y;*/
return tooltipItem.value;
},
}
Expand All @@ -67,33 +81,27 @@ export default {
responsive: true,
responsiveAnimationDuration: 0, // animation duration after a resize
scales: {
xAxes: [
{
gridLines: {
color: 'rgba(0,0,0,0.2)',
display: true
},
ticks: {
minor: {
fontColor: 'rgb(203, 203, 203)',
fontFamily: 'Roboto,sans-serif'
},
major: {
fontColor: 'rgb(203, 203, 203)',
fontFamily: 'Roboto,sans-serif'
},
min: new Date() - maxSampleTime,
max: new Date()
},
time: {
unit: 'minute',
displayFormats: {
minute: 'HH:mm'
}
xAxes: [{
type: 'time',
time: {
unit: 'minute',
displayFormats: {
second: 'HH:mm:ss',
minute: 'HH:mm'
}
},
ticks: {
minor: {
fontColor: 'rgb(203, 203, 203)',
fontFamily: 'Roboto,sans-serif'
},
type: 'time',
}
],
min: new Date() - maxSampleTime,
max: new Date(),
},
gridLines: {
color: 'rgba(203,203,203,0.1)',
},
}],
yAxes: [
{
gridLines: {
Expand All @@ -120,8 +128,11 @@ export default {
}
}
},
created () {
this.timer = setInterval(this.update, 500);
},
mounted () {
this.renderChart(this.chartData, this.options)
this.renderChart(this.chartData, this.options);
},
methods: {
update() {
Expand All @@ -131,9 +142,4 @@ export default {
this.$data._chart.update();
}
},
watch: {
chartData () {
this.update();
}
}
}
10 changes: 5 additions & 5 deletions src/components/panels/ControlPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

<template>
<v-card>
<v-row class="" v-if="['standby', 'complete'].includes(printer_state)">
<v-row class="" v-if="['standby', 'complete', 'error'].includes(printer_state)">
<v-col class="col-12 pb-0 text-center">
<div class="d-inline-block mx-2 my-1"><v-btn @click="doHome" :loading="loadingHomeAll" :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-inline-block mx-2 my-1" v-if="config.hasOwnProperty('z_tilt')"><v-btn @click="doZtilt" :loading="loadingZTilt" color="primary">Z Tilt</v-btn></div>
</v-col>
</v-row>
<v-row class="mt-3" v-if="['standby', 'complete'].includes(printer_state)">
<v-row class="mt-3" v-if="['standby', 'complete', 'error'].includes(printer_state)">
<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="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 class="body-2">X-100</span></v-btn>
Expand All @@ -24,7 +24,7 @@
</v-btn-toggle>
</v-col>
</v-row>
<v-row class="mt-3" v-if="['standby', 'complete'].includes(printer_state)">
<v-row class="mt-3" v-if="['standby', 'complete', 'error'].includes(printer_state)">
<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="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 class="body-2">Y-100</span></v-btn>
Expand All @@ -37,7 +37,7 @@
</v-btn-toggle>
</v-col>
</v-row>
<v-row class="mt-3" v-if="['standby', 'complete'].includes(printer_state)">
<v-row class="mt-3" v-if="['standby', 'complete', 'error'].includes(printer_state)">
<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="doSendMove('Z-25')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span class="body-2">Z-25</span></v-btn>
Expand Down Expand Up @@ -81,7 +81,7 @@
computed: {
...mapState({
homedAxes: state => state.printer.toolhead.homed_axes,
config: state => state.config,
config: state => state.printer.configfile.config,
loadings: state => state.loadings,
printer_state: state => state.printer.print_stats.state
}),
Expand Down
10 changes: 5 additions & 5 deletions src/components/panels/KlippyStatePanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
<v-card>
<v-list-item>
<v-list-item-avatar color="grey">
<v-icon dark v-if="error_detected">mdi-alert-circle</v-icon>
<v-icon dark v-if="!error_detected">mdi-information-variant</v-icon>
<v-icon dark>mdi-alert-circle</v-icon>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Klippy-Status</v-list-item-title>
<v-list-item-title class="subtitle-1">{{ state }}</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-layout wrap class=" text-center">
<v-flex col class="text-left"><pre>{{ klippy_message }}</pre></v-flex>
<v-flex col class="text-left"><pre>{{ state_message }}</pre></v-flex>
</v-layout>
</v-card-text>
<v-divider class="my-2" ></v-divider>
Expand All @@ -29,8 +29,8 @@
export default {
computed: {
...mapState({
error_detected: state => state.socket.error_detected,
klippy_message: state => state.socket.klippy_message,
state: state => state.printer.webhooks.state,
state_message: state => state.printer.webhooks.state_message,
loadingRestart: state => state.socket.loadingRestart,
loadingRestartFirmware: state => state.socket.loadingRestartFirmware,
}),
Expand Down
18 changes: 9 additions & 9 deletions src/components/panels/PeripheriePanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@

<template>
<div>
<v-card v-if="bool_fan">
<v-card v-if="fan">
<v-toolbar flat dense >
<v-toolbar-title>
<span class="subheading"><v-icon :class="fan_speed > 0 ? 'mdi mdi-fan icon-rotate' : 'mdi mdi-fan'" left></v-icon>Tool Fan</span>
<span class="subheading"><v-icon :class="fan.speed > 0 ? 'mdi mdi-fan icon-rotate' : 'mdi mdi-fan'" left></v-icon>Tool Fan</span>
</v-toolbar-title>
</v-toolbar>

<v-card-text class="pb-0">
<tool-slider :target="fan_speed" :multi="100" command="M106" attribute-name="S" :attribute-scale="2.55" ></tool-slider>
<tool-slider :target="fan.speed" :multi="100" command="M106" attribute-name="S" :attribute-scale="2.55" ></tool-slider>
</v-card-text>
</v-card>
<v-card class="mt-6" v-if="is_printing">
<v-card class="mt-6" v-if="['printing', 'paused'].includes(printer_state)">
<v-toolbar flat dense >
<v-toolbar-title>
<span class="subheading"><v-icon class="mdi mdi-timer" left></v-icon>Speed Factor</span>
Expand All @@ -39,7 +39,7 @@
<tool-slider :target="speed_factor" :max="200" :multi="100" command="M220" attribute-name="S" ></tool-slider>
</v-card-text>
</v-card>
<v-card class="mt-6" v-if="is_printing">
<v-card class="mt-6" v-if="['printing', 'paused'].includes(printer_state)">
<v-toolbar flat dense >
<v-toolbar-title>
<span class="subheading"><v-icon class="mdi mdi-texture" left></v-icon>Extrusion Factor</span>
Expand Down Expand Up @@ -68,12 +68,12 @@
},
computed: {
...mapState({
fan_speed: state => state.printer.fan.speed,
extrude_factor: state => state.printer.gcode.extrude_factor,
speed_factor: state => state.printer.gcode.speed_factor,
extrude_factor: state => state.printer.gcode_move.extrude_factor,
speed_factor: state => state.printer.gcode_move.speed_factor,
printer_state: state => state.printer.print_stats.state,
}),
...mapGetters([
'bool_fan',
'fan',
'is_printing'
])
},
Expand Down
12 changes: 12 additions & 0 deletions src/components/panels/Settings/SystemPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,22 @@
methods: {
doRestart() {
this.$store.commit('setLoadingRestart', true);
this.$store.commit('setPrinterData', {
webhooks: {
state: 'shutdown',
state_message: 'RESTART'
}
});
this.$socket.sendObj('post_printer_restart', { }, "responseRestart");
},
doRestartFirmware() {
this.$store.commit('setLoadingRestartFirmware', true);
this.$store.commit('setPrinterData', {
webhooks: {
state: 'shutdown',
state_message: 'FIRMWARE RESTART'
}
});
this.$socket.sendObj('post_printer_firmware_restart', { }, "responseRestartFirmware");
},
doRebootHost() {
Expand Down
Loading

0 comments on commit c0472df

Please sign in to comment.