FIX: Receive and show proper value
This commit is contained in:
@@ -144,7 +144,7 @@ app.whenReady().then(() => {
|
|||||||
mainWindow.webContents.send('nanoSerialApi:event', 'disconnected', deviceid, data)
|
mainWindow.webContents.send('nanoSerialApi:event', 'disconnected', deviceid, data)
|
||||||
})
|
})
|
||||||
nanoSerialApi.on('nanoSerialApi:update', (deviceid, data) => {
|
nanoSerialApi.on('nanoSerialApi:update', (deviceid, data) => {
|
||||||
if (!data.startsWith('{"idle"') && !data.startsWith('{"a"'))
|
if (!data.startsWith('{"idle"') && !data.startsWith('{"p"'))
|
||||||
console.log('Update event', deviceid, data)
|
console.log('Update event', deviceid, data)
|
||||||
mainWindow.webContents.send('nanoSerialApi:event', 'update', deviceid, data)
|
mainWindow.webContents.send('nanoSerialApi:event', 'update', deviceid, data)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
<Transition name="fade-delayed">
|
<Transition name="fade-delayed">
|
||||||
<DeviceLEDRing
|
<DeviceLEDRing
|
||||||
v-if="deviceStore.connected"
|
v-if="deviceStore.connected"
|
||||||
:value="barValue"
|
:value="ringValue"
|
||||||
class="absolute inset-x-0 top-[12.5%] mx-auto h-[66%]"
|
class="absolute inset-x-0 top-[12.5%] mx-auto h-[66%]"
|
||||||
/>
|
/>
|
||||||
</Transition>
|
</Transition>
|
||||||
@@ -49,10 +49,9 @@
|
|||||||
>
|
>
|
||||||
<img :src="LogoMidi" alt="midi-logo" class="h-4 opacity-50" />
|
<img :src="LogoMidi" alt="midi-logo" class="h-4 opacity-50" />
|
||||||
<h2 class="font-pixellg text-5xl">
|
<h2 class="font-pixellg text-5xl">
|
||||||
{{ parseInt(barValue + deviceStore.turns * 100) }}
|
{{ deviceStore.position }}
|
||||||
</h2>
|
</h2>
|
||||||
<div class="font-pixelsm text-md">HIGH PASS</div>
|
<div class="font-pixelsm text-md">HIGH PASS</div>
|
||||||
<DeviceBar :value="barValue" :count="30" :width="120" />
|
|
||||||
<span class="font-pixelsm w-36 text-[7pt] uppercase text-muted-foreground">
|
<span class="font-pixelsm w-36 text-[7pt] uppercase text-muted-foreground">
|
||||||
KORG MINILOGUE HIGH PASS FILTER 0-127
|
KORG MINILOGUE HIGH PASS FILTER 0-127
|
||||||
</span>
|
</span>
|
||||||
@@ -111,7 +110,8 @@ import Color from 'color'
|
|||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
const deviceStore = useDeviceStore()
|
const deviceStore = useDeviceStore()
|
||||||
|
|
||||||
const barValue = computed(() => 100 + (deviceStore.angle / Math.PI / 2) * 100)
|
const devicePosition = computed(() => deviceStore.position)
|
||||||
|
const ringValue = computed(() => devicePosition)
|
||||||
|
|
||||||
const previewDeviceImages = {
|
const previewDeviceImages = {
|
||||||
nanoOne: RenderNanoOne,
|
nanoOne: RenderNanoOne,
|
||||||
|
|||||||
@@ -98,10 +98,7 @@ export interface MidiSettings {
|
|||||||
|
|
||||||
interface UpdateData {
|
interface UpdateData {
|
||||||
idle: number | undefined
|
idle: number | undefined
|
||||||
a: number | undefined
|
|
||||||
t: number | undefined
|
|
||||||
p: number | undefined
|
p: number | undefined
|
||||||
v: number | undefined
|
|
||||||
profiles: string[] | undefined
|
profiles: string[] | undefined
|
||||||
current: string | undefined
|
current: string | undefined
|
||||||
profile: Profile | undefined
|
profile: Profile | undefined
|
||||||
@@ -123,8 +120,7 @@ export const useDeviceStore = defineStore('device', {
|
|||||||
currentProfileName: null as string | null, // name of the current profile
|
currentProfileName: null as string | null, // name of the current profile
|
||||||
settings: null as DeviceSettings | null, // settings of the device
|
settings: null as DeviceSettings | null, // settings of the device
|
||||||
dirtyState: false as boolean, // whether the device state has changed
|
dirtyState: false as boolean, // whether the device state has changed
|
||||||
angle: 0 as number, // angle of the knob
|
position: 0 as number, // current position of the knob
|
||||||
turns: 0 as number, // number of turns of the knob
|
|
||||||
velocity: 0 as number, // velocity of the knob
|
velocity: 0 as number, // velocity of the knob
|
||||||
keyLabels: ['a', 'b', 'c', 'd'] as string[], // labels for the keys
|
keyLabels: ['a', 'b', 'c', 'd'] as string[], // labels for the keys
|
||||||
keyStates: {} as Record<string, boolean>, // state of the keys (true if pressed)
|
keyStates: {} as Record<string, boolean>, // state of the keys (true if pressed)
|
||||||
@@ -190,6 +186,7 @@ export const useDeviceStore = defineStore('device', {
|
|||||||
this.currentProfileName = profileName
|
this.currentProfileName = profileName
|
||||||
if (updateDevice) {
|
if (updateDevice) {
|
||||||
nanoIpc.send(this.currentDeviceId!, JSON.stringify({ current: profileName }))
|
nanoIpc.send(this.currentDeviceId!, JSON.stringify({ current: profileName }))
|
||||||
|
this.setDirtyState(true)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
createProfile() {
|
createProfile() {
|
||||||
@@ -341,8 +338,8 @@ export const useDeviceStore = defineStore('device', {
|
|||||||
cycleOrientation() {
|
cycleOrientation() {
|
||||||
this.setOrientation((this.settings!.deviceOrientation + 90) % 360)
|
this.setOrientation((this.settings!.deviceOrientation + 90) % 360)
|
||||||
},
|
},
|
||||||
setAngle(angle: number) {
|
setPosition(position: number) {
|
||||||
this.angle = angle
|
this.position = position
|
||||||
},
|
},
|
||||||
setKeyColor(key: string, pressed: boolean, color: number, updateDevice: boolean = true) {
|
setKeyColor(key: string, pressed: boolean, color: number, updateDevice: boolean = true) {
|
||||||
const propertyName = `button${key.toUpperCase()}${pressed ? 'Press' : 'Idle'}`
|
const propertyName = `button${key.toUpperCase()}${pressed ? 'Press' : 'Idle'}`
|
||||||
@@ -504,11 +501,11 @@ export const initializeDevices = () => {
|
|||||||
console.error('Failed to parse update data:', e, dataString)
|
console.error('Failed to parse update data:', e, dataString)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!update.idle && !update.a) {
|
if (!update.idle && !update.p) {
|
||||||
console.log('Received update:', update)
|
console.log('Received update:', update)
|
||||||
}
|
}
|
||||||
if (update.a !== undefined) {
|
if (update.p !== undefined) {
|
||||||
deviceStore.setAngle(update.a)
|
deviceStore.setPosition(update.p)
|
||||||
appStore.selectConfigFeature('knob')
|
appStore.selectConfigFeature('knob')
|
||||||
}
|
}
|
||||||
if (update.kd !== undefined) {
|
if (update.kd !== undefined) {
|
||||||
|
|||||||
Reference in New Issue
Block a user