Skip to content

Commit

Permalink
controller: Download file locally
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
  • Loading branch information
patrickelectric committed Mar 19, 2024
1 parent 7f01efd commit b63e85a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl Controller {
file: OpenOptions::new()
.write(true)
.create(true)
.open("/tmp/potato2")
.open(status.path.split('/').last().unwrap())
.unwrap(),
}));

Expand All @@ -216,7 +216,7 @@ impl Controller {
payload.data[2],
payload.data[3],
]);
println!("0x{:x?}", crc);
println!("crc: 0x{:x?}", crc);
exit(0);
}
}
Expand Down Expand Up @@ -277,15 +277,16 @@ impl Controller {
progress.finish();
}

self.waiting = false;
self.status = None;

// Lets get the crc
let mut buffer = Vec::new();
let mut file = std::fs::File::open("/tmp/potato2").unwrap();
let mut file = std::fs::File::open(status.path.split('/').last().unwrap()).unwrap();
file.read_to_end(&mut buffer).unwrap();
let crc = mavlink_crc32(&buffer);
println!("{:08x}", crc);
println!("calculated crc: 0x{:08x}", crc);

self.status = None;
self.waiting = false;

return None;
}
}
Expand Down

0 comments on commit b63e85a

Please sign in to comment.