diff --git a/src/device.rs b/src/device.rs index 61ebc92..919790f 100644 --- a/src/device.rs +++ b/src/device.rs @@ -122,11 +122,12 @@ impl Device { mac_address: MacAddress, tx: mpsc::UnboundedSender, pica_tx: mpsc::Sender, + is_reset: bool, ) -> Self { Device { handle, mac_address, - is_reset: false, + is_reset, config: Default::default(), state: DeviceState::DeviceStateError, // Will be overwitten sessions: Default::default(), @@ -225,6 +226,7 @@ impl Device { self.mac_address, self.tx.clone(), self.pica_tx.clone(), + false, ); self.is_reset = true; self.init(); diff --git a/src/lib.rs b/src/lib.rs index 560f28d..7c0ff9d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -355,7 +355,13 @@ impl Pica { log::debug!("[{}] Connecting device", handle); let mac_address = MacAddress::Short((handle as u16).to_be_bytes()); - let mut device = Device::new(handle, mac_address, packet_tx, self.command_tx.clone()); + let mut device = Device::new( + handle, + mac_address, + packet_tx, + self.command_tx.clone(), + true, + ); device.init(); self.send_event(PicaEvent::Connected {