Skip to content

Commit 3ac994f

Browse files
committed
Dumb
1 parent 4088316 commit 3ac994f

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

espflash/src/connection/mod.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl Connection {
145145
}
146146

147147
/// Initialize a connection with a device
148-
pub fn begin(&mut self) -> Result<bool, Error> {
148+
pub fn begin(&mut self) -> Result<(), Error> {
149149
let port_name = self.serial.name().unwrap_or_default();
150150
let reset_sequence = construct_reset_strategy_sequence(
151151
&port_name,
@@ -156,14 +156,7 @@ impl Connection {
156156
for (_, reset_strategy) in zip(0..MAX_CONNECT_ATTEMPTS, reset_sequence.iter().cycle()) {
157157
match self.connect_attempt(reset_strategy) {
158158
Ok(_) => {
159-
match self.read_reg(crate::flasher::stubs::CHIP_DETECT_MAGIC_REG_ADDR) {
160-
Ok(_) => return Ok(false),
161-
Err(_) => {
162-
log::warn!("Secure Download Mode is enabled on this chip");
163-
self.secure_download_mode = true;
164-
return Ok(true);
165-
}
166-
};
159+
return Ok(());
167160
}
168161
Err(e) => {
169162
debug!("Failed to reset, error {:#?}, retrying", e);

espflash/src/flasher/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ impl Flasher {
674674
// Establish a connection to the device using the default baud rate of 115,200
675675
// and timeout of 3 seconds.
676676
let mut connection = Connection::new(serial, port_info, after_operation, before_operation);
677-
let sdm = connection.begin()?;
677+
connection.begin()?;
678678
connection.set_timeout(DEFAULT_TIMEOUT)?;
679679

680680
let detected_chip = if before_operation != ResetBeforeOperation::NoResetNoSync {
@@ -696,6 +696,8 @@ impl Flasher {
696696
return Err(Error::ChipNotProvided);
697697
};
698698

699+
let sdm = connection.secure_download_mode;
700+
699701
let mut flasher = Flasher {
700702
connection,
701703
chip: detected_chip,

0 commit comments

Comments
 (0)