UPD: Allow updating knob values

This commit is contained in:
Robert Kossessa
2024-05-01 21:45:41 +02:00
parent c1e10385b8
commit a2b2bd0b68
2 changed files with 13 additions and 3 deletions

View File

@@ -17,14 +17,14 @@ const deviceStore = useDeviceStore()
const knobValues = computed({ const knobValues = computed({
get() { get() {
return Object.values(deviceStore.currentProfile.knob).map((value, index) => ({ if (!deviceStore.currentProfile) return []
return Object.values(deviceStore.currentProfile!.knob).map((value, index) => ({
id: index.toString(), id: index.toString(),
value: value value: value
})) }))
}, },
set(newValues) { set(newValues) {
//TODO: Update deviceStore & device deviceStore.setKnobValues(newValues.map((value) => value.value))
//deviceStore.setValues(newValues)
} }
}) })
</script> </script>

View File

@@ -405,6 +405,16 @@ export const useDeviceStore = defineStore('device', {
) )
this.setDirtyState(true) this.setDirtyState(true)
} }
},
setKnobValues(values: Value[], updateDevice: boolean = true) {
this.currentProfile!.knob = values
if (updateDevice) {
sendDebounced(
this.currentDeviceId!,
JSON.stringify({ profile: this.currentProfileName, updates: { knob: values } })
)
this.setDirtyState(true)
}
} }
} }
}) })