Browse Source

added config variable enableVolumeButtons - if set to false Vol+, Vol- and Mute commands will not be sent via USB to PC so that they can be used with a different IR-receiver i.E. to control to an AVR

FloKra 2 years ago
parent
commit
57102a114b
2 changed files with 7 additions and 3 deletions
  1. 4 0
      src/IR-PC-HID-Remote/IR-PC-HID-Remote.ino
  2. 3 3
      src/IR-PC-HID-Remote/sendKeys.ino

+ 4 - 0
src/IR-PC-HID-Remote/IR-PC-HID-Remote.ino

@@ -4,12 +4,16 @@
 #include <IRremote.h>
 #include <HID-Project.h>  // HID-Project 2.8.2
 
+
+
 // switch on/off debug mode at once
 bool isDebugBuild = false;
 
 // enable HID Keyboard output
 bool sendHID = true;
 
+bool enableVolumeButtons = false; // if set to false Vol+, Vol- and Mute commands will not be sent via USB to PC so that they can be used with a different IR-receiver i.E. to control to an AVR
+
 // ATTENTION - set ALL debug and useSerial to false in normal usage
 // as sending over Serial blocks the Arduino Leonardo unless a terminal application is connected!
 bool debug = false;

+ 3 - 3
src/IR-PC-HID-Remote/sendKeys.ino

@@ -357,7 +357,7 @@ void sendKey(uint8_t _key, bool _hold) {
       }
       break;
     case BTN_VOL_DOWN:
-      if (sendHID) Consumer.write(MEDIA_VOLUME_DOWN);
+      if (sendHID && enableVolumeButtons) Consumer.write(MEDIA_VOLUME_DOWN);
       if (useSerial) {
         printKey();
         printMedia();
@@ -365,7 +365,7 @@ void sendKey(uint8_t _key, bool _hold) {
       }
       break;
     case BTN_VOL_UP:
-      if (sendHID) Consumer.write(MEDIA_VOLUME_UP);
+      if (sendHID && enableVolumeButtons) Consumer.write(MEDIA_VOLUME_UP);
       if (useSerial) {
         printKey();
         printMedia();
@@ -373,7 +373,7 @@ void sendKey(uint8_t _key, bool _hold) {
       }
       break;
     case BTN_MUTE:
-      if (sendHID) Consumer.write(MEDIA_VOLUME_MUTE);
+      if (sendHID && enableVolumeButtons) Consumer.write(MEDIA_VOLUME_MUTE);
       if (useSerial) {
         printKey();
         printMedia();