diff --git a/src/components/panels/StatusPanel.vue b/src/components/panels/StatusPanel.vue index 39303de4..063e95ea 100644 --- a/src/components/panels/StatusPanel.vue +++ b/src/components/panels/StatusPanel.vue @@ -150,8 +150,8 @@ {{ (filament_used / 1000).toFixed(2) }} / {{ (current_file.filament_total / 1000).toFixed(2) }}m = {{ ( 100 / current_file.filament_total * filament_used).toFixed(0) }}% @@ -182,7 +182,7 @@ Layer - {{ current_layer }} of {{ max_layers }} + {{ current_layer }} of {{ max_layers }} ETA @@ -260,7 +260,8 @@ '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) + const max = Math.ceil((this.current_file.object_height - this.current_file.first_layer_height) / this.current_file.layer_height + 1) + return max > 0 ? max : 0 } return 0 @@ -274,8 +275,10 @@ this.gcode_position !== undefined && 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 + let current_layer = Math.ceil((this.gcode_position[2] - this.current_file.first_layer_height) / this.current_file.layer_height + 1) + current_layer = (current_layer <= this.max_layers) ? current_layer : this.max_layers + + return current_layer > 0 ? current_layer : 0 } return 0