feat: add function to change/select time calculations for estimate and ETA times
Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
1 parent
05f5da93d3
commit
ae82bfe7f7
5 files changed
+64
-11
No files matched your search
@@ -10,6 +10,14 @@
|
||||
<v-select v-model="currentLanguage" :items="availableLanguages" hide-details outlined dense></v-select>
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row :title="$t('Settings.GeneralTab.CalcEstimateTime')" :sub-title="$t('Settings.GeneralTab.CalcEstimateTimeDescription')">
|
||||
<v-select v-model="calcEstimateTime" :items="calcEstimateItems" multiple hide-details dense outlined></v-select>
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row :title="$t('Settings.GeneralTab.CalcEtaTime')" :sub-title="$t('Settings.GeneralTab.CalcEtaTimeDescription')">
|
||||
<v-select v-model="calcEtaTime" :items="calcEtaTimeItems" multiple hide-details dense outlined></v-select>
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row :title="$t('Settings.GeneralTab.BoolBigThumbnail')" :sub-title="$t('Settings.GeneralTab.BoolBigThumbnailDescription')" :dynamicSlotWidth="true">
|
||||
<v-switch v-model="boolBigThumbnail" hide-details class="mt-0"></v-switch>
|
||||
</settings-row>
|
||||
@@ -117,6 +125,37 @@ export default class SettingsGeneralTab extends Mixins(BaseMixin) {
|
||||
return languages
|
||||
}
|
||||
|
||||
get calcEstimateItems() {
|
||||
return [
|
||||
{ value: 'file', text: 'File' },
|
||||
{ value: 'filament', text: 'Filament' },
|
||||
]
|
||||
}
|
||||
|
||||
get calcEstimateTime() {
|
||||
return this.$store.state.gui.general.calcEstimateTime
|
||||
}
|
||||
|
||||
set calcEstimateTime(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'general.calcEstimateTime', value: newVal })
|
||||
}
|
||||
|
||||
get calcEtaTimeItems() {
|
||||
return [
|
||||
{ value: 'file', text: 'File' },
|
||||
{ value: 'filament', text: 'Filament' },
|
||||
{ value: 'slicer', text: 'Slicer' },
|
||||
]
|
||||
}
|
||||
|
||||
get calcEtaTime() {
|
||||
return this.$store.state.gui.general.calcEtaTime
|
||||
}
|
||||
|
||||
set calcEtaTime(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'general.calcEtaTime', value: newVal })
|
||||
}
|
||||
|
||||
get boolBigThumbnail() {
|
||||
return this.$store.state.gui.dashboard.boolBigThumbnail
|
||||
}
|
||||
|
||||
@@ -498,6 +498,10 @@
|
||||
"General": "General",
|
||||
"PrinterName": "Printer Name",
|
||||
"Language": "Language",
|
||||
"CalcEstimateTime": "Estimate time calculation",
|
||||
"CalcEstimateTimeDescription": "If multiple are selected, an average will be calculated",
|
||||
"CalcEtaTime": "ETA calculation",
|
||||
"CalcEtaTimeDescription": "If multiple are selected, an average will be calculated",
|
||||
"BoolBigThumbnail": "Large thumbnail",
|
||||
"BoolBigThumbnailDescription": "Display a large thumbnail in the status panel during a print.",
|
||||
"DisplayCANCEL_PRINT": "Display CANCEL_PRINT",
|
||||
|
||||
@@ -162,7 +162,7 @@ export const getters: GetterTree<FarmPrinterState, any> = {
|
||||
|
||||
output.push({
|
||||
name: 'ETA',
|
||||
value: h+':'+m,
|
||||
value: getters.estimated_time_eta > 0 ? h+':'+m : '--',
|
||||
file: getters.estimated_time_file,
|
||||
filament: getters.estimated_time_filament,
|
||||
slicer: getters.estimated_time_slicer,
|
||||
@@ -212,18 +212,21 @@ export const getters: GetterTree<FarmPrinterState, any> = {
|
||||
estimated_time_eta: (state, getters) => {
|
||||
let time = 0
|
||||
let timeCount = 0
|
||||
const boolFileCalc = state.data.gui?.general?.calcEtaTime?.includes('file') ?? true
|
||||
const boolFilamentCalc = state.data.gui?.general?.calcEtaTime?.includes('filament') ?? true
|
||||
const boolSlicerCalc = state.data.gui?.general?.calcEtaTime?.includes('slicer') ?? true
|
||||
|
||||
if (getters.estimated_time_file > 0) {
|
||||
if (boolFileCalc && getters.estimated_time_file > 0) {
|
||||
time += parseInt(getters.estimated_time_file)
|
||||
timeCount++
|
||||
}
|
||||
|
||||
if (getters.estimated_time_filament > 0) {
|
||||
if (boolFilamentCalc && getters.estimated_time_filament > 0) {
|
||||
time += parseInt(getters.estimated_time_filament)
|
||||
timeCount++
|
||||
}
|
||||
|
||||
if (getters.estimated_time_slicer > 0) {
|
||||
if (boolSlicerCalc && getters.estimated_time_slicer > 0) {
|
||||
time += parseInt(getters.estimated_time_slicer)
|
||||
timeCount++
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ export const getDefaultState = (): GuiState => {
|
||||
displayZOffsetStandby: false,
|
||||
confirmOnEmergencyStop: false,
|
||||
confirmOnPowerDeviceChange: false,
|
||||
calcEstimateTime: ['file', 'filament'],
|
||||
calcEtaTime: ['file', 'filament', 'slicer'],
|
||||
},
|
||||
theme: {
|
||||
logo: defaultLogoColor,
|
||||
|
||||
@@ -690,16 +690,18 @@ export const getters: GetterTree<PrinterState, RootState> = {
|
||||
return 0
|
||||
},
|
||||
|
||||
getEstimatedTimeAvg: (state, getters) => {
|
||||
getEstimatedTimeAvg: (state, getters, rootState) => {
|
||||
let time = 0
|
||||
let timeCount = 0
|
||||
const boolFileCalc = rootState.gui?.general?.calcEstimateTime?.includes('file') ?? false
|
||||
const boolFilamentCalc = rootState.gui?.general?.calcEstimateTime?.includes('filament') ?? false
|
||||
|
||||
if (getters.getEstimatedTimeFile > 0) {
|
||||
if (boolFileCalc && getters.getEstimatedTimeFile > 0) {
|
||||
time += parseInt(getters.getEstimatedTimeFile)
|
||||
timeCount++
|
||||
}
|
||||
|
||||
if (getters.getEstimatedTimeFilament > 0) {
|
||||
if (boolFilamentCalc && getters.getEstimatedTimeFilament > 0) {
|
||||
time += parseInt(getters.getEstimatedTimeFilament)
|
||||
timeCount++
|
||||
}
|
||||
@@ -709,21 +711,24 @@ export const getters: GetterTree<PrinterState, RootState> = {
|
||||
return 0
|
||||
},
|
||||
|
||||
getEstimatedTimeETA: (state, getters) => {
|
||||
getEstimatedTimeETA: (state, getters, rootState) => {
|
||||
let time = 0
|
||||
let timeCount = 0
|
||||
const boolFileCalc = rootState.gui?.general?.calcEtaTime?.includes('file') ?? false
|
||||
const boolFilamentCalc = rootState.gui?.general?.calcEtaTime?.includes('filament') ?? false
|
||||
const boolSlicerCalc = rootState.gui?.general?.calcEtaTime?.includes('slicer') ?? false
|
||||
|
||||
if (getters.getEstimatedTimeFile > 0) {
|
||||
if (boolFileCalc && getters.getEstimatedTimeFile > 0) {
|
||||
time += parseInt(getters.getEstimatedTimeFile)
|
||||
timeCount++
|
||||
}
|
||||
|
||||
if (getters.getEstimatedTimeFilament > 0) {
|
||||
if (boolFilamentCalc && getters.getEstimatedTimeFilament > 0) {
|
||||
time += parseInt(getters.getEstimatedTimeFilament)
|
||||
timeCount++
|
||||
}
|
||||
|
||||
if (getters.getEstimatedTimeSlicer > 0) {
|
||||
if (boolSlicerCalc && getters.getEstimatedTimeSlicer > 0) {
|
||||
time += parseInt(getters.getEstimatedTimeSlicer)
|
||||
timeCount++
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user