Implements the OS2L feature (tested with Virtual DJ).
Graphics improvements.

Reviewed-on: #32
This commit was merged in pull request #32.
This commit is contained in:
2025-11-14 10:46:24 +00:00
parent 121a14ac61
commit 932c288a9c
18 changed files with 560 additions and 245 deletions

View File

@@ -120,6 +120,32 @@ function unloadPeripheral (peripheralInfo) {
needProjectSave.set(true)
}
// A peripheral event has been emitted
function onPeripheralEvent(sn, event) {
// If not exists, add it to the map
// eventEmitted key to true for 0.2 sec
peripherals.update((storedPeripherals) => {
return {
...storedPeripherals,
[sn]: {
...storedPeripherals[sn],
eventEmitted: true
},
}})
setTimeout(() => {
peripherals.update((storedPeripherals) => {
return {
...storedPeripherals,
[sn]: {
...storedPeripherals[sn],
eventEmitted: false
},
}})
}, 200);
}
let initialized = false
export function initRuntimeEvents(){
@@ -143,6 +169,9 @@ export function initRuntimeEvents(){
// Handle a peripheral unloaded from the project
EventsOn('UNLOAD_PERIPHERAL', unloadPeripheral)
// Handle a peripheral event
EventsOn('PERIPHERAL_EVENT_EMITTED', onPeripheralEvent)
}
export function destroyRuntimeEvents(){
@@ -166,4 +195,7 @@ export function destroyRuntimeEvents(){
// Handle a peripheral unloaded from the project
EventsOff('UNLOAD_PERIPHERAL')
// Handle a peripheral event
EventsOff('PERIPHERAL_EVENT_EMITTED')
}