diff --git a/feedbacks.js b/feedbacks.js index 2586a35dc0085aa18ad0b6eeaf418f2b08df50a3..d59a6ecd7c566780b65f7ae9bf7742ac9457f5a9 100644 --- a/feedbacks.js +++ b/feedbacks.js @@ -2,7 +2,7 @@ const {combineRgb} = require('@companion-module/base') module.exports = async function (self) { self.setFeedbackDefinitions({ - PadStatus: { + pad_status: { name: 'Pad Status', type: 'advanced', options: [ @@ -64,7 +64,7 @@ module.exports = async function (self) { } }, }, - PageActive: { + page_active: { name: 'Page Active', type: 'boolean', defaultStyle: { diff --git a/main.js b/main.js index dc91ec8760178e323d01472300235b0b88cc35a8..6d656018e1b58f5231864d77dd73c64debad6c2c 100644 --- a/main.js +++ b/main.js @@ -1,4 +1,4 @@ -const {InstanceBase, Regex, runEntrypoint, InstanceStatus} = require('@companion-module/base') +const {InstanceBase, Regex, runEntrypoint, InstanceStatus, combineRgb} = require('@companion-module/base') const UpgradeScripts = require('./upgrades') const UpdateActions = require('./actions') const UpdateFeedbacks = require('./feedbacks') @@ -9,6 +9,7 @@ const PadNameUpdate = require("./receive/pad_name_update"); const PadStatusUpdate = require("./receive/pad_status_update"); const CurrentPageUpdate = require("./receive/current_page_update"); const uuid = require('uuid'); +const presets = require('./presets'); class ModuleInstance extends InstanceBase { isInitialized = false @@ -36,6 +37,8 @@ class ModuleInstance extends InstanceBase { this.updateActions() await this.updateFeedbacks() + + this.setPresetDefinitions(presets()); } // When module gets deleted @@ -201,7 +204,7 @@ class ModuleInstance extends InstanceBase { for (let i in pads) { let pad = pads[i]; this.log('debug', `Update variable 'pad-${pad.position}'`); - this.setVariableValues({ [`pad-${pad.position}`]: pad.name}); + this.setVariableValues({[`pad-${pad.position}`]: pad.name}); } } } diff --git a/presets.js b/presets.js new file mode 100644 index 0000000000000000000000000000000000000000..683eb9678dec7c559657e468ce1510476c75aeeb --- /dev/null +++ b/presets.js @@ -0,0 +1,132 @@ +const {combineRgb} = require("@companion-module/base"); +module.exports = function () { + let presets = {}; + + // Pad Playback + for (let i = 0; i < 100; i++) { + presets[`pad-playback-${i}`] = { + category: 'Pad Playback', + name: `pad-playback-${i}`, + type: 'button', + previewStyle: { + text: `Pad ${i + 1}`, + size: '24', + color: combineRgb(255, 255, 255), + bgcolor: combineRgb(0, 0, 0), + }, + style: { + text: `$(PlayWall:pad-${i})`, + size: '24', + color: combineRgb(255, 255, 255), + bgcolor: combineRgb(0, 0, 0), + }, + steps: [ + { + down: [ + { + actionId: 'pad_playback_action', + options: { + 'type': 'NUMBER', + 'index': i + 1 + } + } + ] + } + ], + feedbacks: [ + { + feedbackId: 'pad_status', + options: { + 'type': 'NUMBER', + 'index': i + 1 + } + } + ] + }; + } + + // Pages + for (let i = 0; i < 20; i++) { + presets[`page-set-${i}`] = { + category: 'Pad Set', + name: `page-set-${i}`, + type: 'button', + style: { + text: `Seite ${i + 1}`, + size: '24', + color: combineRgb(255, 255, 255), + bgcolor: combineRgb(0, 0, 0), + }, + steps: [ + { + down: [ + { + actionId: 'page_set_action', + options: { + 'number': i + 1 + } + } + ] + } + ], + feedbacks: [ + { + feedbackId: 'page_active', + options: { + 'number': i + 1 + } + } + ] + }; + } + + presets['pad-navigate-previous'] = { + category: 'Pad Navigate', + name: 'pad-navigate-previous', + type: 'button', + style: { + text: 'Zurück', + size: '24', + color: combineRgb(255, 255, 255), + bgcolor: combineRgb(0, 0, 0), + }, + steps: [ + { + down: [ + { + actionId: 'pad_navigate_action', + options: { + 'type': 'PREVIOUS' + } + } + ] + } + ] + }; + presets['pad-navigate-next'] = { + category: 'Pad Navigate', + name: 'pad-navigate-next', + type: 'button', + style: { + text: 'Vor', + size: '24', + color: combineRgb(255, 255, 255), + bgcolor: combineRgb(0, 0, 0), + }, + steps: [ + { + down: [ + { + actionId: 'pad_navigate_action', + options: { + 'type': 'NEXT' + } + } + ] + } + ] + } + + + return presets; +}; \ No newline at end of file