diff --git a/VortexEngine/src/Menus/MenuList/EditorConnection.cpp b/VortexEngine/src/Menus/MenuList/EditorConnection.cpp index 5cbd6cf04b..09e44f8a5f 100644 --- a/VortexEngine/src/Menus/MenuList/EditorConnection.cpp +++ b/VortexEngine/src/Menus/MenuList/EditorConnection.cpp @@ -16,7 +16,8 @@ EditorConnection::EditorConnection(const RGBColor &col, bool advanced) : Menu(col, advanced), - m_state(STATE_DISCONNECTED) + m_state(STATE_DISCONNECTED), + m_allowReset(true) { } @@ -57,6 +58,8 @@ bool EditorConnection::receiveMessage(const char *message) if (m_receiveBuffer.unserializerAtEnd()) { m_receiveBuffer.clear(); } + // we have now received at least one command, do not allow resetting + m_allowReset = false; return true; } @@ -202,10 +205,16 @@ void EditorConnection::sendCurModeVL() // handlers for clicks void EditorConnection::onShortClick() { + // if the device has received any commands do not reset! + if (!m_allowReset) { + return; + } // reset, this won't actually disconnect the com port m_state = STATE_DISCONNECTED; // clear the demo clearDemo(); + // sent a reset, do not allow another + m_allowReset = false; } void EditorConnection::onShortClick2() diff --git a/VortexEngine/src/Menus/MenuList/EditorConnection.h b/VortexEngine/src/Menus/MenuList/EditorConnection.h index 5c6e7b652c..5c49c01cb6 100644 --- a/VortexEngine/src/Menus/MenuList/EditorConnection.h +++ b/VortexEngine/src/Menus/MenuList/EditorConnection.h @@ -74,6 +74,8 @@ class EditorConnection : public Menu EditorConnectionState m_state; // the data that is received ByteStream m_receiveBuffer; + // Whether at least one command has been received yet + bool m_allowReset; }; #endif