From ce2d493216141a9f51af79347cab30dc0ff13d2d Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Wed, 4 Jan 2023 08:53:11 -0600 Subject: [PATCH] move channel to class --- plugins/shure/channel.js | 14 ++++++++++++++ plugins/shure/main.js | 21 +++++---------------- 2 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 plugins/shure/channel.js diff --git a/plugins/shure/channel.js b/plugins/shure/channel.js new file mode 100644 index 0000000..dbdaf05 --- /dev/null +++ b/plugins/shure/channel.js @@ -0,0 +1,14 @@ +class Channel { + constructor() { + this.chan_name = '?'; + this.batt_bars = 255; + this.batt_run_time = 65535; + this.audio_gain = 0; + this.audio_lvl = 0; + this.rx_rf_lvl = 0; + this.rf_antenna = 0; + this.tx_type = 0; + } +} + +module.exports = Channel; diff --git a/plugins/shure/main.js b/plugins/shure/main.js index da84e6b..047411c 100644 --- a/plugins/shure/main.js +++ b/plugins/shure/main.js @@ -1,4 +1,4 @@ -const _ = require('lodash'); +const Channel = require('./channel'); exports.config = { defaultName: 'Shure Wireless', @@ -17,26 +17,15 @@ exports.config = { }, }; -const blankChannel = { - chan_name: '?', - batt_bars: 255, - batt_run_time: 65535, - audio_gain: 0, - audio_lvl: 0, - rx_rf_lvl: 0, - rf_antenna: 0, - tx_type: 0, -}; - exports.ready = function ready(_device) { const device = _device; device.data.channelCount = 0; device.data.channels = [ {}, - _.clone(blankChannel), - _.clone(blankChannel), - _.clone(blankChannel), - _.clone(blankChannel), + new Channel(), + new Channel(), + new Channel(), + new Channel(), ]; };