From f7cecf70ea17e6adb77b2c6bd09c4af6c0cb87f0 Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Fri, 13 Sep 2019 16:55:35 +0200 Subject: [PATCH] Minor readme and examples cleanup --- README.md | 8 +++++--- test/activate.js | 2 -- test/control-decoder.js | 5 +++-- test/hdmi-switch.js | 3 +-- test/power.js | 1 - test/remote.js | 1 - test/shared/init.js | 1 + 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index f3e518e..521b74e 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,9 @@ cecCtl.on('error', console.error); language: 'eng', turnOn: [Function: bound changePower], // Turn on dev0 (TV) turnOff: [Function: bound changePower], // Turn off dev0 (TV) - changeSource: [Function] }, // Switch HDMI input (optional arg is port number) + changeSource: [Function], // Switch HDMI input (optional arg is port number) + sendKey: [Function] // Send key press to this device + }, dev4: { name: 'Playback 1', logicalAddress: '4', @@ -51,7 +53,7 @@ cecCtl.on('error', console.error); volumeUp: [Function: bound command], // Increase amplifier volume volumeDown: [Function: bound command], // Decrease amplifier volume mute: [Function: bound command], // Mute amplifier - getKeyNames: [Function: bound getNamesArray] // Returns array of supported keys (for use with sendKey()) + getKeyNames: [Function: bound getNamesArray], // Returns array of supported keys (for use with sendKey()) command: [Function: command] // Send custom signal (arg is send as input to cec-client) } */ @@ -135,7 +137,7 @@ controlTv(); increaseVolume(3); // Increase volume 3 times ``` -Additional pre-made scripts can be found inside "test" folder. +Additional pre-made runnable scripts can be found inside "test" folder. ## Donation If you like my work please support it by buying me a cup of coffee :-) diff --git a/test/activate.js b/test/activate.js index c971e6d..786ac8a 100644 --- a/test/activate.js +++ b/test/activate.js @@ -3,12 +3,10 @@ */ const cecInit = require('./shared/init'); -const writeLine = require('./shared/writeLine'); cecInit().then(test); function test(obj) { - writeLine(''); console.log('--- TV Active Source Changed ---\n'); console.log('CURRENT STATUS'); console.log(obj.controller); diff --git a/test/control-decoder.js b/test/control-decoder.js index ba90545..8228826 100644 --- a/test/control-decoder.js +++ b/test/control-decoder.js @@ -1,5 +1,6 @@ /* - Use arrow keys from your PC as arrows buttons to control TV. + Use arrow keys from your PC as arrows buttons to control decoder. + Select with "Spacebar". Close app with Ctrl+c. */ const cecInit = require('./shared/init'); @@ -12,7 +13,7 @@ var enabled = true; function test(obj) { - console.log('--- Control dev1 with keyboard arrow keys, select with "Spacebar" ---\n'); + console.log('--- Control dev1 with keyboard arrow keys, select with "Spacebar" ---'); process.stdin.on('data', async(key) => { diff --git a/test/hdmi-switch.js b/test/hdmi-switch.js index 799265f..2f447a0 100644 --- a/test/hdmi-switch.js +++ b/test/hdmi-switch.js @@ -1,6 +1,6 @@ /* Toggles between 3 available HDMI ports. - Port number can be set with 'hdmiPorts' option when creating new cec-controller object. + Number of HDMI ports can be set with 'hdmiPorts' option when creating new cec-controller object. Desired port number can also be passed to 'changeSource()' function (e.g. ctl.dev0.changeSource(2) should switch to input 2). */ @@ -13,7 +13,6 @@ function test(obj) { var ctl = obj.controller; - writeLine(''); console.log('--- TV HDMI Switch Test ---'); writeLine(`Switching port every 5 sec...`); diff --git a/test/power.js b/test/power.js index f3b95da..9a093a6 100644 --- a/test/power.js +++ b/test/power.js @@ -10,7 +10,6 @@ function test(obj) { var ctl = obj.controller; - writeLine(''); console.log('--- TV Power Test ---'); writeLine('Turning OFF in 30 sec...'); setTimeout(() => powerOff(ctl), 30000); diff --git a/test/remote.js b/test/remote.js index 670cda1..0010657 100644 --- a/test/remote.js +++ b/test/remote.js @@ -11,7 +11,6 @@ function test(obj) { var cec = obj.cec; - writeLine(''); console.log('--- TV Remote Test ---'); writeLine('Press any button on TV remote'); diff --git a/test/shared/init.js b/test/shared/init.js index 1dcf8f9..c7b6972 100644 --- a/test/shared/init.js +++ b/test/shared/init.js @@ -20,6 +20,7 @@ module.exports = () => writeLine('Setting this device as active source...'); await controller.setActive(); + writeLine(''); resolve({ controller, cec }); });