diff --git a/src/components/panels/StatusPanel.vue b/src/components/panels/StatusPanel.vue index 16ccdc9c..06eb4ae0 100644 --- a/src/components/panels/StatusPanel.vue +++ b/src/components/panels/StatusPanel.vue @@ -22,11 +22,46 @@ - mdi-pause - mdi-stop - mdi-play - mdi-close - mdi-autorenew + + + + Pause print + + + + + + Cancel print + + + + + + Resume print + + + + + + Clear print stats + + + + + + Reprint job + + @@ -59,7 +94,6 @@ current_file.thumbnails && current_file.thumbnails.length && current_file.thumbnails.find(element => element.width === 400) - "> element.width === 400 || element.width === 300)) ? 'col-12 col-sm-8 pl-sm-0' : 'col-12' + current_file.thumbnails.find(element => element.width === 400 || element.width === 300)) ? 'col-12 col-sm-8' : 'col-12' "> - + mdi-axis-arrow @@ -88,7 +122,17 @@ Z - {{ position.length ? position[2].toFixed(2) : "--" }} + + + + + + G-Code: {{ gcode_position[2].toFixed(2) }}mm + + + @@ -97,12 +141,22 @@ - + mdi-poll Filament - {{ filament_used > 1000 ? (filament_used / 1000).toFixed(2)+"m" : filament_used.toFixed(2)+"mm" }} + + + + + {{ (filament_used / 1000).toFixed(2) }} / {{ (current_file.filament_total / 1000).toFixed(2) }}m = {{ ( 100 / current_file.filament_total * filament_used).toFixed(0) }}% + + + Print @@ -118,21 +172,43 @@ + + + mdi-printer-3d + + + Speed + {{ (requested_speed / 60).toFixed(0) }} + + + Layer + {{ current_layer }} of {{ max_layers }} + + + ETA + {{ eta ? formatDateTime(eta) : '--' }} + + + + + + + - + mdi-clock-outline File - {{ print_time > 0 && printPercent > 0 ? formatTime(print_time / printPercent - print_time) : '--' }} + {{ estimated_time_file ? formatTime(estimated_time_file) : '--' }} Filament - {{ (filament_used > 0 && 'filament_total' in current_file && current_file.filament_total > filament_used) ? formatTime(print_time / (filament_used / current_file.filament_total) - print_time) : '--' }} + {{ estimated_time_filament ? formatTime(estimated_time_filament) : '--' }} Slicer - {{ 'estimated_time' in current_file && current_file.estimated_time > print_time ? formatTime(current_file.estimated_time - print_time) : '--'}} + {{ estimated_time_slicer ? formatTime(estimated_time_slicer) : '--' }} @@ -155,6 +231,8 @@ ...mapState({ toolhead: state => state.printer.toolhead, position: state => state.printer.toolhead.position, + gcode_position: state => state.printer.gcode_move.gcode_position, + requested_speed: state => state.printer.gcode_move.speed, printProgress: state => state.printer.virtual_sdcard.progress, file_position: state => state.printer.virtual_sdcard.file_position, @@ -174,6 +252,85 @@ get() { return this.$store.getters["printer/getPrintPercent"]; } + }, + max_layers: { + get() { + if ( + 'first_layer_height' in this.current_file && + 'layer_height' in this.current_file && + 'object_height' in this.current_file + ) { + return Math.ceil((this.current_file.object_height - this.current_file.first_layer_height) / this.current_file.layer_height + 1) + } + + return 0 + } + }, + current_layer: { + get() { + if ( + 'first_layer_height' in this.current_file && + 'layer_height' in this.current_file && + this.gcode_position.length >= 3 + ) { + const current_layer = Math.ceil((this.gcode_position[2] - this.current_file.first_layer_height) / this.current_file.layer_height + 1) + return (current_layer <= this.max_layers) ? current_layer : this.max_layers + } + + return 0 + } + }, + estimated_time_file: { + get() { + if (this.print_time > 0 && this.printPercent > 0) { + return (this.print_time / this.printPercent - this.print_time).toFixed(0) + } + + return 0 + } + }, + estimated_time_filament: { + get() { + if (this.filament_used > 0 && 'filament_total' in this.current_file && this.current_file.filament_total > this.filament_used) { + return (this.print_time / (this.filament_used / this.current_file.filament_total) - this.print_time).toFixed(0) + } + + return 0 + } + }, + estimated_time_slicer: { + get() { + if ('estimated_time' in this.current_file && this.current_file.estimated_time > this.print_time) { + return (this.current_file.estimated_time - this.print_time).toFixed(0) + } + + return 0 + } + }, + eta: { + get() { + let time = 0 + let timeCount = 0 + + if (this.estimated_time_file > 0) { + time += parseInt(this.estimated_time_file) + timeCount++ + } + + if (this.estimated_time_filament > 0) { + time += parseInt(this.estimated_time_filament) + timeCount++ + } + + if (this.estimated_time_slicer > 0) { + time += parseInt(this.estimated_time_slicer) + timeCount++ + } + + if (time && timeCount) return Date.now() + (time / timeCount) * 1000 + + return 0 + } } }, methods: { @@ -205,6 +362,13 @@ return h+':'+m+':'+s; }, + formatDateTime(msec) { + const date = new Date(msec) + const h = date.getHours() >= 10 ? date.getHours() : "0"+date.getHours() + const m = date.getMinutes() >= 10 ? date.getMinutes() : "0"+date.getMinutes() + + return h+":"+m + }, } }