Skip to content

Commit

Permalink
ensure 2 digits for volumeHex (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
wweich authored Nov 25, 2020
1 parent 5df1a4c commit 6994ddb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Onkyo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit 6994ddb

Please sign in to comment.