fix: etherdream: use sleep instead of ping

This commit is contained in:
alban 2024-08-14 13:16:18 +02:00
parent 650a3ed521
commit 89d38f51ec

View File

@ -169,18 +169,19 @@ impl Device for EtherdreamDevice {
line: Vec<Point>, line: Vec<Point>,
_speed: u32, _speed: u32,
) -> LJResult<()> { ) -> LJResult<()> {
let chunk_size = 111; let chunk_size = 512;
let points_iter = line.into_iter(); let points_iter = line.into_iter();
for chunk in points_iter.as_slice().chunks(chunk_size) { for chunk in points_iter.as_slice().chunks(chunk_size) {
debug!("New chunk length: {:?}", chunk.len()); debug!("New chunk length: {:?}", chunk.len());
let capacity = self.points_capacity();
debug!("capacity : {:?}", capacity);
loop { loop {
let capacity = self.points_capacity();
debug!("capacity : {:?}", capacity);
if chunk.len() > capacity as usize { if chunk.len() > capacity as usize {
debug!("Sleep"); debug!("Sleep");
// Sleep for 1/100th of a sec // Sleep for 1/100th of a sec
sleep(Duration::new(0, 10_000_000)); sleep(Duration::new(0, 100_000_000));
self.ping(); break;
// self.ping();
} else { } else {
break; break;
} }