From: Vincent Date: Tue, 13 Apr 2021 19:17:36 +0000 (+0200) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=6734564ce29d4371249e3776949ee9f738b4d7d4;p=tortuga-home.git . --- diff --git a/.idea/workspace.xml b/.idea/workspace.xml index df3c981..864182e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,15 +3,7 @@ - - - - - - - - diff --git a/scripts/lib/denon.php b/scripts/lib/denon.php index 1a01255..fb5dc24 100644 --- a/scripts/lib/denon.php +++ b/scripts/lib/denon.php @@ -30,13 +30,14 @@ function denonAVRVolume($volume, $increase = '') function denonAVROn($input = 'Media Player', $force = false) { + $setvolume = !denonAVRGetPowerState(); if ($force || !denonAVRGetPowerState()) { _denonTelnet('ZMON'); } - denonAVRInput($input); + denonAVRInput($input, $setvolume); } -function denonAVRInput($input) +function denonAVRInput($input, $setvolume = false) { $map = ['Media Player' => 'MPLAY', 'CBL/SAT' => 'SAT/CBL', 'Blu-Ray' => 'BD', 'AUX' => 'AUX1', 'HEOS Music' => 'NET', 'TV Audio' => 'TV']; if (isset($map[$input])) { @@ -45,13 +46,18 @@ function denonAVRInput($input) $cmd = $input; } $cmd = 'SI' . strtoupper($cmd); + $changedInput = false; if (denonAVRGetInput() !== $cmd) { + $changedInput = true; _denonTelnet($cmd); sleep(1); + } + + if ($changedInput || $setvolume) { $volumes = ['Media Player' => 60, 'HEOS Music' => 50, 'CD' => 30, 'AUX' => 26]; if (isset($volumes[$input])) { denonAVRVolume($volumes[$input], ''); - usleep(1000000 * 1); + sleep(1); } }