From 7ba997572a9e20ff831ccce4df1ae4f6fb312c6b Mon Sep 17 00:00:00 2001 From: Nav Date: Sat, 23 Apr 2022 17:30:14 +0100 Subject: [PATCH] Fixed bug with Insight GUI failing to properly process the TargetExecutionResumed event --- src/Insight/InsightWorker/InsightWorker.cpp | 7 +++++++ src/Insight/InsightWorker/InsightWorker.hpp | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/Insight/InsightWorker/InsightWorker.cpp b/src/Insight/InsightWorker/InsightWorker.cpp index e9e337d2..27b84162 100644 --- a/src/Insight/InsightWorker/InsightWorker.cpp +++ b/src/Insight/InsightWorker/InsightWorker.cpp @@ -72,6 +72,10 @@ namespace Bloom } void InsightWorker::onTargetStoppedEvent(const Events::TargetExecutionStopped& event) { + if (this->lastTargetState == TargetState::STOPPED) { + return; + } + /* * When we report a target halt to Insight, Insight will immediately seek more data from the target (such as * GPIO pin states). This can be problematic for cases where the target had halted due to a conditional @@ -99,17 +103,20 @@ namespace Bloom ); if (!resumedEvent.has_value()) { + this->lastTargetState = TargetState::STOPPED; emit this->targetStateUpdated(TargetState::STOPPED); emit this->targetProgramCounterUpdated(event.programCounter); } } void InsightWorker::onTargetResumedEvent(const Events::TargetExecutionResumed& event) { + this->lastTargetState = TargetState::RUNNING; emit this->targetStateUpdated(TargetState::RUNNING); } void InsightWorker::onTargetResetEvent(const Events::TargetReset& event) { // TODO: Pull PC from target. This will be done as part of the TC refactor (https://github.com/navnavnav/Bloom/issues/25) + this->lastTargetState = TargetState::STOPPED; emit this->targetStateUpdated(TargetState::STOPPED); emit this->targetProgramCounterUpdated(0); } diff --git a/src/Insight/InsightWorker/InsightWorker.hpp b/src/Insight/InsightWorker/InsightWorker.hpp index 3dc1a78e..61b4e81e 100644 --- a/src/Insight/InsightWorker/InsightWorker.hpp +++ b/src/Insight/InsightWorker/InsightWorker.hpp @@ -55,6 +55,8 @@ namespace Bloom TargetController::TargetControllerState lastTargetControllerState = TargetController::TargetControllerState::ACTIVE; + Targets::TargetState lastTargetState = Targets::TargetState::UNKNOWN; + QTimer* eventDispatchTimer = nullptr; SyncSafe> queuedTasks;