Skip to content

Commit

Permalink
fix(timelapse): fix issue with changing timelapse settings (#1745)
Browse files Browse the repository at this point in the history
* fix(timelapse): fix issue with changing timelapse settings

Signed-off-by: Stefan Dej <[email protected]>

* fix: add rules to timelapse setting inputs

Signed-off-by: Stefan Dej <[email protected]>

* style: fix linter issue in locale en file

Signed-off-by: Stefan Dej <[email protected]>

* locale(en): add missing translation

Signed-off-by: Stefan Dej <[email protected]>

* Update src/locales/en.json

Co-authored-by: rackrick <[email protected]>

* update locales en

Co-authored-by: rackrick <[email protected]>

* style: run prettier

Signed-off-by: Stefan Dej <[email protected]>

---------

Signed-off-by: Stefan Dej <[email protected]>
Co-authored-by: rackrick <[email protected]>
  • Loading branch information
meteyou and rackrick authored Jan 29, 2024
1 parent 65a62cb commit 4f43c89
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 18 deletions.
154 changes: 138 additions & 16 deletions src/components/settings/SettingsTimelapseTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@
hide-details="auto"
outlined
dense
:rules="[
(v) => !!v || $t('Settings.TimelapseTab.RulesRequired'),
(v) => v >= 0 || $t('Settings.TimelapseTab.RulesZeroAndPositive'),
]"
:disabled="blockedsettings.includes('stream_delay_compensation')" />
</settings-row>
<v-divider class="my-2" />
Expand Down Expand Up @@ -148,6 +152,15 @@
hide-details="auto"
outlined
dense
:rules="[
(v) => !!v || $t('Settings.TimelapseTab.RulesRequired'),
(v) =>
(v >= stepperXmin && v <= stepperXmax) ||
$t('Settings.TimelapseTab.RulesBetweenMinMax', {
min: stepperXmin,
max: stepperXmax,
}),
]"
:disabled="blockedsettings.includes('park_custom_pos_x')"
hide-spin-buttons />
</settings-row>
Expand All @@ -164,6 +177,15 @@
hide-details="auto"
outlined
dense
:rules="[
(v) => !!v || $t('Settings.TimelapseTab.RulesRequired'),
(v) =>
(v >= stepperYmin && v <= stepperYmax) ||
$t('Settings.TimelapseTab.RulesBetweenMinMax', {
min: stepperYmin,
max: stepperYmax,
}),
]"
:disabled="blockedsettings.includes('park_custom_pos_y')"
hide-spin-buttons />
</settings-row>
Expand All @@ -180,6 +202,10 @@
hide-details="auto"
outlined
dense
:rules="[
(v) => !!v || $t('Settings.TimelapseTab.RulesRequired'),
(v) => v >= 0 || $t('Settings.TimelapseTab.RulesZeroAndPositive'),
]"
:disabled="blockedsettings.includes('park_custom_pos_dz')"
hide-spin-buttons />
</settings-row>
Expand All @@ -195,6 +221,10 @@
hide-details="auto"
outlined
dense
:rules="[
(v) => !!v || $t('Settings.TimelapseTab.RulesRequired'),
(v) => v >= 0 || $t('Settings.TimelapseTab.RulesZeroAndPositive'),
]"
:disabled="blockedsettings.includes('park_travel_speed')"
hide-spin-buttons />
</settings-row>
Expand All @@ -221,6 +251,10 @@
hide-details="auto"
outlined
dense
:rules="[
(v) => !!v || $t('Settings.TimelapseTab.RulesRequired'),
(v) => v > 0 || $t('Settings.TimelapseTab.RulesPositive'),
]"
:disabled="blockedsettings.includes('park_retract_speed')"
hide-spin-buttons />
</settings-row>
Expand All @@ -235,6 +269,10 @@
hide-details="auto"
outlined
dense
:rules="[
(v) => !!v || $t('Settings.TimelapseTab.RulesRequired'),
(v) => v >= 0 || $t('Settings.TimelapseTab.RulesZeroAndPositive'),
]"
:disabled="blockedsettings.includes('park_retract_distance')"
hide-spin-buttons />
</settings-row>
Expand All @@ -249,6 +287,10 @@
hide-details="auto"
outlined
dense
:rules="[
(v) => !!v || $t('Settings.TimelapseTab.RulesRequired'),
(v) => v > 0 || $t('Settings.TimelapseTab.RulesPositive'),
]"
:disabled="blockedsettings.includes('park_extrude_speed')"
hide-spin-buttons />
</settings-row>
Expand All @@ -263,6 +305,10 @@
hide-details="auto"
outlined
dense
:rules="[
(v) => !!v || $t('Settings.TimelapseTab.RulesRequired'),
(v) => v >= 0 || $t('Settings.TimelapseTab.RulesZeroAndPositive'),
]"
:disabled="blockedsettings.includes('park_extrude_distance')"
hide-spin-buttons />
</settings-row>
Expand All @@ -279,6 +325,10 @@
step="0.1"
outlined
dense
:rules="[
(v) => !!v || $t('Settings.TimelapseTab.RulesRequired'),
(v) => v >= 0 || $t('Settings.TimelapseTab.RulesZeroAndPositive'),
]"
:disabled="blockedsettings.includes('park_time')" />
</settings-row>
</template>
Expand Down Expand Up @@ -306,6 +356,10 @@
hide-details="auto"
outlined
dense
:rules="[
(v) => !!v || $t('Settings.TimelapseTab.RulesRequired'),
(v) => v > 0 || $t('Settings.TimelapseTab.RulesPositive'),
]"
:disabled="blockedsettings.includes('targetlength')"
hide-spin-buttons />
</settings-row>
Expand All @@ -320,6 +374,10 @@
hide-details="auto"
outlined
dense
:rules="[
(v) => !!v || $t('Settings.TimelapseTab.RulesRequired'),
(v) => v > 0 || $t('Settings.TimelapseTab.RulesPositive'),
]"
:disabled="blockedsettings.includes('variable_fps_min')"
hide-spin-buttons />
</settings-row>
Expand All @@ -334,6 +392,10 @@
hide-details="auto"
outlined
dense
:rules="[
(v) => !!v || $t('Settings.TimelapseTab.RulesRequired'),
(v) => v > variable_fps_min || $t('Settings.TimelapseTab.RulesMin'),
]"
:disabled="blockedsettings.includes('variable_fps_max')"
hide-spin-buttons />
</settings-row>
Expand All @@ -350,6 +412,10 @@
hide-details="auto"
outlined
dense
:rules="[
(v) => !!v || $t('Settings.TimelapseTab.RulesRequired'),
(v) => v > 0 || $t('Settings.TimelapseTab.RulesPositive'),
]"
:disabled="blockedsettings.includes('output_framerate')"
hide-spin-buttons />
</settings-row>
Expand All @@ -364,6 +430,10 @@
hide-details="auto"
outlined
dense
:rules="[
(v) => !!v || $t('Settings.TimelapseTab.RulesRequired'),
(v) => v >= 0 || $t('Settings.TimelapseTab.RulesZeroAndPositive'),
]"
:disabled="blockedsettings.includes('duplicatelastframe')"
hide-spin-buttons />
</settings-row>
Expand All @@ -377,6 +447,10 @@
hide-details="auto"
outlined
dense
:rules="[
(v) => !!v || $t('Settings.TimelapseTab.RulesRequired'),
(v) => v > 0 || $t('Settings.TimelapseTab.RulesPositive'),
]"
:disabled="blockedsettings.includes('constant_rate_factor')"
hide-spin-buttons />
</settings-row>
Expand Down Expand Up @@ -542,7 +616,9 @@ export default class SettingsTimelapseTab extends Mixins(BaseMixin) {
return this.$store.state.server.timelapse.settings.stream_delay_compensation
}
set stream_delay_compensation(newVal) {
set stream_delay_compensation(newVal: number | string) {
if (newVal === '') newVal = 0
this.$store.dispatch('server/timelapse/saveSetting', { stream_delay_compensation: newVal })
}
Expand Down Expand Up @@ -582,71 +658,105 @@ export default class SettingsTimelapseTab extends Mixins(BaseMixin) {
return this.$store.state.server.timelapse.settings.park_custom_pos_x
}
set park_custom_pos_x(newVal) {
set park_custom_pos_x(newVal: number | string) {
if (newVal === '' || newVal < this.stepperXmin || newVal > this.stepperXmax) return
this.$store.dispatch('server/timelapse/saveSetting', { park_custom_pos_x: newVal })
}
get stepperXmin() {
return this.$store.state.printer.configfile?.settings?.stepper_x?.position_min ?? 0
}
get stepperXmax() {
return this.$store.state.printer.configfile?.settings?.stepper_x?.position_max ?? 200
}
get park_custom_pos_y() {
return this.$store.state.server.timelapse.settings.park_custom_pos_y
}
set park_custom_pos_y(newVal) {
set park_custom_pos_y(newVal: number | string) {
if (newVal === '' || newVal < this.stepperYmin || newVal > this.stepperYmax) return
this.$store.dispatch('server/timelapse/saveSetting', { park_custom_pos_y: newVal })
}
get stepperYmin() {
return this.$store.state.printer.configfile?.settings?.stepper_y?.position_min ?? 0
}
get stepperYmax() {
return this.$store.state.printer.configfile?.settings?.stepper_y?.position_max ?? 200
}
get park_custom_pos_dz() {
return this.$store.state.server.timelapse.settings.park_custom_pos_dz
}
set park_custom_pos_dz(newVal) {
set park_custom_pos_dz(newVal: number | string) {
if (newVal === '' || newVal < 0) return
this.$store.dispatch('server/timelapse/saveSetting', { park_custom_pos_dz: newVal })
}
get park_travel_speed() {
return this.$store.state.server.timelapse.settings.park_travel_speed
}
set park_travel_speed(newVal) {
set park_travel_speed(newVal: number | string) {
if (newVal === '' || newVal < 0) return
this.$store.dispatch('server/timelapse/saveSetting', { park_travel_speed: newVal })
}
get park_retract_speed() {
return this.$store.state.server.timelapse.settings.park_retract_speed
}
set park_retract_speed(newVal) {
set park_retract_speed(newVal: number | string) {
if (newVal === '' || newVal <= 0) return
this.$store.dispatch('server/timelapse/saveSetting', { park_retract_speed: newVal })
}
get park_extrude_speed() {
return this.$store.state.server.timelapse.settings.park_extrude_speed
}
set park_extrude_speed(newVal) {
set park_extrude_speed(newVal: number | string) {
if (newVal === '' || newVal <= 0) return
this.$store.dispatch('server/timelapse/saveSetting', { park_extrude_speed: newVal })
}
get park_retract_distance() {
return this.$store.state.server.timelapse.settings.park_retract_distance
}
set park_retract_distance(newVal) {
set park_retract_distance(newVal: number | string) {
if (newVal === '' || newVal < 0) return
this.$store.dispatch('server/timelapse/saveSetting', { park_retract_distance: newVal })
}
get park_extrude_distance() {
return this.$store.state.server.timelapse.settings.park_extrude_distance
}
set park_extrude_distance(newVal) {
set park_extrude_distance(newVal: number | string) {
if (newVal === '' || newVal < 0) return
this.$store.dispatch('server/timelapse/saveSetting', { park_extrude_distance: newVal })
}
get park_time() {
return this.$store.state.server.timelapse.settings.park_time
}
set park_time(newVal) {
set park_time(newVal: number | string) {
if (newVal === '' || newVal < 0) return
this.$store.dispatch('server/timelapse/saveSetting', { park_time: newVal })
}
Expand All @@ -662,15 +772,19 @@ export default class SettingsTimelapseTab extends Mixins(BaseMixin) {
return this.$store.state.server.timelapse.settings.constant_rate_factor
}
set constant_rate_factor(newVal) {
set constant_rate_factor(newVal: number | string) {
if (newVal === '' || newVal <= 0) return
this.$store.dispatch('server/timelapse/saveSetting', { constant_rate_factor: newVal })
}
get output_framerate() {
return this.$store.state.server.timelapse.settings.output_framerate
}
set output_framerate(newVal) {
set output_framerate(newVal: number | string) {
if (newVal === '' || newVal <= 0) return
this.$store.dispatch('server/timelapse/saveSetting', { output_framerate: newVal })
}
Expand Down Expand Up @@ -702,31 +816,39 @@ export default class SettingsTimelapseTab extends Mixins(BaseMixin) {
return this.$store.state.server.timelapse.settings.targetlength
}
set targetlength(newVal) {
set targetlength(newVal: number | string) {
if (newVal === '' || newVal <= 0) return
this.$store.dispatch('server/timelapse/saveSetting', { targetlength: newVal })
}
get variable_fps_min() {
return this.$store.state.server.timelapse.settings.variable_fps_min
}
set variable_fps_min(newVal) {
set variable_fps_min(newVal: number | string) {
if (newVal === '' || newVal <= 0) return
this.$store.dispatch('server/timelapse/saveSetting', { variable_fps_min: newVal })
}
get variable_fps_max() {
return this.$store.state.server.timelapse.settings.variable_fps_max
}
set variable_fps_max(newVal) {
set variable_fps_max(newVal: number | string) {
if (newVal === '' || newVal <= this.variable_fps_min) return
this.$store.dispatch('server/timelapse/saveSetting', { variable_fps_max: newVal })
}
get duplicatelastframe() {
return this.$store.state.server.timelapse.settings.duplicatelastframe
}
set duplicatelastframe(newVal) {
set duplicatelastframe(newVal: number | string) {
if (newVal === '' || newVal < 0) return
this.$store.dispatch('server/timelapse/saveSetting', { duplicatelastframe: newVal })
}
Expand Down
5 changes: 5 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,11 @@
"RetractDistanceDescription": "The length of filament that the extruder retracts.",
"RetractSpeed": "Retract Speed",
"RetractSpeedDescription": "Speed at which the extruder retracts the filament.",
"RulesBetweenMinMax": "Value must be between {min} and {max}!",
"RulesMin": "Value must be minimum {min}!",
"RulesPositive": "Value must be positive!",
"RulesRequired": "Value is required!",
"RulesZeroAndPositive": "Value must be 0 or greater!",
"SaveFrames": "Save Frames",
"SaveFramesDescription": "Save the frames to a zip-file for external rendering",
"StreamDelayCompensation": "Stream Delay Compensation",
Expand Down
Loading

0 comments on commit 4f43c89

Please sign in to comment.