From df067571249e391bf3d94a0481335a8b64594f09 Mon Sep 17 00:00:00 2001 From: Nav Date: Sat, 7 Sep 2024 13:07:40 +0100 Subject: [PATCH] Activate target before calling `Target::targetDescriptor()` --- src/TargetController/TargetControllerComponent.cpp | 3 ++- src/Targets/Target.hpp | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/TargetController/TargetControllerComponent.cpp b/src/TargetController/TargetControllerComponent.cpp index afab195e..95742ac3 100644 --- a/src/TargetController/TargetControllerComponent.cpp +++ b/src/TargetController/TargetControllerComponent.cpp @@ -513,11 +513,12 @@ namespace TargetController } this->target->setDebugTool(this->debugTool.get()); - this->targetDescriptor = std::make_unique(this->target->targetDescriptor()); Logger::info("Activating target"); this->target->activate(); Logger::info("Target activated"); + + this->targetDescriptor = std::make_unique(this->target->targetDescriptor()); Logger::info("Target name: " + this->targetDescriptor->name); this->target->postActivate(); diff --git a/src/Targets/Target.hpp b/src/Targets/Target.hpp index 27d2a508..08118f96 100644 --- a/src/Targets/Target.hpp +++ b/src/Targets/Target.hpp @@ -85,7 +85,10 @@ namespace Targets virtual void postActivate() = 0; /** - * Should generate a TargetDescriptor for the current target. + * Should generate a TargetDescriptor for the target. + * + * This function is called shortly after target activation, allowing for information that was obtained via + * probing/discovery to be used in the target descriptor. * * @return */