Improved chances for successful sync
This commit is contained in:
@@ -37,7 +37,6 @@ impl PhysicalTarget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn resync_target(&mut self) -> Result<(), Error> {
|
pub fn resync_target(&mut self) -> Result<(), Error> {
|
||||||
self.port.discard_buffers()?;
|
|
||||||
self.port.set_dtr(true)?;
|
self.port.set_dtr(true)?;
|
||||||
self.port.set_rts(true)?;
|
self.port.set_rts(true)?;
|
||||||
std::thread::sleep(Duration::from_millis(10));
|
std::thread::sleep(Duration::from_millis(10));
|
||||||
@@ -45,6 +44,8 @@ impl PhysicalTarget {
|
|||||||
std::thread::sleep(Duration::from_millis(100));
|
std::thread::sleep(Duration::from_millis(100));
|
||||||
|
|
||||||
for i in (0..5).rev() {
|
for i in (0..5).rev() {
|
||||||
|
self.port.discard_buffers()?;
|
||||||
|
std::thread::sleep(Duration::from_millis(10));
|
||||||
self.port.write(b"U")?;
|
self.port.write(b"U")?;
|
||||||
|
|
||||||
let mut buf = [0u8; 1];
|
let mut buf = [0u8; 1];
|
||||||
|
Reference in New Issue
Block a user