diff --git a/src/main/index.ts b/src/main/index.ts
index d3803a4..e7ef914 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -144,7 +144,7 @@ app.whenReady().then(() => {
mainWindow.webContents.send('nanoSerialApi:event', 'disconnected', deviceid, data)
})
nanoSerialApi.on('nanoSerialApi:update', (deviceid, data) => {
- if (!data.startsWith('{"idle"') && !data.startsWith('{"p"'))
+ if (!data.startsWith('{"idle"') && !data.startsWith('{"p"') && !data.startsWith('{"ks"'))
console.log('Update event', deviceid, data)
mainWindow.webContents.send('nanoSerialApi:event', 'update', deviceid, data)
})
diff --git a/src/renderer/src/components/config/values/MidiValue.vue b/src/renderer/src/components/config/values/MidiValue.vue
new file mode 100644
index 0000000..9048e3f
--- /dev/null
+++ b/src/renderer/src/components/config/values/MidiValue.vue
@@ -0,0 +1,16 @@
+
+ midi value settings
+
+
diff --git a/src/renderer/src/components/config/values/TriggerActionsValue.vue b/src/renderer/src/components/config/values/TriggerActionsValue.vue
index f4befec..d49c5be 100644
--- a/src/renderer/src/components/config/values/TriggerActionsValue.vue
+++ b/src/renderer/src/components/config/values/TriggerActionsValue.vue
@@ -30,4 +30,11 @@ const actionsEvery = ref([
])
const actionsCw = ref([])
const actionsCcw = ref([])
+
+defineProps({
+ value: {
+ type: Object,
+ required: true
+ }
+})
diff --git a/src/renderer/src/components/config/values/ValueCard.vue b/src/renderer/src/components/config/values/ValueCard.vue
index 6277955..808b0f3 100644
--- a/src/renderer/src/components/config/values/ValueCard.vue
+++ b/src/renderer/src/components/config/values/ValueCard.vue
@@ -19,7 +19,7 @@
>
@@ -64,6 +64,7 @@
@@ -113,7 +119,7 @@ import {
CommandItem,
CommandList
} from '@renderer/components/ui/command'
-import { ref } from 'vue'
+import { computed, ref } from 'vue'
import { cn } from '@renderer/lib/utils'
import ScrambleText from '@renderer/components/common/ScrambleText.vue'
import {
@@ -128,8 +134,15 @@ import {
} from 'lucide-vue-next'
import { useElementSize } from '@vueuse/core'
import TriggerActionsValue from '@renderer/components/config/values/TriggerActionsValue.vue'
+import MidiValue from './MidiValue.vue'
-defineProps({
+defineEmits(['delete'])
+
+const props = defineProps({
+ value: {
+ type: Object,
+ required: true
+ },
valueIndex: {
type: Number,
required: false
@@ -137,13 +150,17 @@ defineProps({
})
const valueTypeOptions = ref({
- controlMouse: { label: 'Move or Scroll the Mouse', component: 'ControlMouseValue' },
- controlGamepad: { label: 'Control a Gamepad Axis', component: 'ControlGamepadValue' },
- controlMidi: { label: 'Control a MIDI Value', component: 'ControlMidiValue' },
- controlOsc: { label: 'Control an OSC Value', component: 'ControlOscValue' },
- controlSerial: { label: 'Control a Value over Serial', component: 'ControlSerialValue' },
- controlProfile: { label: 'Switch Device Profiles', component: 'ControlProfileValue' },
- triggerActions: { label: 'Trigger Actions on Rotation', component: TriggerActionsValue }
+ mouse: { label: 'Move or Scroll the Mouse', component: 'ControlMouseValue' },
+ gamepad: { label: 'Control a Gamepad Axis', component: 'ControlGamepadValue' },
+ midi: { label: 'Control a MIDI CC Value', component: MidiValue },
+ action: { label: 'Trigger Actions on Rotation', component: TriggerActionsValue }
+})
+
+const valueType = computed(() => {
+ if (inputValue.value in valueTypeOptions.value) {
+ return valueTypeOptions.value[inputValue.value]
+ }
+ return null
})
const conditions = ref({
@@ -163,6 +180,6 @@ const comboboxButton = ref(null)
const { width } = useElementSize(comboboxButton)
const open = ref(false)
-const inputValue = ref('')
+const inputValue = ref(props.value.value.type || null)
const confirmDelete = ref(false)
diff --git a/src/renderer/src/components/config/values/ValueGroup.vue b/src/renderer/src/components/config/values/ValueGroup.vue
index aa360ac..e439132 100644
--- a/src/renderer/src/components/config/values/ValueGroup.vue
+++ b/src/renderer/src/components/config/values/ValueGroup.vue
@@ -11,7 +11,11 @@
>
-
+
diff --git a/src/renderer/src/deviceStore.ts b/src/renderer/src/deviceStore.ts
index 3cddb65..667a63b 100644
--- a/src/renderer/src/deviceStore.ts
+++ b/src/renderer/src/deviceStore.ts
@@ -103,6 +103,7 @@ interface UpdateData {
profiles: string[] | undefined
current: string | undefined
profile: Profile | undefined
+ ks: number | undefined
kd: number | undefined
ku: number | undefined
settings: DeviceSettings | undefined
@@ -463,6 +464,13 @@ export const useDeviceStore = defineStore('device', {
addKnobValue(value: Value | null = null, updateDevice: boolean = true) {
if (!value) {
value = JSON.parse(JSON.stringify(this.defaultKnobValue)) as Value
+ let lowestKeyState = 0
+ this.currentProfile!.knob.forEach((v) => {
+ if (v.keyState > lowestKeyState) {
+ lowestKeyState = v.keyState
+ }
+ })
+ value.keyState = (lowestKeyState + 1) % 16
}
this.currentProfile!.knob.push(value)
if (updateDevice) {
@@ -475,6 +483,19 @@ export const useDeviceStore = defineStore('device', {
)
this.setDirtyState(true)
}
+ },
+ removeKnobValue(index: number, updateDevice: boolean = true) {
+ this.currentProfile!.knob.splice(index, 1)
+ if (updateDevice) {
+ sendDebounced(
+ this.currentDeviceId!,
+ JSON.stringify({
+ profile: this.currentProfileName,
+ updates: { knob: this.currentProfile!.knob }
+ })
+ )
+ this.setDirtyState(true)
+ }
}
}
})
@@ -527,7 +548,7 @@ export const initializeDevices = () => {
console.error('Failed to parse update data:', e, dataString)
}
}
- if (!update.idle && !update.p) {
+ if (!update.idle && !update.p && !update.ks) {
console.log('Received update:', update)
}
if (update.p !== undefined) {