PDA

View Full Version : Girder Serial Control Sony Mini Disc Player



marcot1
February 15th, 2007, 01:08 PM
I've been playing around with Girder for a bit trying to control a Sony MD-E11 Mini Disc Player. I can give it basic serial commands (play, stop, power etc) using the serial send command from within girder. The LUA script is very basic (i'm trying to learn the scripting) but it does allow two way communication.

I keep getting errors in the lua console.


Serial: Sony2 : Simple Receive: Data 6F 07 05 47 40 03 FF o..G@.ÿ Code: 8192

Followed by


Serial: Sony2 : ERROR: Incomplete response to last command


The sony uses "FF" as the response terminator; I've tried setting that in the LUA script but no matter how I phrase the command it does not seem to make a difference.

I really want to be able to send feedback such as play, pause, stop, track number, time remaining status on to Netremote.

Thanks for any help.

Ron
February 15th, 2007, 03:25 PM
From my quick glance it looks like you are missing the terminator configuration.



SendTerminator = serial.hextobyte ("FF"),
Add that to the list at the top of the object.

marcot1
February 15th, 2007, 04:01 PM
Adding that line to the lua ends up sending the FF twice at the end of the send command (I was already sending the complete serial string form girder). It is recieveing data that girder reports the response was incomplete. The recive begin is 6E and the terminator is FF; or I added it to the wrong place in the lua script.

marcot1
February 15th, 2007, 04:12 PM
I added the line
ReceiveTerminator = serial.hextobyte ("FF"), and got rid of the error.

marcot1
February 15th, 2007, 04:56 PM
Is it possible to do time based mathmatics in a lua script?

The player will return elasped time of a track in the form 6F 0B 05 47 20 51 01 01 12 0F : The last 3 number block indicate track 1 is currently at 18 minutes 15 seconds. What is important to me is the remain time which would be require the script to determine the track number, issue a command to get the total track time then subtract the current elasped time from the total time.

Is this even possible?

Rob H
February 16th, 2007, 02:11 AM
That should all be possible - to extract the time you'd use something like


local _, _, track, min, sec = string.find(data, '(.)(.)(.)$')

That will give you the last 3 bytes in the variables track, min and sec as strings.


track, min, sec = string.byte(track), string.byte(min), string.byte(sec)

will convert them to numbers


local elapsedSeconds = min * 60 + sec

Then you'd need to send the command to request the total track time and do some similar processing.