0
На рассмотрении

Volume level - Serial rs-232

Christine Bizarello 7 лет назад в Ideas обновлен Iain Brew 4 года назад 7

I have a project for AV automation and I'm using a global cache driver to control the device trough rs-232 port.

My device has the command "<11VOxx0x0D" to control the volume, where the 'xx' is the level of volume that goes from 00 to 38.

I need to create a level that controls this volume without the need of the creation  of 38 buttons for it. Can anyone help me?

На рассмотрении

Hello.

You can do so:
1) Get the value from the Level.
2) The obtained value to insert in the row of the datagram.


Concatenation in this case is possible only through the script. You can see how it is implemented in the attached project.

level.irpz

level.sirpz

Ok, but I didn't quite understand why do I need a server for it?

Can't I do it with a simple script?

I'm trying to make a script on top of the model you sent but I'm not having any sucess.

When I call this script (by pressing a simple button) the command goes perfectly:


function Volume11(){// Global Cache:
IR.GetDevice("7Port").Send(['<11VOxx', '\r\n'], 1);        // .Send command as string
}


But when I try this one by pressing the level nothing happens:


function Volume(){// Global Cache:

volume_value = IR.GetPage("Page Volume").GetItem("Item 1").Value;

IR.GetDevice("7Port").Send(['<11VO' + volume_value, '\r\n'], 1);        // .Send command as string
}


What am I doing wrong?



I use a server to simplify the testing of a panel project.

What do you have in volume_value comes? Do after:


volume_value = IR.GetPage("Page Volume").GetItem("Item 1").Value;


the output in the log:


IR.Log ("volume_value = " + volume_value);


What you have there is the value? You try to add it to the string and send it.

This has been a great help for me in implementing sliders for volume control. I am a little stumped with this when the product requires a checksum to also be sent. What would be the best way to insert the volume (i.e. 00 - 99) but then also calculate a checksum of part of the string to add at the end?

Hello.

In a custom driver, the checksum must be calculated only by the script.

I am a little stumped with this when the product requires a checksum to also be sent.
var bytes = [0xFF, 0x01, 0x02, 0x03];
var string = '255,1,2,3';

var crc8 = IR.CalculateCRC(IR.CRC_8, bytes.join(','));
var crc8_s = IR.CalculateCRC(IR.CRC_8, string);

var crc16 = IR.CalculateCRC(IR.CRC_16, bytes.join(','));
var crc16_s = IR.CalculateCRC(IR.CRC_16, string);

var crc32 = IR.CalculateCRC(IR.CRC_32, bytes.join(','));
var crc32_s = IR.CalculateCRC(IR.CRC_32, string);

IR.Log(crc8);
IR.Log(crc16);
IR.Log(crc32);

IR.Log(crc8_s);
IR.Log(crc16_s);
IR.Log(crc32_s);

Read more about the method here.

Thank you for this - I looked into it and ended up making an Excel sheet which made the code for me. I have attached my project for your reference and JS below. It's a bit ugly, but I will test on Friday when i have a Samsung Display to control volume again.Level Test File

I am using a slider and writing the value (0-99) into a project token. I then read this token and call it 'samsungvolume.' Depending on the value (0-99) it will then send the correctly formatted command with checksum to the display to make the volume change when the slider is released.

var samsungvolume = null;
IR.AddListener(IR.EVENT_TAG_CHANGE, IR.GetVariable("Tokens.volume"), function(name,value)

{
samsungvolume = IR.GetVariable("Tokens.volume")

switch(samsungvolume) {
case "0": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x0,0x12'); break;
case "1": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x1,0x13'); break;
case "2": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x2,0x14'); break;
case "3": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x3,0x15'); break;
case "4": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x4,0x16'); break;
case "5": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x5,0x17'); break;
case "6": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x6,0x18'); break;
case "7": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x7,0x19'); break;
case "8": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x8,0x20'); break;
case "9": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x9,0x21'); break;
case "10": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x10,0x22'); break;
case "11": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x11,0x23'); break;
case "12": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x12,0x24'); break;
case "13": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x13,0x25'); break;
case "14": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x14,0x26'); break;
case "15": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x15,0x27'); break;
case "16": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x16,0x28'); break;
case "17": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x17,0x29'); break;
case "18": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x18,0x2A'); break;
case "19": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x19,0x2B'); break;
case "20": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x20,0x32'); break;
case "21": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x21,0x33'); break;
case "22": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x22,0x34'); break;
case "23": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x23,0x35'); break;
case "24": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x24,0x36'); break;
case "25": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x25,0x37'); break;
case "26": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x26,0x38'); break;
case "27": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x27,0x39'); break;
case "28": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x28,0x3A'); break;
case "29": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x29,0x3B'); break;
case "30": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x30,0x42'); break;
case "31": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x31,0x43'); break;
case "32": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x32,0x44'); break;
case "33": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x33,0x45'); break;
case "34": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x34,0x46'); break;
case "35": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x35,0x47'); break;
case "36": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x36,0x48'); break;
case "37": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x37,0x49'); break;
case "38": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x38,0x4A'); break;
case "39": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x39,0x4B'); break;
case "40": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x40,0x52'); break;
case "41": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x41,0x53'); break;
case "42": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x42,0x54'); break;
case "43": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x43,0x55'); break;
case "44": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x44,0x56'); break;
case "45": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x45,0x57'); break;
case "46": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x46,0x58'); break;
case "47": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x47,0x59'); break;
case "48": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x48,0x5A'); break;
case "49": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x49,0x5B'); break;
case "50": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x50,0x62'); break;
case "51": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x51,0x63'); break;
case "52": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x52,0x64'); break;
case "53": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x53,0x65'); break;
case "54": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x54,0x66'); break;
case "55": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x55,0x67'); break;
case "56": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x56,0x68'); break;
case "57": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x57,0x69'); break;
case "58": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x58,0x6A'); break;
case "59": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x59,0x6B'); break;
case "60": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x60,0x72'); break;
case "61": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x61,0x73'); break;
case "62": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x62,0x74'); break;
case "63": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x63,0x75'); break;
case "64": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x64,0x76'); break;
case "65": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x65,0x77'); break;
case "66": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x66,0x78'); break;
case "67": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x67,0x79'); break;
case "68": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x68,0x7A'); break;
case "69": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x69,0x7B'); break;
case "70": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x70,0x82'); break;
case "71": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x71,0x83'); break;
case "72": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x72,0x84'); break;
case "73": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x73,0x85'); break;
case "74": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x74,0x86'); break;
case "75": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x75,0x87'); break;
case "76": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x76,0x88'); break;
case "77": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x77,0x89'); break;
case "78": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x78,0x8A'); break;
case "79": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x79,0x8B'); break;
case "80": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x80,0x92'); break;
case "81": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x81,0x93'); break;
case "82": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x82,0x94'); break;
case "83": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x83,0x95'); break;
case "84": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x84,0x96'); break;
case "85": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x85,0x97'); break;
case "86": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x86,0x98'); break;
case "87": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x87,0x99'); break;
case "88": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x88,0x9A'); break;
case "89": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x89,0x9B'); break;
case "90": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x90,0xA2'); break;
case "91": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x91,0xA3'); break;
case "92": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x92,0xA4'); break;
case "93": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x93,0xA5'); break;
case "94": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x94,0xA6'); break;
case "95": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x95,0xA7'); break;
case "96": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x96,0xA8'); break;
case "97": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x97,0xA9'); break;
case "98": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x98,0xAA'); break;
case "99": IR.GetDevice("SamsungDisplay").Send('0xAA,0x12,0xFF,0x1,0x99,0xAB');

}
});


Сервис поддержки клиентов работает на платформе UserEcho