diff --git a/content/novastar.qplug b/content/novastar.qplug index c21e08b..9e03258 100644 --- a/content/novastar.qplug +++ b/content/novastar.qplug @@ -43,7 +43,14 @@ function GetProperties() Type = 'enum', Choices = { 'VX4S', 'VX4S_N', 'VX6S', 'PROHD', 'PROUHDJR', 'MCTRL4K' }, Value = 'VX4S' - } + }, + { + Name = "Default Brightness", + Type = "integer", + Min = 0, + Max = 255, + Value = 128 + }, } return props end @@ -122,48 +129,48 @@ function GetControls(props) -- Test Pattern Buttons { - Name = "TEST1", + Name = "TEST_RED", ControlType = "Button", ButtonType = "Trigger" }, { - Name = "TEST2", + Name = "TEST_GREEN", ControlType = "Button", ButtonType = "Trigger" }, { - Name = "TEST3", + Name = "TEST_BLUE", ControlType = "Button", ButtonType = "Trigger" }, { - Name = "TEST4", + Name = "TEST_WHITE", ControlType = "Button", ButtonType = "Trigger" }, { - Name = "TEST5", + Name = "TEST_HORIZ", ControlType = "Button", ButtonType = "Trigger" }, { - Name = "TEST6", + Name = "TEST_VERT", ControlType = "Button", ButtonType = "Trigger" }, { - Name = "TEST7", + Name = "TEST_DIAG", ControlType = "Button", ButtonType = "Trigger" }, { - Name = "TEST8", + Name = "TEST_GRAY", ControlType = "Button", ButtonType = "Trigger" }, { - Name = "TEST9", + Name = "TEST_AGING", ControlType = "Button", ButtonType = "Trigger" }, @@ -387,7 +394,7 @@ function GetControlLayout(props) } --First row of test buttons - controls['TEST1'] = { + controls['TEST_RED'] = { Style = "Button", ButtonType = "Trigger", Legend = TestLabels[1] ~= nil and TestLabels[1] or "1" , @@ -398,7 +405,7 @@ function GetControlLayout(props) Size = TestButton.Size } - controls['TEST2'] = { + controls['TEST_GREEN'] = { Style = "Button", ButtonType = "Trigger", Legend = TestLabels[2] ~= nil and TestLabels[2] or "2" , @@ -409,7 +416,7 @@ function GetControlLayout(props) Size = TestButton.Size } - controls['TEST3'] = { + controls['TEST_BLUE'] = { Style = "Button", ButtonType = "Trigger", Legend = TestLabels[3] ~= nil and TestLabels[3] or "3" , @@ -420,7 +427,7 @@ function GetControlLayout(props) Size = TestButton.Size } - controls['TEST4'] = { + controls['TEST_WHITE'] = { Style = "Button", ButtonType = "Trigger", Legend = TestLabels[4] ~= nil and TestLabels[4] or "4", @@ -432,7 +439,7 @@ function GetControlLayout(props) } - controls['TEST5'] = { + controls['TEST_HORIZ'] = { Style = "Button", ButtonType = "Trigger", Legend = TestLabels[5] ~= nil and TestLabels[5] or "5", @@ -506,7 +513,7 @@ function GetControlLayout(props) } --Second row of test buttons - controls['TEST6'] = { + controls['TEST_VERT'] = { Style = "Button", ButtonType = "Trigger", Legend = TestLabels[6] ~= nil and TestLabels[6] or "6", @@ -517,7 +524,7 @@ function GetControlLayout(props) Size = TestButton.Size } - controls['TEST7'] = { + controls['TEST_DIAG'] = { Style = "Button", ButtonType = "Trigger", Legend = TestLabels[7] ~= nil and TestLabels[7] or "7", @@ -529,7 +536,7 @@ function GetControlLayout(props) } - controls['TEST8'] = { + controls['TEST_GRAY'] = { Style = "Button", ButtonType = "Trigger", Legend = TestLabels[8] ~= nil and TestLabels[8] or "8", @@ -540,7 +547,7 @@ function GetControlLayout(props) Size = TestButton.Size } - controls['TEST9'] = { + controls['TEST_AGING'] = { Style = "Button", ButtonType = "Trigger", Legend = TestLabels[9] ~= nil and TestLabels[9] or "9", @@ -564,8 +571,11 @@ function GetControlLayout(props) return controls, graphics end + + if (Controls) then local NovaStar = { + IP = '', socket = TcpSocket.New(), setStatus = function (value, msg) -- 0 = OK @@ -578,79 +588,122 @@ if (Controls) then Controls['Status'].Value = value; Controls['Status'].String = msg; end, - - Commands = { Preamble = {0x55, 0xAA}, - Connect = {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x57,0x56}, + Connect = {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00}, Brightness = {0x00,0x00,0xFE,0xFF,0x01,0xFF,0xFF,0xFF,0x01,0x00,0x01,0x00,0x00,0x02,0x01,0x00}, TestPatterns = { - {0x00,0xe8,0xfe,0x00,0x01,0x01,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x02,0x43,0x59}, --Red - {0x00,0x80,0xFE,0x00,0x01,0x00,0xFF,0xFF,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x03,0xDB,0x58}, --Green - {0x00,0x80,0xFE,0x00,0x01,0x00,0xFF,0xFF,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x04,0xDC,0x58}, --Blue - {0x00,0x80,0xFE,0x00,0x01,0x00,0xFF,0xFF,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x05,0xDD,0x58}, --White - {0x00,0x80,0xFE,0x00,0x01,0x00,0xFF,0xFF,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x06,0xDE,0x58}, --Horizontal - {0x00,0x80,0xFE,0x00,0x01,0x00,0xFF,0xFF,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x07,0xDF,0x58}, --Vertical - {0x00,0x80,0xFE,0x00,0x01,0x00,0xFF,0xFF,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x08,0xE0,0x58}, --Diagaonal - {0x00,0x80,0xFE,0x00,0x01,0x00,0xFF,0xFF,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x09,0xE1,0x58}, --Grayscale - {0x00,0x80,0xFE,0x00,0x01,0x00,0xFF,0xFF,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x0A,0xE2,0x58} --Aging-All + RED = { + {0x00,0xe7,0xfe,0x00,0x01,0x00,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x02}, + {0x00,0xe8,0xfe,0x00,0x01,0x01,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x02}, + {0x00,0xe9,0xfe,0x00,0x01,0x02,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x02}, + {0x00,0xea,0xfe,0x00,0x01,0x03,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x02}, + }, + GREEN = { + {0x00,0xe7,0xfe,0x00,0x01,0x00,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x03}, + {0x00,0xe8,0xfe,0x00,0x01,0x01,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x03}, + {0x00,0xe9,0xfe,0x00,0x01,0x02,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x03}, + {0x00,0xea,0xfe,0x00,0x01,0x03,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x03}, + }, + BLUE = { + {0x00,0xe7,0xfe,0x00,0x01,0x00,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x04}, + {0x00,0xe8,0xfe,0x00,0x01,0x01,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x04}, + {0x00,0xe9,0xfe,0x00,0x01,0x02,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x04}, + {0x00,0xea,0xfe,0x00,0x01,0x03,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x04}, + }, + WHITE = { + {0x00,0xe7,0xfe,0x00,0x01,0x00,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x05}, + {0x00,0xe8,0xfe,0x00,0x01,0x01,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x05}, + {0x00,0xe9,0xfe,0x00,0x01,0x02,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x05}, + {0x00,0xea,0xfe,0x00,0x01,0x03,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x05}, + }, + HORIZ = { + {0x00,0xe7,0xfe,0x00,0x01,0x00,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x06}, + {0x00,0xe8,0xfe,0x00,0x01,0x01,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x06}, + {0x00,0xe9,0xfe,0x00,0x01,0x02,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x06}, + {0x00,0xea,0xfe,0x00,0x01,0x03,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x06}, + }, + VERT = { + {0x00,0xe7,0xfe,0x00,0x01,0x00,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x07}, + {0x00,0xe8,0xfe,0x00,0x01,0x01,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x07}, + {0x00,0xe9,0xfe,0x00,0x01,0x02,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x07}, + {0x00,0xea,0xfe,0x00,0x01,0x03,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x07}, + }, + DIAG = { + {0x00,0xe7,0xfe,0x00,0x01,0x00,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x08}, + {0x00,0xe8,0xfe,0x00,0x01,0x01,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x08}, + {0x00,0xe9,0xfe,0x00,0x01,0x02,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x08}, + {0x00,0xea,0xfe,0x00,0x01,0x03,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x08}, + }, + GRAY = { + {0x00,0xe7,0xfe,0x00,0x01,0x00,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x09}, + {0x00,0xe8,0xfe,0x00,0x01,0x01,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x09}, + {0x00,0xe9,0xfe,0x00,0x01,0x02,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x09}, + {0x00,0xea,0xfe,0x00,0x01,0x03,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x09}, + }, + AGING = { + {0x00,0xe7,0xfe,0x00,0x01,0x00,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x0A}, + {0x00,0xe8,0xfe,0x00,0x01,0x01,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x0A}, + {0x00,0xe9,0xfe,0x00,0x01,0x02,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x0A}, + {0x00,0xea,0xfe,0x00,0x01,0x03,0xff,0xff,0x01,0x00,0x01,0x01,0x00,0x02,0x01,0x00,0x0A}, + } }, - DisplayNormal = { 0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x50,0x00,0x20,0x02,0x01,0x00,0x00,0xC7,0x56 }, - DisplayNormalAlt = { 0x00,0x38,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x04,0x00,0x00,0x13,0x01,0x00,0x03,0xA7,0x56 }, + DisplayNormal = { 0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x50,0x00,0x20,0x02,0x01,0x00,0x00 }, + DisplayNormalAlt = { 0x00,0x38,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x04,0x00,0x00,0x13,0x01,0x00,0x03 }, Inputs = { VX4S = { - {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x10,0xB4,0x56}, --DVI - {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0xA0,0x44,0x57}, --HDMI - {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x01,0xA5,0x56}, --VGA1 - {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x02,0xA6,0x56}, --VGA2 - {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x71,0x15,0x57}, --CVBS1 - {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x72,0x16,0x57}, --CVBS2 - {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x40,0xE4,0x56}, --SDI - {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x90,0x34,0x57}, --DP + {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x10}, --DVI + {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0xA0}, --HDMI + {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x01}, --VGA1 + {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x02}, --VGA2 + {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x71}, --CVBS1 + {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x72}, --CVBS2 + {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x40}, --SDI + {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x90}, --DP {}, {}, }, VX4S_N = { - {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0xA0,0x44,0x57}, --HDMI - {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x10,0xB4,0x56}, --DVI - {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x01,0xA5,0x56}, --VGA + {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0xA0}, --HDMI + {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x10}, --DVI + {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x01}, --VGA {}, {}, - {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x71,0x15,0x57}, --CVBS - {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x90,0x34,0x57}, --DP - {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x40,0xE4,0x56}, --SDI + {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x71}, --CVBS + {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x90}, --DP + {0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2D,0x00,0x20,0x02,0x01,0x00,0x40}, --SDI {}, {}, }, VX6S = { - {0x00,0x88,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x12,0x00,0x02,0x13,0x03,0x00,0x00,0x00,0x11,0x17,0x57}, --HDMI1 - {0x00,0xA8,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x12,0x00,0x02,0x13,0x03,0x00,0x01,0x00,0x12,0x39,0x57}, --HDMI2 - {0x00,0xC4,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x12,0x00,0x02,0x13,0x03,0x00,0x02,0x00,0x31,0x75,0x57}, --SDI1 - {0x00,0xD4,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x12,0x00,0x02,0x13,0x03,0x00,0x03,0x00,0x32,0x87,0x57}, --SDI2 - {0x00,0xD6,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x12,0x00,0x02,0x13,0x03,0x00,0x04,0x00,0x01,0x59,0x57}, --DVI1 - {0x00,0xD7,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x12,0x00,0x02,0x13,0x03,0x00,0x06,0x00,0x02,0x5D,0x57}, --DVI2 - {0x00,0xD9,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x12,0x00,0x02,0x13,0x03,0x00,0x07,0x00,0xA0,0xFE,0x57}, --USB + {0x00,0x88,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x12,0x00,0x02,0x13,0x03,0x00,0x00,0x00,0x11}, --HDMI1 + {0x00,0xA8,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x12,0x00,0x02,0x13,0x03,0x00,0x01,0x00,0x12}, --HDMI2 + {0x00,0xC4,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x12,0x00,0x02,0x13,0x03,0x00,0x02,0x00,0x31}, --SDI1 + {0x00,0xD4,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x12,0x00,0x02,0x13,0x03,0x00,0x03,0x00,0x32}, --SDI2 + {0x00,0xD6,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x12,0x00,0x02,0x13,0x03,0x00,0x04,0x00,0x01}, --DVI1 + {0x00,0xD7,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x12,0x00,0x02,0x13,0x03,0x00,0x06,0x00,0x02}, --DVI2 + {0x00,0xD9,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x12,0x00,0x02,0x13,0x03,0x00,0x07,0x00,0xA0}, --USB {}, {}, {}, }, PROHD = { - {0x00,0x2B,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x22,0x00,0x20,0x02,0x01,0x00,0x1A,0xDE,0x56}, --SDI - {0x00,0x34,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x22,0x00,0x20,0x02,0x01,0x00,0x1C,0xE9,0x56}, --DVI - {0x00,0x3F,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x22,0x00,0x20,0x02,0x01,0x00,0x1B,0xF3,0x56}, --HDMI - {0x00,0x51,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x22,0x00,0x20,0x02,0x01,0x00,0x1E,0x08,0x57}, --DP - {0x00,0x48,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x22,0x00,0x20,0x02,0x01,0x00,0x17,0xF8,0x56}, --VGA - {0x00,0x5A,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x22,0x00,0x20,0x02,0x01,0x00,0x02,0xF5,0x56}, --CVBS + {0x00,0x2B,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x22,0x00,0x20,0x02,0x01,0x00,0x1A}, --SDI + {0x00,0x34,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x22,0x00,0x20,0x02,0x01,0x00,0x1C}, --DVI + {0x00,0x3F,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x22,0x00,0x20,0x02,0x01,0x00,0x1B}, --HDMI + {0x00,0x51,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x22,0x00,0x20,0x02,0x01,0x00,0x1E}, --DP + {0x00,0x48,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x22,0x00,0x20,0x02,0x01,0x00,0x17}, --VGA + {0x00,0x5A,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x22,0x00,0x20,0x02,0x01,0x00,0x02}, --CVBS {}, {}, {}, {}, }, PROUHDJR = { - {0x00,0x2B,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x22,0x00,0x20,0x02,0x01,0x00,0x1A,0xDE,0x56}, --SDI - {0x00,0x34,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x22,0x00,0x20,0x02,0x01,0x00,0x1C,0xE9,0x56}, --DVI - {0x00,0x3F,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x22,0x00,0x20,0x02,0x01,0x00,0x1B,0xF3,0x56}, --HDMI - {0x00,0x51,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x22,0x00,0x20,0x02,0x01,0x00,0x1E,0x08,0x57}, --DP + {0x00,0x2B,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x22,0x00,0x20,0x02,0x01,0x00,0x1A}, --SDI + {0x00,0x34,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x22,0x00,0x20,0x02,0x01,0x00,0x1C}, --DVI + {0x00,0x3F,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x22,0x00,0x20,0x02,0x01,0x00,0x1B}, --HDMI + {0x00,0x51,0xFE,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x22,0x00,0x20,0x02,0x01,0x00,0x1E}, --DP {}, {}, {}, @@ -659,9 +712,9 @@ if (Controls) then {}, }, MCTRL4K = { - {0x00,0x3E,0xFE,0xFF,0x00,0x00,0x00,0x00,0x01,0x00,0x23,0x00,0x00,0x02,0x01,0x00,0x61,0x18,0x58}, --DVI - {0x00,0x8A,0xFE,0xFF,0x00,0x00,0x00,0x00,0x01,0x00,0x23,0x00,0x00,0x02,0x01,0x00,0x05,0x08,0x58}, --HDMI - {0x00,0x9D,0xFE,0xFF,0x00,0x00,0x00,0x00,0x01,0x00,0x23,0x00,0x00,0x02,0x01,0x00,0x5F,0x75,0x58}, --DP + {0x00,0x3E,0xFE,0xFF,0x00,0x00,0x00,0x00,0x01,0x00,0x23,0x00,0x00,0x02,0x01,0x00,0x61}, --DVI + {0x00,0x8A,0xFE,0xFF,0x00,0x00,0x00,0x00,0x01,0x00,0x23,0x00,0x00,0x02,0x01,0x00,0x05}, --HDMI + {0x00,0x9D,0xFE,0xFF,0x00,0x00,0x00,0x00,0x01,0x00,0x23,0x00,0x00,0x02,0x01,0x00,0x5F}, --DP {}, {}, {}, @@ -675,11 +728,13 @@ if (Controls) then }, Response = { Connected = {0xAA,0x55,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x06,0x61,0xBE,0x56}, - ConnectedAlt = {0xAA,0x55,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x2a,0x61,0xe2,0x56} + ConnectedAlt = {0xAA,0x55,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x2a,0x61,0xE2,0x56} }, } - -- NovaStar.socket.ReadTimeout = 0.5 + NovaStar.socket.ReadTimeout = 0 + NovaStar.socket.WriteTimeout = 0 + NovaStar.socket.ReconnectTimeout = 0 function computeChecksum(bytes) local sum = 0 @@ -704,15 +759,21 @@ if (Controls) then return cmd end + function sendTestPattern(pattern) + for k,v in pairs(pattern) do + sendCommand(v) + end + end + function sendCommand(cmd) if NovaStar.socket.IsConnected then print("Sending packet to connected NovaStar") else - print("Following would have been sent if NovaStar was connected") + print("Disconnected for some reason?") end; - print(hex_dump(getCmdString(cmd))) + print(hex_dump(getCmdString(NovaStar.Commands.Preamble) .. getCmdString(cmd) .. getCmdString(computeChecksum(cmd)))) if NovaStar.socket.IsConnected then - NovaStar.socket:Write(getCmdString(NovaStar.Commands.Preamble) .. getCmdString(cmd)) + NovaStar.socket:Write(getCmdString(NovaStar.Commands.Preamble) .. getCmdString(cmd) .. getCmdString(computeChecksum(cmd))) end end @@ -724,13 +785,6 @@ if (Controls) then end end - function sendKeepAlive(timer) - print("Sending Keep Alive") - sendCommand(NovaStar.Commands.Connect) - - end - - function hex_dump (str) local len = string.len( str ) local dump = "" @@ -755,18 +809,13 @@ if (Controls) then return dump .. hex .. string.rep( " ", 8 - len % 8 ) .. asc end - keepAliveTimer = Timer.New() - keepAliveTimer.EventHandler = sendKeepAlive - - NovaStar.socket.Connected = function() print("TCP Connection Established to NovaStar @ " .. Properties['IP Address'].Value) sendCommand(NovaStar.Commands.Connect) - keepAliveTimer:Start(2) - end NovaStar.socket.Reconnect = function() + print("TCP Socket Reconnecting?") NovaStar.setStatus(5,"Attempting to reconnect") end @@ -774,30 +823,40 @@ if (Controls) then print("Reading " .. NovaStar.socket.BufferLength .. " Bytes") local data = NovaStar.socket:Read(NovaStar.socket.BufferLength); print(hex_dump(data)) - if data == getCmdString(NovaStar.Response.Connected) then print("Successful Connection Response Received") NovaStar.setStatus(0,"Connected - " .. Properties['IP Address'].Value) + if(Properties['Default Brightness'].Value ~= '' and Controls['Brightness'].Value == Properties['Default Brightness'].Value ) then + print('Sending default brightness value of ' .. Properties['Default Brightness'].Value) + Controls['Brightness'].Value = Properties['Default Brightness'].Value + sendBrightness(Properties['Default Brightness'].Value) + end; elseif data == getCmdString(NovaStar.Response.ConnectedAlt) then print("Successful Connection Response Received") NovaStar.setStatus(0,"Connected - " .. Properties['IP Address'].Value) + if(Properties['Default Brightness'].Value ~= '' and Controls['Brightness'].Value == Properties['Default Brightness'].Value ) then + print('Sending default brightness value of ' .. Properties['Default Brightness'].Value) + Controls['Brightness'].Value = Properties['Default Brightness'].Value + sendBrightness(Properties['Default Brightness'].Value) + end; end end NovaStar.socket.Closed = function() + print("TCP Socket Closed?") NovaStar.setStatus(2,"Connection closed by NovaStar") - keepAliveTimer:Stop() end NovaStar.socket.Error = function(sock, err) print("TCP Socket Error: ", err) NovaStar.setStatus(2,"Communication error with NovaStar") - keepAliveTimer:Stop() + NovaStar.socket:Connect(NovaStar.IP, 5200); end NovaStar.socket.Timeout = function(sock, err) + print("TCP Socket Timeout" ) NovaStar.setStatus(2,"Timeout in connection to NovaStar") - keepAliveTimer:Stop() + NovaStar.socket:Connect(NovaStar.IP, 5200); end if Properties['Model'].Value ~= '' then @@ -824,8 +883,8 @@ if (Controls) then end for k,v in pairs(NovaStar.Commands.TestPatterns) do - Controls['TEST'..k].EventHandler = function() - sendCommand(v) + Controls['TEST_'..k].EventHandler = function() + sendTestPattern(v) end end end @@ -836,8 +895,9 @@ if (Controls) then end if(Properties['IP Address'].Value ~= '') then + NovaStar.IP = Properties['IP Address'].Value NovaStar.setStatus(5, 'Connecting to NovaStar'); - NovaStar.socket:Connect(Properties['IP Address'].Value, 5200); + NovaStar.socket:Connect(NovaStar.IP, 5200); else NovaStar.setStatus(3, '\nPlease set IP address.'); Controls['IN1'].IsDisabled = true; @@ -853,4 +913,9 @@ if (Controls) then Controls['Brightness'].IsDisabled = true; end; + if(Properties['Default Brightness'].Value ~= '') then + Controls['Brightness'].Value = Properties['Default Brightness'].Value + sendBrightness(Properties['Default Brightness'].Value) + end; + end \ No newline at end of file