diff --git a/src/wx/DfuPanel.cpp b/src/wx/DfuPanel.cpp index 3ae886e..3763bf7 100644 --- a/src/wx/DfuPanel.cpp +++ b/src/wx/DfuPanel.cpp @@ -160,6 +160,7 @@ void DfuPanel::SetDeviceState(const DeviceState& state) m_index = m_sequence.steps.size(); m_stepRemaining = -1; m_actionExecutedIndex = -1; + m_waitingForDfuTransition = true; const wxColour inactive = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT); @@ -191,8 +192,11 @@ void DfuPanel::SetDeviceState(const DeviceState& state) GetMainFrame()->ShowMain(); } - if (!m_isEnteringDfu && !state.connected) + if (!state.connected) { + if (m_isEnteringDfu || m_waitingForDfuTransition) + return; + m_isEnteringDfu = false; m_backButton->Enable(); m_startButton->Enable(); @@ -362,6 +366,7 @@ void DfuPanel::StartSequence(const DfuSequence& seq) m_index = 0; m_stepRemaining = -1; m_actionExecutedIndex = -1; + m_waitingForDfuTransition = false; RunStep(); } diff --git a/src/wx/DfuPanel.hpp b/src/wx/DfuPanel.hpp index 63b453e..4b603d4 100644 --- a/src/wx/DfuPanel.hpp +++ b/src/wx/DfuPanel.hpp @@ -62,6 +62,7 @@ private: wxTimer m_timer; wxTimer m_stagnentTimer; bool m_isEnteringDfu = false; + bool m_waitingForDfuTransition = false; wxPanel* m_devicePanel = nullptr; wxStaticBitmap* m_deviceImage = nullptr;