Ok, maybe im blind and someone can help me
I get data vie UDP, calculate a RGB565 picture (array as short) from it, and save every frame to a list.
While adding to the list i log the first short of the array wich contains data.
Then if there is no more data coming i want to compute the list. But after filling the list, the list contains every frame,but every single frame is a short array (265) with only zeros.
I get data vie UDP, calculate a RGB565 picture (array as short) from it, and save every frame to a list.
While adding to the list i log the first short of the array wich contains data.
Then if there is no more data coming i want to compute the list. But after filling the list, the list contains every frame,but every single frame is a short array (265) with only zeros.
B4X:
Sub Process_Globals
Dim UDPSocket As UDPSocket
Dim t As Timer
Dim record As Boolean =True
Dim recordlist As List
Dim universe1Send As Boolean
Dim universe2Send As Boolean
Dim bmp(256) As Short
End Sub
Sub start
recordlist.Initialize
If UDPSocket.IsInitialized Then UDPSocket.Close
UDPSocket.Initialize("UDP", ACN_Port, 5000)
t.Initialize("timer",5000)
End Sub
Sub UDP_PacketArrived (Packet As UDPPacket)
t.Enabled=False
t.Enabled=True
If Packet.Data(universebyte)=1 Then
For i=0 To 127
Dim j As Int = i * 3 + (CHANNEL_START)
bmp(i)=get565(Packet.Data(j),Packet.Data(j+1),Packet.Data(j+2))
Next
universe1Send=True
Else if Packet.Data(universebyte)=2 Then
For a=128 To 255
Dim j1 As Int =(a-128) * 3 + (CHANNEL_START)
bmp(a)=get565(Packet.Data(j1),Packet.Data(j1+1),Packet.Data(j1+2))
Next
universe2Send = True
End If
If universe1Send And universe2Send Then
If record Then
addToList(bmp)
End If
universe2Send=False
universe1Send=False
End If
End Sub
Sub addToList(frame() As Short)
Log(frame(0))
recordlist.Add(frame)
End Sub
Sub Timer_Tick
dim frame() as short = recordlist.get(0)
log(frame(0))
End Sub