comment added
This commit is contained in:
parent
2ffcd1daec
commit
5d15a2b56b
1 changed files with 2 additions and 0 deletions
|
@ -88,6 +88,7 @@ fn mopp(speed: u8, data: &[u8]) -> Vec<u8> {
|
||||||
|
|
||||||
m.replace_range(m.len() - 2.., "11"); // EOW
|
m.replace_range(m.len() - 2.., "11"); // EOW
|
||||||
|
|
||||||
|
// Extend to full bytes
|
||||||
m = format!(
|
m = format!(
|
||||||
"{1:0<0$}",
|
"{1:0<0$}",
|
||||||
(8 as f32 * (m.len() as f32 / 8 as f32).ceil()) as usize,
|
(8 as f32 * (m.len() as f32 / 8 as f32).ceil()) as usize,
|
||||||
|
@ -96,6 +97,7 @@ fn mopp(speed: u8, data: &[u8]) -> Vec<u8> {
|
||||||
|
|
||||||
let mut res = Vec::<u8>::new();
|
let mut res = Vec::<u8>::new();
|
||||||
|
|
||||||
|
// Convert string representation to "real" bits
|
||||||
for i in (0..m.len()).step_by(8) {
|
for i in (0..m.len()).step_by(8) {
|
||||||
let value = u8::from_str_radix(&m[i..i + 8], 2).unwrap();
|
let value = u8::from_str_radix(&m[i..i + 8], 2).unwrap();
|
||||||
res.push(value);
|
res.push(value);
|
||||||
|
|
Loading…
Reference in a new issue