mirror of
https://github.com/jwetzell/q-sys-plugin-novastar.git
synced 2026-09-10 22:49:33 +00:00
remove buggy connection response test logic
This commit is contained in:
+13
-35
@@ -1126,11 +1126,6 @@ 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}
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
}
|
||||||
NovaStar.socket.ReadTimeout = 0
|
NovaStar.socket.ReadTimeout = 0
|
||||||
NovaStar.socket.WriteTimeout = 0
|
NovaStar.socket.WriteTimeout = 0
|
||||||
@@ -1171,15 +1166,15 @@ if (Controls) then
|
|||||||
|
|
||||||
function sendCommand(cmd)
|
function sendCommand(cmd)
|
||||||
if cmd ~= nil then
|
if cmd ~= nil then
|
||||||
if NovaStar.socket.IsConnected then
|
if NovaStar.socket.IsConnected then
|
||||||
print("Sending packet to connected NovaStar")
|
print("Sending packet to connected NovaStar")
|
||||||
else
|
else
|
||||||
print("Disconnected for some reason?")
|
print("Disconnected for some reason?")
|
||||||
end;
|
end;
|
||||||
print(hex_dump(getCmdString(NovaStar.Commands.Preamble) .. getCmdString(cmd) .. getCmdString(computeChecksum(cmd))))
|
print(hex_dump(getCmdString(NovaStar.Commands.Preamble) .. getCmdString(cmd) .. getCmdString(computeChecksum(cmd))))
|
||||||
if NovaStar.socket.IsConnected then
|
if NovaStar.socket.IsConnected then
|
||||||
NovaStar.socket:Write(getCmdString(NovaStar.Commands.Preamble) .. getCmdString(cmd) .. getCmdString(computeChecksum(cmd)))
|
NovaStar.socket:Write(getCmdString(NovaStar.Commands.Preamble) .. getCmdString(cmd) .. getCmdString(computeChecksum(cmd)))
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1229,23 +1224,7 @@ if (Controls) then
|
|||||||
print("Reading " .. NovaStar.socket.BufferLength .. " Bytes")
|
print("Reading " .. NovaStar.socket.BufferLength .. " Bytes")
|
||||||
local data = NovaStar.socket:Read(NovaStar.socket.BufferLength);
|
local data = NovaStar.socket:Read(NovaStar.socket.BufferLength);
|
||||||
print(hex_dump(data))
|
print(hex_dump(data))
|
||||||
if data == getCmdString(NovaStar.Response.Connected) then
|
NovaStar.setStatus(0,"Connected - " .. Properties['IP Address'].Value)
|
||||||
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
|
end
|
||||||
|
|
||||||
NovaStar.socket.Closed = function()
|
NovaStar.socket.Closed = function()
|
||||||
@@ -1254,12 +1233,13 @@ if (Controls) then
|
|||||||
end
|
end
|
||||||
|
|
||||||
NovaStar.socket.Error = function(sock, err)
|
NovaStar.socket.Error = function(sock, err)
|
||||||
print("TCP Socket Error: ", err)
|
print("TCP Socket Error: ")
|
||||||
|
print(err)
|
||||||
NovaStar.setStatus(2,"Communication error with NovaStar")
|
NovaStar.setStatus(2,"Communication error with NovaStar")
|
||||||
NovaStar.socket:Connect(NovaStar.IP, 5200);
|
NovaStar.socket:Connect(NovaStar.IP, 5200);
|
||||||
end
|
end
|
||||||
|
|
||||||
NovaStar.socket.Timeout = function(sock, err)
|
NovaStar.socket.Timeout = function(sock)
|
||||||
print("TCP Socket Timeout" )
|
print("TCP Socket Timeout" )
|
||||||
NovaStar.setStatus(2,"Timeout in connection to NovaStar")
|
NovaStar.setStatus(2,"Timeout in connection to NovaStar")
|
||||||
NovaStar.socket:Connect(NovaStar.IP, 5200);
|
NovaStar.socket:Connect(NovaStar.IP, 5200);
|
||||||
@@ -1268,7 +1248,6 @@ if (Controls) then
|
|||||||
if Properties['Model'].Value ~= '' then
|
if Properties['Model'].Value ~= '' then
|
||||||
for k,v in pairs(NovaStar.Commands.Inputs[Properties['Model'].Value]) do
|
for k,v in pairs(NovaStar.Commands.Inputs[Properties['Model'].Value]) do
|
||||||
if (v ~= nil and #v > 1) then
|
if (v ~= nil and #v > 1) then
|
||||||
print("value is not nill and length greater than 1")
|
|
||||||
Controls['IN'..k].EventHandler = function()
|
Controls['IN'..k].EventHandler = function()
|
||||||
sendCommand(v)
|
sendCommand(v)
|
||||||
end
|
end
|
||||||
@@ -1304,7 +1283,6 @@ if (Controls) then
|
|||||||
presetTable = NovaStar.Commands.Presets[Properties['Model'].Value]
|
presetTable = NovaStar.Commands.Presets[Properties['Model'].Value]
|
||||||
if presetTable ~= nil then
|
if presetTable ~= nil then
|
||||||
for k,v in pairs(presetTable) do
|
for k,v in pairs(presetTable) do
|
||||||
print('PRESET'..k)
|
|
||||||
Controls['PRESET'..k].EventHandler = function()
|
Controls['PRESET'..k].EventHandler = function()
|
||||||
sendPreset(v)
|
sendPreset(v)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user