Difference between revisions of "Marantz SR5600"

From LinuxMCE
Jump to: navigation, search
Line 357: Line 357:
 
   
 
   
  
 
+
== Discussion on how to properly implement template for such device ? ==
  
 
(to be expanded)
 
(to be expanded)

Revision as of 12:14, 11 March 2008


More info about device  :

This is Marantz's cheapest model that has rs232c connector and surprisingly, it has two way communication capability - that means that when user does something on receiver's button or IR remote control, you get status messages about changes...

There are few different documents about RS232 protocol on this device. This one worked on mine, luckily is ASCII based and therefore much more user friendly...

First I've closely examined existing templates for Yamaha receiver, RS232 Plasma and tried to learn things. Since there is currently no special screen prepared for control of Audio/Tuner receiver device, I decided to use 'TV - LiveTV' device with template #1751, that already has associated media screen for tuner control (it's meant for TV tuner control, but is close enough for a start)...

 LinuxMCE Dan: Can you please add new media screen for such type of devices (http://plutohome.com/support/mantis/view.php?id=3151) and maybe even document procedure on Wiki. 
It would ease similar  contributions from other users...
 

Adding new template

Specify device data and parameters

Description : SR5600
Implements DCE : yes
Command line : Generic_Serial_Device
Device Category  AV/preamps/... #103
Manufacturer Marantz

Also have added following parameters :

Device data
Current Data 	                                    Comments 	                                Default Value
#37 COM Port on PC(string) 	                    The serial port 						
#76 COM Port ParityBit/Stop(string) 	            Parity/Stop bits (factory defaults) 	8N1 					
#78 COM Port BaudRate(string)                       Baud rate (factory default) 	        B9600 					
#157 Discrete Volume(bool) 	                    Indicates if the volume on...               1 

Settings are factory defaults and should't be changed (9600 baud rate, 8 bits, 1 stop bit)...

'Edit Ruby code' (on template page)

'Add/remove commands'

First, I clicked on 'Add/remove commands' and clicked on commands that are supported by device...

I had to add a lot of new command groups, cause they were non existent. In this way one can reuse those command groups also for other devices. I've created following command groups :

MultiRoom Inputs
MultiRoom Line Standard Commands
MultiRoom Line Volume Commands
MultiRoom Standard Commands
MultiRoom Volume Commands
Tone Control

I also added few commands to already existing command groups (like Inputs,...). I just hope that those change will get into main LMCE database, so everyone will be able to reuse it.

'Add Ruby snippets to commands'

Edited coresponding Ruby snippets for each command. Basically those are just simple strings that get send on rs232 to take proper action on device according to received command from LinuxMCE...


Power

#193 Off
       <$"@PWR:1\r"$> 	
#192 On
       <$"@PWR:2\r"$> sleep(1) <$"@AMT:1\r"$> @mute = false <$"@VOL:0-40\r"$> # main volume <$"@MSV:0-40\r"$> # multi speaker volume 	
#194 Toggle Power
       <$"@PWR:0\r"$> 	

Inputs

#162 CD
       <$"@SRC:C\r"$> 	
#420 CDR
       <$"@SRC:D\r"$> 	
#178 DSS
       <$"@SRC:4\r"$> 	
#165 DVD
       <$"@SRC:2\r"$> 	
#943 MultiRoom CD
       <$"@MSC:C\r"$> 	
#945 MultiRoom CDR
       <$"@MSC:D\r"$> 	
#942 MultiRoom DSS
       <$"@MSC:4\r"$> 	
#940 MultiRoom DVD
       <$"@MSC:2\r"$> 	
#944 MultiRoom Tape
       <$"@MSC:E\r"$> 	
#946 MultiRoom Tuner
       <$"@MSRC:F\r"$> 	
#939 MultiRoom TV
       <$"@MSC:1\r"$> 	
#941 MultiRoom VCR-1
       <$"@MSC:3\r"$> 	
#160 Tape / Tape 1
       <$"@SRC:E\r"$> 	
#166 Tuner
       <$"@SRC:F\r"$> 	
#161 TV
       <$"@SRC:1\r"$> 	
#282 VCR-1
       <$"@SRC:3\r"$> 	

General

#190 Enter/Go

Internal

#373 Private Method Listing
       def readLine() $line=String.new $index=0 cod=conn_.Recv(1, $waitTime) $line+=cod while (cod[0,1] != "\r") do if (conn_ != nil) then cod=conn_.Recv(1, $waitTime) $line += cod else log( "Can not read from serial " + "\n" ) end if( $line.size() >2 ) then log( "Temp received:" + $line + "\n" ) end end log( "Final received:" + $line + "\n" ) return $line end def log(word) logTime = Time.now timeStr = logTime.strftime("%d-%m-%Y %H:%M:%S ") print( timeStr + " " + word) if( $logFile.nil? == false ) then $logFile.print( timeStr + " " + word ) $logFile.flush() end end def readLine_avrsa() $line=String.new $index=0 cod=conn_.Recv(1, $waitTime) $line+=cod while (cod[0,1] != "\r") do if (conn_ != nil) then cod=conn_.Recv(1, $waitTime) $line += cod else log( "Can not read from serial " + "\n" ) end if( $line.size() >2 ) then log( "Temp received:" + $line + "\n" ) end end log( "Final received:" + $line + "\n" ) return $line end 	
#351 Process IDLE
       <$"@AST:?\r"$> 	
#350 Process Incoming Data
       # buff = readLine() # print buff,"\n" buff = conn_.RecvDelimited("\r", 100) print "Got from Marantz: ",buff,"\n" log("Got from Marantz: "+ $buff +"\n") 	


alternative #350:

### #350
while(true)
  @buff = conn_.Recv(128,50)
  if(@buff.length() == 0)
    break
  end
  debugin(@buff)
  response = @buff;
  avrcommand = response[1..3]
  avrvalue = response[5]
  case avrcommand
    when 'SRC'
      log('input changed: '+ avrvalue);
      input_param=0
      case avrvalue
        when 'D'
          log('Input #420: CDR')
          input_param=420
        when '4'
          log('Input #178: DSS')
          input_param=178
        when '2'
          log('Input #165: DVD')
          input_param=165
        when '3'
          log('Input #282: VCR-1')
          input_param=282
        when 'E'
          log('Input #160: TAPE')
          input_param=160
      end
      cmd = Command.new(device_.devid_, -1001, 1, 2, 49);
      cmd.params_[41] = input_param.to_s();
      SendCommand(cmd);
    when 'VOL'
      volume = response[5..-1].to_i();
      log('volume changed: ' + volume.to_s);
      SetDeviceDataInDB( device_.devid_, 158, volume.to_s ) # 158 = DEVICEDATA_Volume_Level_CONST
      cmd = Command.new(device_.devid_, -1001, 1, 2, 71);
      cmd.params_[30] = volume.to_s
      SendCommand(cmd);
    when 'PWR'
      case avrvalue
        when '1'
          log('power changed: off');
          cmd.params_[10] = "0";
        when '2'
          log('power changed: on');
          cmd.params_[10] = "1";
      end
      cmd = Command.new(device_.devid_, -1001, 1, 2, 48);
      SendCommand(cmd);
    else
    log('not handling command: ' + avrcommand.to_s())
  end
end

### END OF #350


#355 Process Initialize
       <$"@AST:F\r"$> #level of feedback <$"@VOL:0-40\r"$> # main volume <$"@MSP:2\r"$> # multi speaker <$"@MSV:0-40\r"$> # multi speaker volume $logFile = File.new("/var/log/pluto/Marantz_SR5600.log", "w") #buffer for reading from serial $line=String.new $lineIndex=0 $waitTime = 3000 #wait time in comunication 	
#384 Process Receive Command For Child
#356 Process Release


Misc

#932 Back Down
       <$"@CHL:29\r"$> <$"@CHL:2A\r"$> 	
#931 Back Up
       <$"@CHL:19\r"$> <$"@CHL:1A\r"$> 	
#462 Center Down
       <$"@CHL:24\r"$> 	
#463 Center Up
       <$"@CHL:14\r"$> 	
#514 Front Down
       <$"@CHL:22\r"$> <$"@CHL:23\r"$> 	
#515 Front Up
       <$"@CHL:12\r"$> <$"@CHL:13\r"$> 	
#930 SubWoofer Down
       <$"@CHL:2B\r"$> 	
#929 SubWoofer Up
       <$"@CHL:1B\r"$> 	
#644 Surround Down
       <$"@CHL:26\r"$> <$"@CHL:27\r"$> 	
#646 Surround Up
       <$"@CHL:16\r"$> <$"@CHL:17\r"$> 	
#663 Treble Down
       <$"@TOT:2\r"$> 	
#666 Treble Up
       <$"@TOT:1\r"$> 	

MultiRoom Line Vol

#925 MultiRoom Line Mute
       <$"@MAM:0\r"$> 	
#934 MultiRoom Line Off
       <$"@MPW:1\r"$> 	
#933 MultiRoom Line On
       <$"@MPW:2\r"$> 	
#926 MultiRoom Line Set Volume
       <$"@MVL:0xxx\r"$> 	
#935 MultiRoom Line Toggle
       <$"@MPW:0\r"$> 	
#927 MultiRoom Line Vol Down
       <$"@MVL:2\r"$> 	
#928 MultiRoom Line Vol Up
       <$"@MVL:1\r"$> 	

MultiRoom Sound & Vo

#921 MultiRoom Mute
       <$"@MSM:0\r"$> 	
#937 MultiRoom Off
       <$"@MSP:1\r"$> 	
#936 MultiRoom On
       <$"@MSP:2\r"$> 	
#924 MultiRoom Set Volume
       <$"@MSV:0xxx\r"$> 	
#938 MultiRoom Toggle
       <$"@MSP:0\r"$> 	
#923 MultiRoom Vol Down
       <$"@MSV:2\r"$> 	
#922 MultiRoom Vol Up
       <$"@MSV:1\r"$> 	

Numbers

#364 -/--/---
#204 0
       <$"@SRC:F\r"$> <$"@TPR:000\r"$> 	
#205 1
       <$"@SRC:F\r"$> <$"@TPR:001\r"$> 	
#206 2
       <$"@SRC:F\r"$> <$"@TPR:002\r"$> 	
#207 3
       <$"@SRC:F\r"$> <$"@TPR:003\r"$> 	
#208 4
       <$"@SRC:F\r"$> <$"@TPR:004\r"$> 	
#209 5
       <$"@SRC:F\r"$> <$"@TPR:005\r"$> 	
#210 6
       <$"@SRC:F\r"$> <$"@TPR:006\r"$> 	
#211 7
       <$"@SRC:F\r"$> <$"@TPR:007\r"$> 	
#212 8
       <$"@SRC:F\r"$> <$"@TPR:008\r"$> 	
#213 9
       <$"@SRC:F\r"$> <$"@TPR:009\r"$> 	
#363 Back / Clear Entry


On-Screen Menu Navig

#240 Back / Prior Menu
       <$"@MNU:1\r"$> 	
#225 Display
#368 Help
#86 Menu (Show Menu)
       <$"@MNU:2\r"$> 	
#201 Move Down
       <$"@CUR:2\r"$> 	
#202 Move Left
       <$"@CUR:3\r"$> 	
#203 Move Right
       <$"@CUR:4\r"$> 	
#200 Move Up
       <$"@CUR:1\r"$> 	

Simple Control

#64 Skip Back - Channel/Track Lower
       <$"@SRC:F\r"$> <$"@TPR:2r"$> 	
#63 Skip Fwd - Channel/Track Greater
       <$"@SRC:F\r"$> <$"@TPR:1\r"$> 	

Sound & Volume

#230 Bass Down
       <$"@TOB:2\r"$> 	
#229 Bass Up
       <$"@TOB:1\r"$> 	
#97 Mute
       <$"@AMT:0\r"$> 	
#313 Set Volume
       <$"@VOL:0xxx\r"$> 	
#90 Vol Down
       <$"@VOL:2\r"$> 	
#89 Vol Up
       <$"@VOL:1\r"$> 	

Speed Ctrl

#125 Scan Back/Rewind
       <$"@SRC:F\r"$> <$"@TFQ:4\r"$> 	
#93 Scan Fwd/Fast Fwd

'Add 'TV - LiveTV' device with template #1751 as child device'

Go into template #1751 for 'TV - LiveTV' device and add new entry under :

'This device is controlled via Device:SR 5600 Category: Amps/Preamps/Receivers/Tuners Edit Delete'

Click on 'Edit' and this entry and be sure to tick both options :

Reroute Messages To Parent:  	
Auto Create Children: 	

and under

Pipes Used
SR 5600     	Input on SR 5600 	Output on TV - LiveTV 	Pipe 	Flip In/Out: 	

specify to connect this device to Tuner input on SR5600.

Adding device

Add device based on created template

Specify COM port for it

Assing it to new room

Specifiy Audio pipe connections to inputs on receiver

In my case, I connnected output of Hybrid Core and one MD to different inputs (CD and DVD). In that way, when you press play on each source, commands to setup inputs on SR5600 should be done automatically so you can hear music right away....

Now reload Router, regenerate Orbiters and new device should appear in specified room. On click you get into control screen where you can control device 'manually' beside automatic handling described above.

Where the problems arise

I'm describing few potential problems I'm facing in my setup. Will be happy on any opinion or guidance...

Proper support for MultiRoom feature

Device supports separate stereo device on two back channels. That means that with enabling multiroom feature, basically you get two devices (one 4+1 and other 2 channels) that can have separate or same sources and different volume levels. I'm not sure how to properly setup support for such feature - will try to add another child tuner and set it up to control only second separate channel. But it seems that I cannot get two screens for two tuners/zones in one zone, but as child devices they need to be in same zone (as I was advised from LinuxMCE guys or am I missing something).

Cannot add device to Entertainment areas in same room

I have SR5600 assigned to room. Assigning it to separate entertainment area in one of the rooms didn't work (menus didn't appear on Orbiters). Also I should put two child devices (tuners) into separate audio entities, but that would probably not work at this time...

I'm not sure what is the real problem and what is proper solution. I'll kindly ask LinuxMCE guys to guide me here....

Pipes can be connected only to one device

It seems logical, but in case of such devices it's also restriction. I have Hybrid and MD output connected to one input on receiver (although have virtually two devices and would like to have an option to be able to connect two audio pipes from one source). There is also Y connection splitting line audio signal from MD to TV and receiver. Also pipes feature of automatic handling of routing (if you for instance press play on MD, then receiver will be automatically switched to proper input, so you can hear music) can sometimes become restriction. For instance if I use two separate inputs, then hybrid is assigned to one of them and volume control will change main volume and play/stop will reroute always to hard-coded route, regardless of current state, where it might be better rerouted to second device output, cause first one is occupied with Movie....

Pipes and automatic routing is not always a good thing

For instance, user is listening to audio, then he decides to switch manually receiver to FM station. MD or hybrid keeps playing its music and shuts receiver off when it finishes... If we want to properly deal with this situation, we should have two way communication and a lot of code to sense user actions and set everything according to that - but that's a lot more of work to do....


This is schema for my setup and I'd kindly ask for further guidance. There are quite few potential problems with more sophisticated setups, but I feel that this will be common practical situation in deploying LinuxMCE system...

Shema audio.png



Discussion on how to properly implement template for such device ?

(to be expanded)