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({
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(),
value: value
}))
},
set(newValues) {
//TODO: Update deviceStore & device
//deviceStore.setValues(newValues)
deviceStore.setKnobValues(newValues.map((value) => value.value))
}
})
</script>

View File

@@ -405,6 +405,16 @@ export const useDeviceStore = defineStore('device', {
)
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)
}
}
}
})