Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add remaing Filament weight in Printer Status #460

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
14 changes: 13 additions & 1 deletion src/components/widgets/status/StatusTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
</status-label>

<status-label :label="$t('app.general.label.filament')">
<span v-if="filament_used > 0 && printerPrinting">{{ $filters.getReadableLengthString(filament_used) }}</span>
<span v-if="filament_used > 0 && printerPrinting">{{ $filters.getReadableLengthString(filament_used) }} / {{ $filters.getReadableLengthString(filament_total) }} <br /> remaining: {{filament_weight_needed.toFixed(2)}} g </span>
</status-label>

<status-label :label="$t('app.general.label.layer')">
Expand Down Expand Up @@ -341,6 +341,18 @@ export default class StatusTab extends Mixins(StateMixin, FilesMixin) {
return this.$store.state.printer.printer.current_file.filament_total || 0
}

/**
* Total filament weight according to the current file / slicer.
*/
get filament_weight_needed () {
const filament_weight_total = this.$store.state.printer.printer.current_file.filament_weight_total || 0
if (this.filament_used > 0 && this.filament_total > 0 && filament_weight_total > 0) {
return (1 - this.filament_used / this.filament_total) * filament_weight_total
} else {
return 0
}
}

/**
* Work out flow provided our used filament changed, and we've not calculated
* within a given delta (2sec).
Expand Down