forked from fafo/microscope-control
Smallish cleanup.
Signed-off-by: Henner Zeller <h.zeller@acm.org>
This commit is contained in:
parent
ad9b1cb8c2
commit
b130450019
2 changed files with 3 additions and 8 deletions
|
|
@ -54,14 +54,9 @@ fn main() {
|
|||
sleep(Duration::from_secs(5));
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct App {}
|
||||
|
||||
impl Default for App {
|
||||
fn default() -> Self {
|
||||
App {}
|
||||
}
|
||||
}
|
||||
|
||||
impl eframe::App for App {
|
||||
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
||||
egui::CentralPanel::default().show(ctx, |ui| {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ impl StageIO {
|
|||
let mut buf = [0u8; 1];
|
||||
self.serial
|
||||
.read_exact(&mut buf)
|
||||
.map_err(|e| StageIOError::Read(e))?;
|
||||
.map_err(StageIOError::Read)?;
|
||||
res.push(buf[0]);
|
||||
if res.ends_with(needle.as_ref().as_bytes()) {
|
||||
return Ok(String::from_utf8_lossy(&res).to_string());
|
||||
|
|
@ -48,7 +48,7 @@ impl StageIO {
|
|||
debug!("->: {:?}", command.as_ref());
|
||||
self.serial
|
||||
.write_all(command.as_ref().as_bytes())
|
||||
.map_err(|e| StageIOError::Write(e))?;
|
||||
.map_err(StageIOError::Write)?;
|
||||
let response = self.receive_until("\n")?;
|
||||
debug!("<-: {:?}", response);
|
||||
Ok(response.trim().to_string())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue