diff --git a/src/renderer/src/components/config/knob/KnobMappingConfig.vue b/src/renderer/src/components/config/knob/KnobMappingConfig.vue index cc14973..0ac1040 100644 --- a/src/renderer/src/components/config/knob/KnobMappingConfig.vue +++ b/src/renderer/src/components/config/knob/KnobMappingConfig.vue @@ -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)) } }) diff --git a/src/renderer/src/deviceStore.ts b/src/renderer/src/deviceStore.ts index 17d3e37..0e34505 100644 --- a/src/renderer/src/deviceStore.ts +++ b/src/renderer/src/deviceStore.ts @@ -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) + } } } })