UPD: Cleaner console logging
This commit is contained in:
@@ -97,6 +97,7 @@ export interface MidiSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface UpdateData {
|
interface UpdateData {
|
||||||
|
idle: number | undefined
|
||||||
a: number | undefined
|
a: number | undefined
|
||||||
t: number | undefined
|
t: number | undefined
|
||||||
v: number | undefined
|
v: number | undefined
|
||||||
@@ -464,9 +465,10 @@ export const initializeDevices = () => {
|
|||||||
|
|
||||||
// register event handlers
|
// register event handlers
|
||||||
nanoIpc.on((eventid, deviceid, dataString) => {
|
nanoIpc.on((eventid, deviceid, dataString) => {
|
||||||
console.log('Received event', eventid, deviceid, dataString)
|
//console.log('Received event', eventid, deviceid, dataString)
|
||||||
if (eventid === 'error') {
|
if (eventid === 'error') {
|
||||||
messageCallbacks.forEach((callback) => callback('Error', dataString))
|
messageCallbacks.forEach((callback) => callback('Error', dataString))
|
||||||
|
console.error('Error:', dataString)
|
||||||
}
|
}
|
||||||
if (eventid === 'saved') {
|
if (eventid === 'saved') {
|
||||||
deviceStore.setDirtyState(false)
|
deviceStore.setDirtyState(false)
|
||||||
@@ -474,19 +476,23 @@ export const initializeDevices = () => {
|
|||||||
}
|
}
|
||||||
if (eventid === 'device-attached') {
|
if (eventid === 'device-attached') {
|
||||||
deviceStore.attachDevice(deviceid)
|
deviceStore.attachDevice(deviceid)
|
||||||
|
console.log('Attached device', deviceid)
|
||||||
if (deviceStore.attachedDeviceIds.length === 1) {
|
if (deviceStore.attachedDeviceIds.length === 1) {
|
||||||
deviceStore.connectDevice(deviceid)
|
deviceStore.connectDevice(deviceid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (eventid === 'device-detached') {
|
if (eventid === 'device-detached') {
|
||||||
deviceStore.detachDevice(deviceid)
|
deviceStore.detachDevice(deviceid)
|
||||||
|
console.log('Detached device', deviceid)
|
||||||
}
|
}
|
||||||
if (eventid === 'connected') {
|
if (eventid === 'connected') {
|
||||||
deviceStore.connectDevice(deviceid, false)
|
deviceStore.connectDevice(deviceid, false)
|
||||||
|
console.log('Connected device', deviceid)
|
||||||
nanoIpc.send(deviceid, JSON.stringify({ profiles: '#all', settings: '?' }))
|
nanoIpc.send(deviceid, JSON.stringify({ profiles: '#all', settings: '?' }))
|
||||||
}
|
}
|
||||||
if (eventid === 'disconnected') {
|
if (eventid === 'disconnected') {
|
||||||
deviceStore.disconnectDevice(deviceid, false)
|
deviceStore.disconnectDevice(deviceid, false)
|
||||||
|
console.log('Disconnected device', deviceid)
|
||||||
}
|
}
|
||||||
if (eventid === 'update') {
|
if (eventid === 'update') {
|
||||||
let update: UpdateData = {} as UpdateData
|
let update: UpdateData = {} as UpdateData
|
||||||
@@ -497,6 +503,9 @@ 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) {
|
||||||
|
console.log('Received update:', update)
|
||||||
|
}
|
||||||
if (update.a !== undefined) {
|
if (update.a !== undefined) {
|
||||||
deviceStore.setAngle(update.a)
|
deviceStore.setAngle(update.a)
|
||||||
appStore.selectConfigFeature('knob')
|
appStore.selectConfigFeature('knob')
|
||||||
|
|||||||
Reference in New Issue
Block a user