Post 1 made on Monday September 24, 2007 at 11:08 |
darshak40 Long Time Member |
|
|
Hi all,
I try to write a function that can use 2 parameters and send a command to a Russound ST2 tuner.
The command is like that :
"\xF0\x00\x7D\x00\x00\x00\x70\x05\x02\x01\x00\x02\x01\x00\x3A\x00\x70\x00\x00\x00\x01\x28\xF7";
Source Number = On byte 4 and 19 Command = On byte 15
My problem is I can calculate the checksum but how can I put it on my command, I have try different concatenation without success. An ID ?
|
|
OP | Post 2 made on Tuesday September 25, 2007 at 06:16 |
darshak40 Long Time Member |
|
|
And the answer is ... this.sendCommand = function(cmd) { src = CF.widget("_SOURCE_", "PARAMETERS", "ST2").label; chk = 0xF0 + 0x7D + (src-1) + 0x70 + 0x05 +0x02 + 0x01 + 0x02 + 0x01 + cmd + 0x70 + (src-1) + 0x01 + 21 ; chk = chk & 0x7F; var command = "\xF0\x00\x7D" + String.fromCharCode(src-1) + "\x00\x00\x70\x05\x02\x01\x00\x02\x01\x00" + String.fromCharCode(cmd) + "\x00\x70\x00" + String.fromCharCode(src-1) + "\x00\x01" + String.fromCharCode(chk) +"\xF7"; serial.match(command,"\xF7",250); }; this.PWOn = function() { this.sendCommand(0x3A); };
|
|
Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our
Marketplace. For information on how to advertise your service or product
click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.