FIX: Nanodevices
+ add key light config
This commit is contained in:
@@ -8,7 +8,10 @@ import { Palette } from 'lucide-vue-next'
|
||||
import ConfigSection from '@renderer/components/common/ConfigSection.vue'
|
||||
import PaletteInput from '@renderer/components/common/PaletteInput.vue'
|
||||
import Color from 'color'
|
||||
import { ref } from 'vue'
|
||||
import { ref, watch } from 'vue'
|
||||
import { useStore } from '@renderer/store'
|
||||
|
||||
const store = useStore()
|
||||
|
||||
const keyColors = ref({
|
||||
default: {
|
||||
@@ -20,4 +23,13 @@ const keyColors = ref({
|
||||
color: Color('#d0078f')
|
||||
}
|
||||
})
|
||||
|
||||
watch(
|
||||
keyColors,
|
||||
(newVal) => {
|
||||
store.setKeyDefaultColor(newVal.default.color)
|
||||
store.setKeyPressedColor(newVal.pressed.color)
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
</script>
|
||||
|
||||
35
src/renderer/src/data/hwProfile.json
Normal file
35
src/renderer/src/data/hwProfile.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"id": 0,
|
||||
"name": "Default Profile",
|
||||
"desc": "",
|
||||
"profileTag": "",
|
||||
"profileType": 0,
|
||||
"profile_type": 0,
|
||||
"position_num": 12,
|
||||
"attract_distance": 20,
|
||||
"feedback_strength": 6,
|
||||
"bounce_strength": 3,
|
||||
"haptic_click_strength": 6,
|
||||
"output_ramp": 10000,
|
||||
"ledEnable": true,
|
||||
"ledBrightness": 100,
|
||||
"ledMode": 0,
|
||||
"pointer": 16777215,
|
||||
"primary": 32768,
|
||||
"secondary": 16753920,
|
||||
"buttonAIdle": 16562691,
|
||||
"buttonBIdle": 16562691,
|
||||
"buttonCIdle": 16562691,
|
||||
"buttonDIdle": 16562691,
|
||||
"buttonAPress": 16516075,
|
||||
"buttonBPress": 16516075,
|
||||
"buttonCPress": 16516075,
|
||||
"buttonDPress": 16516075,
|
||||
"internalMacro": false,
|
||||
"knobMap": "1016001255",
|
||||
"switchA": "1016001255",
|
||||
"switchB": "214567",
|
||||
"switchC": "0",
|
||||
"switchD": "0",
|
||||
"guiEnable": false
|
||||
}
|
||||
@@ -12,6 +12,8 @@ import mockData from '@renderer/data/nanoConfig.json'
|
||||
|
||||
// const ajv = new Ajv() // see below
|
||||
|
||||
const { nanoDevicesAPI } = window
|
||||
|
||||
export const useStore = defineStore('main', {
|
||||
state: () => {
|
||||
return {
|
||||
@@ -202,6 +204,18 @@ export const useStore = defineStore('main', {
|
||||
cycleScreenOrientation() {
|
||||
this.screenOrientation = (this.screenOrientation + 90) % 360
|
||||
},
|
||||
setKeyDefaultColor(color) {
|
||||
// this.selectedProfile.keys[this.selectedKey].default = color
|
||||
const props = {}
|
||||
props[`button${this.selectedKey.toUpperCase()}Idle`] = color.rgbNumber()
|
||||
nanoDevicesAPI.send(this.connectedId, { p: { name: 'Default Profile', ...props } })
|
||||
},
|
||||
setKeyPressedColor(color) {
|
||||
// this.selectedProfile.keys[this.selectedKey].pressed = color
|
||||
const props = {}
|
||||
props[`button${this.selectedKey.toUpperCase()}Press`] = color.rgbNumber()
|
||||
nanoDevicesAPI.send(this.connectedId, { p: { name: 'Default Profile', ...props } })
|
||||
},
|
||||
|
||||
// devices, device attachment, connection, and disconnection
|
||||
init_devices(ids) {
|
||||
@@ -244,7 +258,7 @@ export const useStore = defineStore('main', {
|
||||
this.connectedId = deviceid
|
||||
// TODO load profiles from device
|
||||
// nanoDevicesAPI.send(deviceid, { profiles: "#all" }) // request profiles
|
||||
// "Default Profile", for now, is the only profile after the device
|
||||
// "Default Profile", for now, is the only profile after the device
|
||||
// starts up, so it is also the current (eg. 'selected') profile
|
||||
// nanoDevicesAPI.send(deviceid, { p: "Default Profile" }) // request Default Profile
|
||||
|
||||
|
||||
Reference in New Issue
Block a user