Difference between revisions of "Onkyo TXSR805"

From LinuxMCE
Jump to: navigation, search
m (Added category: GSD)
 
(15 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 +
[[Category: Hardware]]
 +
[[Category:Amps_Receivers]]
 +
[[category: Audio]]
 +
[[Category: GSD]]
 +
{{versioninfo}}
 +
{{stub}}
 +
[[category: Tutorials]]
 
== Using the Onkyo TX-SR805 with RS232 Control ==
 
== Using the Onkyo TX-SR805 with RS232 Control ==
  
Needs a lot of editing...
+
'''THIS CODE IS STILL BEING DEVELOPED'''
 +
 
 +
Future home of the howto for setting up a Onkyo TX-SR805 with RS232 support.
 +
<br>
 +
May widen howto to all Onkyo RS232 Receivers.
 +
<br><br>
 +
 
 +
This device does currently work with limited functionality.  A writeup for how to add this device to a Linux MCE system will be done soon.<br>
 +
<br>
 +
** If you use this device and have any problems or suggestions to the code here, please switch over to the discussion tab and bring it to my attention **<br>
 +
 
 +
----
 +
<br>
 +
Current features supported:<br>
 +
-On/Off<br>
 +
-Change inputs<br>
 +
-Volume control (Up/Down in set increments. cmd_313 Set Volume still needs work)<br>
 +
<br>
 +
Being worked on:<br>
 +
-Precise Volume Control (cmd_313)<br>
 +
-Listening Modes<br>
 +
-Zone 2/3<br>
 +
-FM Tuner<br>
 +
<br>
 +
----
 +
'''Ruby Code:'''
  
 
Section: 193 Off<br>
 
Section: 193 Off<br>
<code>
+
<$"!1PWR00\r"$>
<$"!1PWR00\r"$>
+
 
</code>
+
  
 
Section: 192 On<br>
 
Section: 192 On<br>
<code>
+
<$"!1PWR01\r"$>
<$"!1PWR01\r"$><br>
+
sleep(2)
sleep(2)<br>
+
<$"!AMT00\r"$>
<$"!AMT00\r"$><br>
+
@mute = false
@mute = false<br>
+
 
</code>
+
  
 
Section: 169 AM<br>
 
Section: 169 AM<br>
<code>
+
<$"!1SLI25\r"$>
<$"!1SLI25\r"$><br>
+
 
</code>
+
 
 +
Section: 164 Aux<br>
 +
<$"!1SLI03\r"$>
 +
 
 +
 
 +
Section: 172 Aux 2<br>
 +
<$"!1SLI04\r"$>
 +
 
 +
 
 +
Section: 162 CD<br>
 +
<$"!1SLI23\r"$>
 +
 
 +
 
 +
Section: 165 DVD<br>
 +
<$"!1SLI10\r"$>
 +
 
 +
 
 +
Section: 170 FM<br>
 +
<$"!1SLI24\r"$>
 +
 
 +
 
 +
Section: 163 Phono<br>
 +
<$"!1SLI22\r"$>
 +
 
 +
 
 +
Section: 160 Tape / Tape 1<br>
 +
<$"!1SLI20\r"$>
 +
 
 +
 
 +
Section: 173 Tape 2<br>
 +
<$"!1SLI21\r"$>
 +
 
 +
 
 +
Section: 166 Tuner<br>
 +
<$"!1SLI26\r"$>
 +
 
 +
 
 +
Section: 909 XM<br>
 +
<$"!1SLI31\r"$>
 +
 
 +
 
 +
Section: 373 Private Method Listing<br>
 +
# Written by Jason Bennett
 +
#
 +
# Process 373 - Methods
 +
def receiveMsg
 +
  buff = conn_.Recv(7, 1000)
 +
  log("Message Received: #{buff}")
 +
  trash = conn_.Recv(1, 100)
 +
  if buff.length() < 7
 +
    parsed1 = "ERR"
 +
    parsed2 = "00"
 +
  else
 +
    parsed2 = buff[5..6]
 +
    parsed1 = buff[2..4]
 +
    return [parsed1, parsed2]
 +
  end
 +
end
 +
#-------------------------------------------- Parsing -----------------------------------------------------------------------------------
 +
def chkMsg(cat, opt)
 +
    case cat
 +
      # Power
 +
      when "PWR"
 +
          cmd = Command.new(device_.devid_, -1001, 1, 2, 48)  # 48 = Power State
 +
          case opt
 +
            when "01"
 +
              cmd.params_[10] = "1"  # Command 48, Param 10: 1 = On
 +
            when "00"
 +
              cmd.params_[10] = "0"  # Command 48, Param 10: 2 = Off
 +
          end
 +
          SendCommand(cmd)
 +
      # Master Volume Level
 +
      when "MVL"
 +
        cmd = Command.new(device_.devid_, -1001, 1, 2, 71)  # 71 = Volume
 +
        cmd.params_[30] = opt.hex.to_s # Command 71, Param 16 = Volume Level in Decimal
 +
        log("volume reported as: #{opt.hex}")
 +
        SendCommand(cmd)
 +
      # Input Selection
 +
      when "SLI"
 +
        cmd = Command.new(device_.devid_, -1001, 1, 2, 49)    # 49 = Input Selection
 +
        case opt
 +
          when "00"
 +
            input_param = 316
 +
          when "01"
 +
            input_param = 317
 +
          when "02"
 +
            input_param = 318
 +
          when "03"
 +
            input_param = 164
 +
          when "04"
 +
            input_param = 172
 +
          when "10"
 +
            input_param = 165
 +
          when "20"
 +
            input_param = 160
 +
          when "22"
 +
            input_param = 163
 +
          when "23"
 +
            input_param = 162
 +
          when "24"
 +
            input_param = 170
 +
          when "25"
 +
            input_param = 169
 +
          when "26"
 +
            input_param = 166
 +
          when "31"
 +
            input_param = 909
 +
        end
 +
        cmd.params_[41] = input_param.to_s  # Command 49, Param 41 = Input
 +
        SendCommand(cmd)
 +
    end
 +
end
 +
#-------------------------------------------- Logging -----------------------------------------------------------------------------------
 +
def log(line)
 +
  $log = File.open("/var/log/pluto/#{device_.devid_}_Generic_Serial_Device.log", "a")
 +
  $log.puts "(***):#{line}"
 +
  $log.close
 +
end
 +
 
 +
 
 +
Section: 350 Process Incoming Data<br>
 +
# Written by Jason Bennett
 +
#
 +
# Process 350 - Incoming
 +
incMsg = receiveMsg()
 +
log("New Msg: #{incMsg[0]}:#{incMsg[1]}")
 +
chkMsg(incMsg[0], incMsg[1])
 +
 
 +
 
 +
Section: 355 Process Initialize<br>
 +
#31-May-06 14:13 init  Onkyo Receiver
 +
initok=false
 +
for iRetry in 0...4
 +
    print "Initializing unit\n"
 +
      conn_.Send("!1PWRQSTN\r")
 +
    buf = conn_.Recv(200, 1000)
 +
    if !buf.nil? && buf.include?("PWR0")
 +
        print "Initialized ok\n"
 +
                initok=true
 +
                break
 +
        else
 +
                print "Didn't respond to command\n"
 +
        end
 +
end
 +
if initok==false
 +
        DisableDevice( device_.devid_, true )
 +
        print "The device wouldn't respond. Disabling it.\n"
 +
        return
 +
end
 +
print "Initialized ok, doing log\n"
 +
 
 +
 
 +
Section: 97 Mute<br>
 +
if(@mute)
 +
  <$"!1AMT00\r"$>
 +
else
 +
  <$"!1AMT01\r"$>
 +
end
 +
@mute=!@mute
 +
 
 +
 
 +
Section: 313 Set Volume<br>
 +
slevel = "%x" % level.to_i
 +
<$"!1MVL" + slevel + "\r"$>
 +
SetDeviceDataInDB( device_.devid_, 158, level ) # 158 = DEVICEDATA_Volume_Level_CONST
 +
print "volume and corresponding device data set\n"
 +
 
 +
 
 +
Section: 90 Vol Down<br>
 +
<$"!1MVLDOWN\r"$>
 +
 
 +
 
 +
Section: 89 Vol Up<br>
 +
<$"!1MVLUP\r"$>

Latest revision as of 14:54, 7 July 2016

Version Status Date Updated Updated By
710 Unknown N/A N/A
810 Unknown N/A N/A
1004 Unknown N/A N/A
1204 Unknown N/A N/A
1404 Unknown N/A N/A
Usage Information
This article is a stub and requires expansion

Using the Onkyo TX-SR805 with RS232 Control

THIS CODE IS STILL BEING DEVELOPED

Future home of the howto for setting up a Onkyo TX-SR805 with RS232 support.
May widen howto to all Onkyo RS232 Receivers.

This device does currently work with limited functionality. A writeup for how to add this device to a Linux MCE system will be done soon.

    • If you use this device and have any problems or suggestions to the code here, please switch over to the discussion tab and bring it to my attention **


Current features supported:
-On/Off
-Change inputs
-Volume control (Up/Down in set increments. cmd_313 Set Volume still needs work)

Being worked on:
-Precise Volume Control (cmd_313)
-Listening Modes
-Zone 2/3
-FM Tuner


Ruby Code:

Section: 193 Off

<$"!1PWR00\r"$>


Section: 192 On

<$"!1PWR01\r"$>
sleep(2)
<$"!AMT00\r"$>
@mute = false


Section: 169 AM

<$"!1SLI25\r"$>


Section: 164 Aux

<$"!1SLI03\r"$>


Section: 172 Aux 2

<$"!1SLI04\r"$>


Section: 162 CD

<$"!1SLI23\r"$>


Section: 165 DVD

<$"!1SLI10\r"$>


Section: 170 FM

<$"!1SLI24\r"$>


Section: 163 Phono

<$"!1SLI22\r"$>


Section: 160 Tape / Tape 1

<$"!1SLI20\r"$>


Section: 173 Tape 2

<$"!1SLI21\r"$>


Section: 166 Tuner

<$"!1SLI26\r"$>


Section: 909 XM

<$"!1SLI31\r"$>


Section: 373 Private Method Listing

# Written by Jason Bennett
#
# Process 373 - Methods
def receiveMsg
 buff = conn_.Recv(7, 1000) 
 log("Message Received: #{buff}")
 trash = conn_.Recv(1, 100)
 if buff.length() < 7
   parsed1 = "ERR"
   parsed2 = "00"
 else
   parsed2 = buff[5..6]
   parsed1 = buff[2..4]
   return [parsed1, parsed2]
 end
end
#-------------------------------------------- Parsing -----------------------------------------------------------------------------------
def chkMsg(cat, opt)
   case cat
     # Power
     when "PWR"
         cmd = Command.new(device_.devid_, -1001, 1, 2, 48)  # 48 = Power State
         case opt
           when "01"
             cmd.params_[10] = "1"   # Command 48, Param 10: 1 = On
           when "00"
             cmd.params_[10] = "0"   # Command 48, Param 10: 2 = Off
         end
         SendCommand(cmd)
     # Master Volume Level
     when "MVL"
       cmd = Command.new(device_.devid_, -1001, 1, 2, 71)   # 71 = Volume
       cmd.params_[30] = opt.hex.to_s # Command 71, Param 16 = Volume Level in Decimal
       log("volume reported as: #{opt.hex}")
       SendCommand(cmd)
     # Input Selection
     when "SLI"
       cmd = Command.new(device_.devid_, -1001, 1, 2, 49)    # 49 = Input Selection
       case opt
         when "00"
           input_param = 316
         when "01"
           input_param = 317
         when "02"
           input_param = 318
         when "03"
           input_param = 164
         when "04"
           input_param = 172
         when "10"
           input_param = 165
         when "20"
           input_param = 160
         when "22"
           input_param = 163
         when "23"
           input_param = 162
         when "24"
           input_param = 170
         when "25"
           input_param = 169
         when "26"
           input_param = 166
         when "31"
           input_param = 909
       end
       cmd.params_[41] = input_param.to_s  # Command 49, Param 41 = Input
       SendCommand(cmd)
   end
end
#-------------------------------------------- Logging -----------------------------------------------------------------------------------
def log(line)
 $log = File.open("/var/log/pluto/#{device_.devid_}_Generic_Serial_Device.log", "a")
 $log.puts "(***):#{line}"
 $log.close
end


Section: 350 Process Incoming Data

# Written by Jason Bennett
#
# Process 350 - Incoming
incMsg = receiveMsg()
log("New Msg: #{incMsg[0]}:#{incMsg[1]}")
chkMsg(incMsg[0], incMsg[1])


Section: 355 Process Initialize

#31-May-06 14:13 init  Onkyo Receiver
initok=false
for iRetry in 0...4
   print "Initializing unit\n"
     conn_.Send("!1PWRQSTN\r")
   buf = conn_.Recv(200, 1000)
   if !buf.nil? && buf.include?("PWR0")
       print "Initialized ok\n"
               initok=true
               break
       else
               print "Didn't respond to command\n"
       end
end
if initok==false
       DisableDevice( device_.devid_, true )
       print "The device wouldn't respond. Disabling it.\n"
       return
end
print "Initialized ok, doing log\n"


Section: 97 Mute

if(@mute)
 <$"!1AMT00\r"$>
else
 <$"!1AMT01\r"$>
end
@mute=!@mute


Section: 313 Set Volume

slevel = "%x" % level.to_i
<$"!1MVL" + slevel + "\r"$>
SetDeviceDataInDB( device_.devid_, 158, level ) # 158 = DEVICEDATA_Volume_Level_CONST
print "volume and corresponding device data set\n"


Section: 90 Vol Down

<$"!1MVLDOWN\r"$>


Section: 89 Vol Up

<$"!1MVLUP\r"$>