Skip to content

Commit

Permalink
feat: enable machine limits
Browse files Browse the repository at this point in the history
  • Loading branch information
cadriel committed Oct 26, 2020
1 parent 38c563c commit 762399e
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 71 deletions.
136 changes: 71 additions & 65 deletions src/components/widgets/PrinterLimitsWidget.vue
Original file line number Diff line number Diff line change
@@ -1,69 +1,67 @@
<template>
<v-expansion-panels flat>
<v-expansion-panel>
<v-expansion-panel-header>Acceleration, Velocity &amp; Limits</v-expansion-panel-header>
<v-expansion-panel-content>
<!-- <v-col>
Velocity Limits
These are not persistent. They will reset to your printer configuration on host reboot.
<v-divider></v-divider>
</v-col> -->
<!-- Speed and Flow Adjust -->
<v-row>
<v-col cols="12" sm="6" class="px-2 pt-0 pb-5">
<input-slider
label="Velocity"
value-suffix="mm/s"
:value="velocity.current"
:min="0"
:max="velocity.max"
:disabled="!klippyConnected"
:loading="hasWait(waits.onSetVelocity)"
@input="setVelocity($event)">
</input-slider>
</v-col>
<v-col cols="12" sm="6" class="px-2 pt-0 pb-5">
<input-slider
label="Square Corner Velocity"
value-suffix="mm/s"
:value="scv.current"
:min="0"
:max="scv.max"
:disabled="!klippyConnected"
:loading="hasWait(waits.onSetSQV)"
@input="setSCV($event)">
</input-slider>
</v-col>
</v-row>
<v-row>
<v-col cols="12" sm="6" class="px-2 py-0">
<input-slider
label="Acceleration"
value-suffix="mm/s^2"
:value="accel.current"
:min="0"
:max="accel.max"
:disabled="!klippyConnected"
:loading="hasWait(waits.onSetAcceleration)"
@input="setAcceleration($event)">
</input-slider>
</v-col>
<v-col cols="12" sm="6" class="px-2 py-0">
<input-slider
label="Deceleration"
value-suffix="mm/s^2"
:value="decel.current"
:min="0"
:max="decel.max"
:disabled="!klippyConnected"
:loading="hasWait(waits.onSetDeceleration)"
@input="setDeceleration($event)">
</input-slider>
</v-col>
</v-row>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
<div>
<v-btn block text @click="limitsVisible = !limitsVisible" class="mb-2">
{{ (limitsVisible) ? 'Hide' : 'Show' }} machine limits
<v-icon>{{ (limitsVisible) ? icons.chevronUp : icons.chevronDown }}</v-icon>
</v-btn>
<v-expand-transition>
<!-- Speed and Flow Adjust -->
<div v-show="limitsVisible">
<v-row>
<v-col cols="12" sm="6" class="px-2 pt-0 pb-5">
<input-slider
label="Velocity"
value-suffix="mm/s"
:value="velocity.current"
:min="0"
:max="velocity.max"
:disabled="!klippyConnected"
:loading="hasWait(waits.onSetVelocity)"
@input="setVelocity($event)">
</input-slider>
</v-col>
<v-col cols="12" sm="6" class="px-2 pt-0 pb-5">
<input-slider
label="Square Corner Velocity"
value-suffix="mm/s"
:value="scv.current"
:min="0"
:max="scv.max"
:disabled="!klippyConnected"
:loading="hasWait(waits.onSetSQV)"
@input="setSCV($event)">
</input-slider>
</v-col>
</v-row>
<v-row>
<v-col cols="12" sm="6" class="px-2 pt-0 pb-0">
<input-slider
label="Acceleration"
value-suffix="mm/s^2"
:value="accel.current"
:min="0"
:max="accel.max"
:disabled="!klippyConnected"
:loading="hasWait(waits.onSetAcceleration)"
@input="setAcceleration($event)">
</input-slider>
</v-col>
<v-col cols="12" sm="6" class="px-2 pt-0 pb-0">
<input-slider
label="Deceleration"
value-suffix="mm/s^2"
:value="decel.current"
:min="0"
:max="decel.max"
:disabled="!klippyConnected"
:loading="hasWait(waits.onSetDeceleration)"
@input="setDeceleration($event)">
</input-slider>
</v-col>
</v-row>
</div>
</v-expand-transition>
</div>
</template>

<script lang="ts">
Expand All @@ -80,6 +78,14 @@ import InputSlider from '@/components/inputs/InputSlider.vue'
export default class PrinterLimitsWidget extends Mixins(UtilsMixin) {
waits = Waits
get limitsVisible (): boolean {
return this.$store.state.config.localConfig.limitsVisible
}
set limitsVisible (val: boolean) {
this.$store.dispatch('config/saveLocalStorage', { limitsVisible: val })
}
get velocity () {
const max = parseInt(this.$store.state.socket.printer.configfile.config.printer.max_velocity)
return {
Expand Down
10 changes: 4 additions & 6 deletions src/components/widgets/ToolheadWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,19 @@
</v-col>

<v-col class="pt-0">
<!-- Extruder Moves, Tooldhead Position-->
<!-- <v-container fluid class="pa-0"> -->
<extruder-moves-widget v-if="!printerPrinting"></extruder-moves-widget>
<toolhead-position-widget></toolhead-position-widget>
<!-- </v-container> -->
<extruder-moves-widget v-if="!printerPrinting"></extruder-moves-widget>
<toolhead-position-widget></toolhead-position-widget>
</v-col>
</v-row>

<v-row>
<v-col class="pt-0">
<!-- Part cooling -->
<fans-widget></fans-widget>

<!-- Speed and Flow Adjustments -->
<speed-and-flow-adjust-widget></speed-and-flow-adjust-widget>
<!-- <printer-limits-widget></printer-limits-widget> -->
<printer-limits-widget></printer-limits-widget>
</v-col>
</v-row>
</v-container>
Expand Down
1 change: 1 addition & 0 deletions src/store/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const state: ConfigState = {
localConfig: {
cameraVisible: false,
chartVisible: true,
limitsVisible: false,
darkMode: true
},
fileConfig: {
Expand Down
1 change: 1 addition & 0 deletions src/store/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface LocalConfig {
[key: string]: string | boolean | number;
cameraVisible: boolean;
chartVisible: boolean;
limitsVisible: boolean;
darkMode: boolean;
}

Expand Down

0 comments on commit 762399e

Please sign in to comment.