Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Andre Julius
slc
Commits
4be148d4
Commit
4be148d4
authored
Dec 05, 2017
by
Andre Julius
👀
Browse files
Adapt protocol changes.
parent
76980dad
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main.rs
View file @
4be148d4
...
...
@@ -10,12 +10,13 @@ fn fill_rgb(sock: &UdpSocket, address: &String, len: usize, seq_number: u8, r: u
}
let
offset
=
4
;
let
mut
bytes
=
vec!
[
0
as
u8
;
offset
+
len
*
3
];
bytes
[
0
]
=
seq_number
;
bytes
[
1
]
=
0
;
// VERSION,SEQ,PAD,PAD|G,R,B,G,...
bytes
[
0
]
=
2
;
bytes
[
1
]
=
seq_number
;
bytes
[
2
]
=
0
;
bytes
[
3
]
=
0
;
for
i
in
offset
..
len
{
// the strip recieves SEQ|G,R,B,G,...
bytes
[(
i
*
3
)
+
0
+
offset
]
=
g
;
bytes
[(
i
*
3
)
+
1
+
offset
]
=
r
;
bytes
[(
i
*
3
)
+
2
+
offset
]
=
b
;
...
...
@@ -29,12 +30,12 @@ fn fill_rgbw(sock: &UdpSocket, address: &String, len: usize, seq_number: u8, r:
}
let
offset
=
4
;
let
mut
bytes
=
vec!
[
0
as
u8
;
offset
+
len
*
4
];
bytes
[
0
]
=
seq_number
;
bytes
[
1
]
=
0
;
// VERSION,SEQ,PAD,PAD|G,R,B,W,G,...
bytes
[
0
]
=
2
;
bytes
[
1
]
=
seq_number
;
bytes
[
2
]
=
0
;
bytes
[
3
]
=
0
;
for
i
in
offset
..
len
{
// the strip recieves SEQ|G,R,B,W,G,...
bytes
[(
i
*
4
)
+
0
+
offset
]
=
g
;
bytes
[(
i
*
4
)
+
1
+
offset
]
=
r
;
bytes
[(
i
*
4
)
+
2
+
offset
]
=
b
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment