Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions tockloader-lib/src/bootloader_serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,13 @@ pub async fn ping_bootloader_and_wait_for_response(
) -> Result<(), TockloaderError> {
let ping_pkt = [ESCAPE_CHAR, Command::Ping as u8];

for _ in 0..30 {
for attempt in 0..30 {
eprintln!("attempt {}", attempt); // Debug purposes
write_bytes(port, &ping_pkt, DEFAULT_TIMEOUT).await?;
let ret = read_bytes(port, 2, DEFAULT_TIMEOUT).await?;
let ret = match read_bytes(port, 2, DEFAULT_TIMEOUT).await {
Ok(buf) => buf,
Err(_) => continue,
};

if ret[1] == Response::Pong as u8 {
return Ok(());
Expand Down