Fixed bug with Insight GUI failing to properly process the TargetExecutionResumed event

This commit is contained in:
Nav
2022-04-23 17:30:14 +01:00
parent a52f114b78
commit 7ba997572a
2 changed files with 9 additions and 0 deletions

View File

@@ -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);
}

View File

@@ -55,6 +55,8 @@ namespace Bloom
TargetController::TargetControllerState lastTargetControllerState =
TargetController::TargetControllerState::ACTIVE;
Targets::TargetState lastTargetState = Targets::TargetState::UNKNOWN;
QTimer* eventDispatchTimer = nullptr;
SyncSafe<std::queue<InsightWorkerTask*>> queuedTasks;