From 2bb97274cc6246acd8e2884c6ab9a0c24a1dce0f Mon Sep 17 00:00:00 2001 From: xPatrikTwitch Date: Mon, 16 Sep 2024 14:00:53 +0200 Subject: [PATCH] feat(gui): fans can have multiple rpm values and add "fan_multi" that has multiple rpm vlaues --- src/components/inputs/MiscellaneousSlider.vue | 20 ++++++++++++++++++- src/store/printer/getters.ts | 7 ++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/components/inputs/MiscellaneousSlider.vue b/src/components/inputs/MiscellaneousSlider.vue index fd70a0a5d..4c26f407a 100644 --- a/src/components/inputs/MiscellaneousSlider.vue +++ b/src/components/inputs/MiscellaneousSlider.vue @@ -17,7 +17,24 @@ {{ mdiFan }} {{ convertName(name) }} - {{ Math.round(rpm ?? 0) }} RPM + + {{ Math.round(rpm ?? 0) }} RPM + + {{ Math.round(parseFloat(value) * 100) }} % @@ -205,6 +222,7 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) { let gcode = `SET_PIN PIN=${this.name} VALUE=${newVal.toFixed(2)}` if (this.type === 'fan') gcode = `M106 S${newVal.toFixed(0)}` if (this.type === 'fan_generic') gcode = `SET_FAN_SPEED FAN=${this.name} SPEED=${newVal}` + if (this.type === 'fan_multi') gcode = `SET_FAN_SPEED FAN=${this.name} SPEED=${newVal}` if (this.type === 'led') gcode = `SET_LED LED=${this.name} ${this.ledChannelName}=${newVal.toFixed(2)} SYNC=0 TRANSMIT=1` diff --git a/src/store/printer/getters.ts b/src/store/printer/getters.ts index ba0204e27..b73dee4af 100644 --- a/src/store/printer/getters.ts +++ b/src/store/printer/getters.ts @@ -186,10 +186,10 @@ export const getters: GetterTree = { getFans: (state, getters) => { const fans: PrinterStateFan[] = [] - const supportedFans = ['temperature_fan', 'controller_fan', 'heater_fan', 'fan_generic', 'fan'] + const supportedFans = ['temperature_fan', 'controller_fan', 'heater_fan', 'fan_generic', 'fan_multi', 'fan'] const objects = getters.getPrinterObjects(supportedFans) - const controllableFans = ['fan_generic', 'fan'] + const controllableFans = ['fan_generic', 'fan_multi', 'fan'] objects.foreach((object: PrinterGetterObject) => { fans.push({ @@ -300,13 +300,14 @@ export const getters: GetterTree = { 'controller_fan', 'heater_fan', 'fan_generic', + 'fan_multi', 'fan', 'output_pin', 'pwm_tool', 'pwm_cycle_time', ] - const controllableFans = ['fan_generic', 'fan'] + const controllableFans = ['fan_generic', 'fan_multi', 'fan'] for (const [key, value] of Object.entries(state)) { const nameSplit = key.split(' ')