Swapped out termion for crossterm

This commit is contained in:
2025-09-20 22:48:12 +02:00
parent e4c4a7f14a
commit 37f15bf187
4 changed files with 343 additions and 58 deletions

View File

@@ -3,6 +3,7 @@ use std::io::{Cursor, Error, Write};
use std::path::PathBuf;
use std::time::{Duration, SystemTime};
use crossterm::event::{KeyCode, KeyModifiers};
use pbr::ProgressBar;
mod args;
@@ -16,7 +17,6 @@ use monitor::Monitor;
mod target;
use target::{PhysicalTarget, Target};
use termion::event::Key;
mod utils;
@@ -230,11 +230,13 @@ fn write_chip(args: ArgWrite, target: &mut PhysicalTarget) -> Result<(), Error>
if !args.monitor { break }
let cause = Monitor::new()
.add_hook(Key::Ctrl('f'), if args.cmd.is_none() { "Re-flash target" } else { "Re-run command and flash target" })
.run(target.port())?;
let mut mon = Monitor::new();
if cause != Key::Ctrl('f') { break }
let reflash_handle = mon.add_hook(KeyCode::Char('f'), KeyModifiers::CONTROL, if args.cmd.is_none() { "Re-flash target" } else { "Re-run command and flash target" });
let cause = mon.run(target.port())?;
if cause != reflash_handle { break }
target.resync_target()?;
}