From 6409b1462eb8f80749d6f9c264c32048cbcb8471 Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Wed, 28 Jul 2010 22:16:40 +0000 Subject: [PATCH] All Yamaha IR Codes as Buttons --- powersensordaemon/powerids.txt | 28 ++++++++++++---- powersensordaemon/switch.cgi | 22 +++++++++++-- rf433ctl/rf433ctl.pde | 71 ++++++++++++++++++++++------------------ 3 files changed, 80 insertions(+), 41 deletions(-) diff --git a/powersensordaemon/powerids.txt b/powersensordaemon/powerids.txt index f6ef33c..07bb89e 100644 --- a/powersensordaemon/powerids.txt +++ b/powersensordaemon/powerids.txt @@ -9,10 +9,26 @@ deckevorne h all a1cdefgh decke gh lichter acdfgh +ambientlights acf +ymhpoweroff 0 ymhpower 1 -ymhcd 2 -ymhwdtv 3 -ymhtuner 4 -ymhvolup 555 -ymhvoldown 666 -ymhvolmute 7 +ymhpoweron 01 +ymhcd 5 +ymhwdtv 7 +ymhtuner 6 +ymhvolup 222222222 +ymhvoldown 333333333 +ymhvolmute 4 +ymhmenu 8 +ymhplus + +ymhminus - +ymhtest § +ymhtimelevel $ +ymheffect % +ymhprgup & +ymhprgdown / +ymhtunplus ( +ymhtunabcde ) +ymhtape 9 +ymhvcr ? +ymhextdec = diff --git a/powersensordaemon/switch.cgi b/powersensordaemon/switch.cgi index 749300a..ffa428e 100755 --- a/powersensordaemon/switch.cgi +++ b/powersensordaemon/switch.cgi @@ -16,8 +16,8 @@ for QUERY in `echo $QUERY_STRING | tr '&' ' '`; do done UNIXSOCK=/var/run/powersensordaemon/cmd.sock -VALID_ONOFF_IDS="decke lichter all werkzeug labor dart logo idee deckehinten deckevorne" -VALID_SEND_IDS="stereo ymhvolup ymhvoldown ymhcd ymhwdtv ymhtuner" +VALID_ONOFF_IDS="decke ambientlights lichter all werkzeug labor dart logo idee deckehinten deckevorne" +VALID_SEND_IDS="ymhpoweron ymhpoweroff ymhvolup ymhvoldown ymhcd ymhwdtv ymhtuner ymhvolmute ymhmenu ymhplus ymhminus ymhtest ymhtimelevel ymheffect ymhprgup ymhprgdown ymhtunplus ymhtunabcde ymhtape ymhvcr ymhextdec" [ "$POWER" == "send" ] && POWER=on @@ -39,6 +39,7 @@ fi DESC_werkzeug="Werkzeug LEDs" DESC_stereo="Reciever On/Off" +DESC_ambientlights="Ambient Lichter" DESC_labor="Labor Licht" DESC_dart="Dart Scheibe" DESC_logo="Logo" @@ -48,12 +49,27 @@ DESC_deckevorne="Decke Vorne" DESC_decke="Deckenlichter" DESC_lichter="Alle Lichter" DESC_all="Alles" +DESC_ymhpoweron="Reciever On" +DESC_ymhpoweroff="Reciever Off" DESC_ymhvolup="VolumeUp" DESC_ymhvoldown="VolumeDown" DESC_ymhcd="Input CD" DESC_ymhwdtv="Input WDlxTV" DESC_ymhtuner="Input Tuner" - +DESC_ymhvolmute="Mute" +DESC_ymhmenu="Menu" +DESC_ymhplus="+" +DESC_ymhminus="-" +DESC_ymhtest="Test" +DESC_ymhtimelevel="Time/Levels" +DESC_ymheffect="DSP Effect Toggle" +DESC_ymhprgup="DSP Up" +DESC_ymhprgdown="DSP Down" +DESC_ymhtunplus="Tuner +" +DESC_ymhtunabcde="Tuner ABCDE" +DESC_ymhtape="Tape" +DESC_ymhvcr="VCR" +DESC_ymhextdec="ExtDec Toggle" echo "Content-type: text/html" echo "" echo "" diff --git a/rf433ctl/rf433ctl.pde b/rf433ctl/rf433ctl.pde index a7d187a..b442b96 100644 --- a/rf433ctl/rf433ctl.pde +++ b/rf433ctl/rf433ctl.pde @@ -32,7 +32,7 @@ IRsend irsend; //********************************************************************// // IR Codes, 32 bit, NEC const int YAMAHA_CODE_BITS = 32; -const char YAMAHA_CODE_BASE = 0x000000005EA10000; +const unsigned long int YAMAHA_CODE_BASE = 0x0000000005EA10000; const char YAMAHA_POWER_TOGGLE =0xF8; //Power On/Off const char YAMAHA_POWER_OFF =0x78; //Power Off !!! @@ -44,7 +44,7 @@ const char YAMAHA_TAPE =0x18; //Input Toggle Tape/CD const char YAMAHA_DVD_SPDIF =0xE8; //Input Toggle DVD Auto / DVD Analog const char YAMAHA_SAT_SPDIFF =0x2A; //Input Toggle Sat-DTV Auto / Sat-DTV Analog const char YAMAHA_AUX =0xAA; //Input AUX (mode) -const char YAMAHA_VCR_1 =0xF0; //Input VCR +const char YAMAHA_VCR =0xF0; //Input VCR const char YAMAHA_EXT51DEC =0xE1; //Input Ext. Decoder On/Off const char YAMAHA_TUNER_PLUS =0x08; //Tuner Next Station 1-7 (of A1 - E7) @@ -63,7 +63,7 @@ const char YAMAHA_VOLUME_DOWN =0xD8; const char YAMAHA_PLUS =0x4A; //unteres Steuerkreuz: Taste Rechts (Plus) const char YAMAHA_MINUS =0xCA; //unteres Steuerkreuz: Taste Links (Minus) const char YAMAHA_MENU =0x39; // Menu: Settings -const char YAMAHA_TEST =0xA1 // Test Sounds +const char YAMAHA_TEST =0xA1; // Test Sounds const char YAMAHA_TIME_LEVEL =0x19; //Settings for Delay, Subwfs, Right Surround, Left Surround, Center const char YAMAHA_TIME_LEVEL2 =0x61; //(also) Settings for Delay, Subwfs, Right Surround, Left Surround, Center const char YAMAHA_TIME_LEVEL3 =0x99; //(also) Settings for Delay, Subwfs, Right Surround, Left Surround, Center @@ -80,7 +80,7 @@ const char YAMAHA_EFFECT6 =0x51; //Effect Toggle 70mm General / 70mm Adventure const char YAMAHA_P5 =0xFB; //P5 PRT (1 Main Bypass)? (1587674115) -void send_std_nec_ir_signal(char codebyte) +void send_yamaha_ir_signal(char codebyte) { unsigned long int code = codebyte & 0xFF; code <<= 8; @@ -501,41 +501,48 @@ void loop() sensorEchoCommand(command); printLightLevel(); } + else if (command == '0') + send_yamaha_ir_signal(YAMAHA_POWER_OFF); else if (command == '1') - { - irsend.sendNEC(YAMAHA_POWER,YAMAHA_CODE_BITS); - Serial.println("Ok"); - } + send_yamaha_ir_signal(YAMAHA_POWER_TOGGLE); else if (command == '2') - { - irsend.sendNEC(YAMAHA_CD,YAMAHA_CODE_BITS); - Serial.println("Ok"); - } + send_yamaha_ir_signal(YAMAHA_VOLUME_UP); else if (command == '3') - { - irsend.sendNEC(YAMAHA_DVD_SPDIF,YAMAHA_CODE_BITS); - Serial.println("Ok"); - } + send_yamaha_ir_signal(YAMAHA_VOLUME_DOWN); else if (command == '4') - { - irsend.sendNEC(YAMAHA_TUNER,YAMAHA_CODE_BITS); - Serial.println("Ok"); - } + send_yamaha_ir_signal(YAMAHA_MUTE); else if (command == '5') - { - irsend.sendNEC(YAMAHA_VOLUME_UP,YAMAHA_CODE_BITS); - Serial.println("Ok"); - } + send_yamaha_ir_signal(YAMAHA_CD); else if (command == '6') - { - irsend.sendNEC(YAMAHA_VOLUME_DOWN,YAMAHA_CODE_BITS); - Serial.println("Ok"); - } + send_yamaha_ir_signal(YAMAHA_TUNER); else if (command == '7') - { - irsend.sendNEC(YAMAHA_MUTE,YAMAHA_CODE_BITS); - Serial.println("Ok"); - } + send_yamaha_ir_signal(YAMAHA_DVD_SPDIF); + else if (command == '8') + send_yamaha_ir_signal(YAMAHA_MENU); + else if (command == '+') + send_yamaha_ir_signal(YAMAHA_PLUS); + else if (command == '-') + send_yamaha_ir_signal(YAMAHA_MINUS); + else if (command == '§') + send_yamaha_ir_signal(YAMAHA_TEST); + else if (command == '$') + send_yamaha_ir_signal(YAMAHA_TIME_LEVEL); + else if (command == '%') + send_yamaha_ir_signal(YAMAHA_EFFECT_TOGGLE); + else if (command == '&') + send_yamaha_ir_signal(YAMAHA_PRG_DOWN); + else if (command == '/') + send_yamaha_ir_signal(YAMAHA_PRG_UP); + else if (command == '(') + send_yamaha_ir_signal(YAMAHA_TUNER_PLUS); + else if (command == ')') + send_yamaha_ir_signal(YAMAHA_TUNER_ABCDE); + else if (command == '9') + send_yamaha_ir_signal(YAMAHA_TAPE); + else if (command == '?') + send_yamaha_ir_signal(YAMAHA_VCR); + else if (command == '=') + send_yamaha_ir_signal(YAMAHA_EXT51DEC); else Serial.println("Error: unknown command"); } -- 1.7.10.4