From 991b14666b3169bf4f5a7be44c46401e7f7778bf Mon Sep 17 00:00:00 2001 From: Wulf Weich Date: Wed, 25 Nov 2020 11:00:32 +0100 Subject: [PATCH] ensure 2 digits for volumeHex --- lib/Onkyo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Onkyo.js b/lib/Onkyo.js index a6dd564..15bd52a 100644 --- a/lib/Onkyo.js +++ b/lib/Onkyo.js @@ -682,7 +682,7 @@ class Onkyo extends EventEmitter { setVolume(volume) { invariant(_.isInteger(volume), 'volume should be an integer'); invariant(volume >= 0 && volume <= 100, 'volume should be between 0-100'); - const volumeHex = volume.toString(16).toUpperCase(); + const volumeHex = volume.toString(16).toUpperCase().padStart(2, '0'); return this.sendRawCommand(`MVL${volumeHex}`) .then(vol => parseInt(vol, 16)); }