Skip to content

Commit

Permalink
ensure 2 digits for volumeHex (#71) (again)
Browse files Browse the repository at this point in the history
  • Loading branch information
wweich committed Apr 16, 2022
1 parent e813c91 commit 804d547
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 @@ -734,7 +734,7 @@ class Onkyo extends EventEmitter {
setVolume(volume, zone) {
invariant(_.isInteger(volume), 'volume should be an integer');
invariant(volume >= 0, 'volume should be 0 or above');
const volumeHex = volume.toString(16).toUpperCase();
const volumeHex = volume.toString(16).toUpperCase().padStart(2, '0');
const rawCommand = OnkyoCmds.getZoneCommand('MVL', zone) + volumeHex;
return this.pwrOn(zone)
.then(() => this.sendRawCommand(rawCommand)
Expand Down

0 comments on commit 804d547

Please sign in to comment.