From: Jason S. <ja...@sh...> - 2007-09-17 04:16:39
|
On Sun, 16 Sep 2007, Neil Cherry wrote: > Jason Sharpee wrote: > > Hi All, > > > > Another update. > > > > Last week: > > > - I spent an unexpectedly large amount of time making the interface > > work with existing X10 objects. > > > - My perl binary knowledge had faded a bit and was struggling with > > that for a while. (What I wouldnt give sometimes for a strongly > > typed perl!) > > To go from binary (ie serial data) to Perl I like to use: > > my @buf = unpack('(C2)*', $data); # Convert raw to valid Perl 'string' ^A => 1 > > I had been using: > > my $bytes = pack('H*',"46016680F7"); # Convert a hex string to raw Thanks for the tip. I had been using pack, but have been unable to do a binary OR operation on two packed bytes to combine nibbles. Perl seems to be intrinsicly making it some other data type in its scalar var. Really frustrating, but in the end decided to deal with everything as a hex string and just pack it into binary right before the interface calls. > > > - I finally have properly formated X10 commands being sent to the > > interface from MH > > > Currently: - I am over running the interface! :( Each action on X10 > > comprises usually of multiple X10 protocol commands. I am sending > > all of those multipart commands immediately and it appears to be > > overrunning the device and getting an error. - Forutnately the UPB > > PIM had the same issue so I am starting to re-use some of the > > queuing code there - Once I get an X10 light turning on / off from > > MH, I will do the first checkin. > > Are you waiting 1/2 a second between each message (A1 wait 1/2 a second > AON)? The Insteon PLC can't buffer the X10 in between. You end up stepping > on the X10 to transmit. I was before and it was returning errors. I didnt realize it was 500ms! I have the commands queued now and it seems to work, but not consistently. Dont know if it is just noisy powerline or what ( I have been using UPB for over a year now and god knows what X10 signal sucker is in my house by now) It may be that I am still stepping on the signal or the devices can listen that fast. I will definitely crank it up to 500ms in between commands and give it another go.. Thanks Neil! |