2011年6月12日日曜日

REGZA RD-BZ800のリモコンをVIZIO(TV)で使えるようにする(構想)

REGZA RD-BZ800のリモコンをVIZIO(TV)で使えるようにする。
普段はSONYの学習リモコンを使ってるのですが、これが妻に評判が悪い。
 

REGZAのリモコンを学習するにはボタン数が少ない。
シフト機能も使えるけどボタンの刻印が無いから、よく使わないボタン機能を忘れてしまう。
RD-BZ800のリモコンには
  • テレビコントロールのプリセット値にVIZIOの項目が無い
  • 機能別の独立したボタンが多すぎ
  • シンプルリモコンがシンプルすぎ
 

左上の青色文字部分がテレビコントロール部分
IRremoteのサンプルプログラムIRrecvDumpをちょいと手直ししてリモコンコード変換機にしてます。
機能 VIZIO TV SONY TV REGZA TV
電源 8F7010EF A90(12bits) 2FD48b7
Vol Up 8F7040BF 490 2FD58A7
Vol Down 8F70C03F C90 2FD7887
Ch Up 8F7000FF 90 2FDD821
Ch Down 8F70807F 890 2FDF807
入力切り替え 8F70639C(HDMI) A50 2FDF00F
地上波アナログ 8F7004FB 3AE9(15bits) 2FDDE21
地上波デジタル 8F70847B 26E9 2FD5EA1
BS110 8F7020DF 1AE9 2FD3EC1
CS110 8F70A05F 6AE9 2FDBE41

VIZIOのリモコン受光部はここ
 


初代HDDレコーダーClipOnのアルミヘアライン仕上げのB&O風デザインリモコン。
このGUIがしっかりしてればこれだけのボタン数でかなりのこと出来るんだけどね...
アナログ放送が停波したら別用途に利用予定。
IRRemoteライブラリをちょっと修正
  • sendNECを実行すると受信機能が破壊される
  • sendNECにリピート送信を追加
コンパイルサイズは
Binary sketch size: 8816 bytes (of a 32256 byte maximum)
 /*
 * IRremote: IRrecvDump - dump details of IR codes with IRrecv
 * An IR detector/demodulator must be connected to the input RECV_PIN.
 * Version 0.1 July, 2009
 * Copyright 2009 Ken Shirriff
 * http://arcfn.com
 */
/*
 * IRremote: IRrecvDump - dump details of IR codes with IRrecv
 * An IR detector/demodulator must be connected to the input RECV_PIN.
 * Version 0.1 July, 2009
 * Copyright 2009 Ken Shirriff
 * http://arcfn.com
 */
/*
  Masahiko KANETAKA
  kane4d@gmail.com
  http://kane4d.blogspot.com/
 
  Port MAP
  D0   I  RX
  D1   O  TX
  D2
  D3   O  IR LED Drive
  D4
  D5
  D6
  D7   I  IR Receiver module(PL-IRM1261)
  D8
  D9
  D10
  D11
  D12
  D13  O  LED
*/
//#define DEBUG 1
//#define CORE_LED0_PIN 13
#define MAKER_CODE 0x8F700000
#define REMOTE_CMD(x) ( MAKER_CODE | x )
#include <IRremote.h>
int RECV_PIN = 7;
IRrecv irrecv(RECV_PIN);
IRsend irsend;
decode_results results;
void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  irrecv.blink13(true);
}
// based on Print::printNumber
void printHex64(unsigned long long n)
{
  unsigned char buf[sizeof(unsigned long long) * 2];
  unsigned long i = 0;
  if (n == 0) {
    Serial.print('0');
    return;
  }
  while (n > 0) {
    buf[i++] = n & 0xf;
    n >>= 4;
  }
  for (; i > 0; i--) {
    Serial.print((char) (buf[i - 1] < 10 ?
      '0' + buf[i - 1] :
      'A' + buf[i - 1] - 10));
  }
}
// Dumps out the decode_results structure.
// Call this after IRrecv::decode()
// void * to work around compiler issue
//void dump(void *v) {
//  decode_results *results = (decode_results *)v
void dump(decode_results *results) {
  int count = results->rawlen;
  if (results->decode_type == UNKNOWN) {
    Serial.print("Unknown encoding: ");
  }
  else if (results->decode_type == NEC) {
    Serial.print("Decoded NEC: ");
    irsend.sendNEC(results->decode_type, 32);
    if (results->value == REPEAT){
      //repeat code
      irsend.sendNEC(REPEAT, 32);
    }else if ((results->value & 0xFFFF0000) == MAKER_CODE){
      irsend.sendNEC(results->decode_type, 32);
    }
  }
  else if (results->decode_type == SONY) {
    Serial.print("Decoded SONY: ");
    switch(results->value){
      case (0xA90):
        Serial.print("Power ");
        irsend.sendNEC(REMOTE_CMD(0x10EF), 32);
        break;
      case (0x490):
        Serial.print("Vol.Up ");
        irsend.sendNEC(REMOTE_CMD(0x40BF), 32);
        break;
      case (0xC90):
        Serial.print("Vol.Down ");
        irsend.sendNEC(REMOTE_CMD(0xC03F), 32);
        break;
      case (0x90):
        Serial.print("CH.Up ");
        irsend.sendNEC(REMOTE_CMD(0x00FF), 32);
        break;
      case (0x890):
        Serial.print("CH.Down ");
        irsend.sendNEC(REMOTE_CMD(0x807F), 32);
        break;
      case (0xA50):
        Serial.print("InputSel ");
        irsend.sendNEC(REMOTE_CMD(0x639C), 32);
        break;
      case (0x3AE9):
        Serial.print("ChiAna ");
        irsend.sendNEC(REMOTE_CMD(0xD42B), 32);
        break;
      case (0x26E9):
        Serial.print("ChiDigi ");
        irsend.sendNEC(REMOTE_CMD(0x847B), 32);
        break;
      case (0x1AE9):
        Serial.print("BS110 ");
        irsend.sendNEC(REMOTE_CMD(0x20DF), 32);
        break;
      case (0x6AE9):
        Serial.print("CS110 ");
        irsend.sendNEC(REMOTE_CMD(0xA05F), 32);
        break;
    }

  }
  else if (results->decode_type == RC5) {
    Serial.print("Decoded RC5: ");
  }
  else if (results->decode_type == RC6) {
    Serial.print("Decoded RC6: ");
  }
  printHex64(results->value);
  Serial.print(" (");
  Serial.print(results->bits, DEC);
  Serial.println(" bits)");
  Serial.print("Raw (");
  Serial.print(count, DEC);
  Serial.print("): ");
  for (int i = 0; i < count; i++) {
    if ((i % 2) == 1) {
      Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
    }
    else {
      Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC);
    }
    Serial.print(" ");
  }
  Serial.println("");
}
void loop() { 
  if (irrecv.decode(&results)) {
    dump(&results);
    irrecv.resume(); // Receive the next value
  }
}

0 件のコメント:

コメントを投稿