Insight handling of TC suspension
This commit is contained in:
@@ -55,17 +55,20 @@ void Insight::startup() {
|
|||||||
|
|
||||||
this->application = new QApplication(this->qtApplicationArgc, this->qtApplicationArgv.data());
|
this->application = new QApplication(this->qtApplicationArgc, this->qtApplicationArgv.data());
|
||||||
this->application->setQuitOnLastWindowClosed(true);
|
this->application->setQuitOnLastWindowClosed(true);
|
||||||
|
qRegisterMetaType<Bloom::Targets::TargetDescriptor>();
|
||||||
qRegisterMetaType<Bloom::Targets::TargetPinDescriptor>();
|
qRegisterMetaType<Bloom::Targets::TargetPinDescriptor>();
|
||||||
qRegisterMetaType<Bloom::Targets::TargetPinState>();
|
qRegisterMetaType<Bloom::Targets::TargetPinState>();
|
||||||
qRegisterMetaType<Bloom::Targets::TargetState>();
|
qRegisterMetaType<Bloom::Targets::TargetState>();
|
||||||
qRegisterMetaType<std::map<int, Bloom::Targets::TargetPinState>>();
|
qRegisterMetaType<std::map<int, Bloom::Targets::TargetPinState>>();
|
||||||
|
|
||||||
|
this->mainWindow.setInsightConfig(this->insightConfig);
|
||||||
|
this->mainWindow.setEnvironmentConfig(this->environmentConfig);
|
||||||
|
|
||||||
this->mainWindow.init(
|
this->mainWindow.init(
|
||||||
*(this->application),
|
*(this->application),
|
||||||
targetDescriptor,
|
targetDescriptor
|
||||||
this->insightConfig,
|
|
||||||
this->environmentConfig.targetConfig
|
|
||||||
);
|
);
|
||||||
|
|
||||||
this->mainWindow.show();
|
this->mainWindow.show();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -87,6 +90,8 @@ void Insight::startup() {
|
|||||||
connect(this->workerThread, &QThread::finished, worker, &QObject::deleteLater);
|
connect(this->workerThread, &QThread::finished, worker, &QObject::deleteLater);
|
||||||
connect(this->workerThread, &QThread::finished, this->workerThread, &QThread::deleteLater);
|
connect(this->workerThread, &QThread::finished, this->workerThread, &QThread::deleteLater);
|
||||||
|
|
||||||
|
connect(worker, &InsightWorker::targetControllerSuspended, &(this->mainWindow), &InsightWindow::onTargetControllerSuspended);
|
||||||
|
connect(worker, &InsightWorker::targetControllerResumed, &(this->mainWindow), &InsightWindow::onTargetControllerResumed);
|
||||||
connect(worker, &InsightWorker::targetStateUpdated, &(this->mainWindow), &InsightWindow::onTargetStateUpdate);
|
connect(worker, &InsightWorker::targetStateUpdated, &(this->mainWindow), &InsightWindow::onTargetStateUpdate);
|
||||||
connect(worker, &InsightWorker::targetProgramCounterUpdated, &(this->mainWindow), &InsightWindow::onTargetProgramCounterUpdate);
|
connect(worker, &InsightWorker::targetProgramCounterUpdated, &(this->mainWindow), &InsightWindow::onTargetProgramCounterUpdate);
|
||||||
connect(worker, &InsightWorker::targetPinStatesUpdated, &(this->mainWindow), &InsightWindow::onTargetPinStatesUpdate);
|
connect(worker, &InsightWorker::targetPinStatesUpdated, &(this->mainWindow), &InsightWindow::onTargetPinStatesUpdate);
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ void InsightWorker::startup() {
|
|||||||
Logger::debug("Starting InsightWorker thread");
|
Logger::debug("Starting InsightWorker thread");
|
||||||
this->eventManager.registerListener(this->eventListener);
|
this->eventManager.registerListener(this->eventListener);
|
||||||
|
|
||||||
|
this->eventListener->registerCallbackForEventType<TargetControllerStateReported>(
|
||||||
|
std::bind(&InsightWorker::onTargetControllerStateReported, this, std::placeholders::_1)
|
||||||
|
);
|
||||||
|
|
||||||
this->eventListener->registerCallbackForEventType<TargetExecutionStopped>(
|
this->eventListener->registerCallbackForEventType<TargetExecutionStopped>(
|
||||||
std::bind(&InsightWorker::onTargetStoppedEvent, this, std::placeholders::_1)
|
std::bind(&InsightWorker::onTargetStoppedEvent, this, std::placeholders::_1)
|
||||||
);
|
);
|
||||||
@@ -100,4 +104,21 @@ void InsightWorker::onTargetIoPortsUpdatedEvent(EventPointer<TargetIoPortsUpdate
|
|||||||
emit this->targetIoPortsUpdated();
|
emit this->targetIoPortsUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InsightWorker::onTargetControllerStateReported(EventPointer<TargetControllerStateReported> event) {
|
||||||
|
if (this->lastTargetControllerState == TargetControllerState::ACTIVE
|
||||||
|
&& event->state == TargetControllerState::SUSPENDED
|
||||||
|
) {
|
||||||
|
emit this->targetControllerSuspended();
|
||||||
|
|
||||||
|
} else if (this->lastTargetControllerState == TargetControllerState::SUSPENDED
|
||||||
|
&& event->state == TargetControllerState::ACTIVE
|
||||||
|
) {
|
||||||
|
try {
|
||||||
|
emit this->targetControllerResumed(this->targetControllerConsole.getTargetDescriptor());
|
||||||
|
|
||||||
|
} catch (const Exception& exception) {
|
||||||
|
Logger::error("Insight resume failed - " + exception.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this->lastTargetControllerState = event->state;
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "src/EventManager/EventManager.hpp"
|
#include "src/EventManager/EventManager.hpp"
|
||||||
#include "src/EventManager/EventListener.hpp"
|
#include "src/EventManager/EventListener.hpp"
|
||||||
#include "src/TargetController/TargetControllerConsole.hpp"
|
#include "src/TargetController/TargetControllerConsole.hpp"
|
||||||
|
#include "src/TargetController/TargetControllerState.hpp"
|
||||||
|
|
||||||
namespace Bloom
|
namespace Bloom
|
||||||
{
|
{
|
||||||
@@ -28,12 +29,15 @@ namespace Bloom
|
|||||||
*(this->eventListener)
|
*(this->eventListener)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
TargetControllerState lastTargetControllerState = TargetControllerState::ACTIVE;
|
||||||
|
|
||||||
QTimer* eventDispatchTimer = nullptr;
|
QTimer* eventDispatchTimer = nullptr;
|
||||||
|
|
||||||
void onTargetStoppedEvent(Events::EventPointer<Events::TargetExecutionStopped> event);
|
void onTargetStoppedEvent(Events::EventPointer<Events::TargetExecutionStopped> event);
|
||||||
void onTargetResumedEvent(Events::EventPointer<Events::TargetExecutionResumed> event);
|
void onTargetResumedEvent(Events::EventPointer<Events::TargetExecutionResumed> event);
|
||||||
void onTargetPinStatesRetrievedEvent(Events::EventPointer<Events::TargetPinStatesRetrieved> event);
|
void onTargetPinStatesRetrievedEvent(Events::EventPointer<Events::TargetPinStatesRetrieved> event);
|
||||||
void onTargetIoPortsUpdatedEvent(Events::EventPointer<Events::TargetIoPortsUpdated> event);
|
void onTargetIoPortsUpdatedEvent(Events::EventPointer<Events::TargetIoPortsUpdated> event);
|
||||||
|
void onTargetControllerStateReported(Events::EventPointer<Events::TargetControllerStateReported> event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
InsightWorker(EventManager& eventManager): eventManager(eventManager) {};
|
InsightWorker(EventManager& eventManager): eventManager(eventManager) {};
|
||||||
@@ -56,6 +60,8 @@ namespace Bloom
|
|||||||
void targetProgramCounterUpdated(quint32 programCounter);
|
void targetProgramCounterUpdated(quint32 programCounter);
|
||||||
void targetPinStatesUpdated(int variantId, Bloom::Targets::TargetPinStateMappingType pinStatesByNumber);
|
void targetPinStatesUpdated(int variantId, Bloom::Targets::TargetPinStateMappingType pinStatesByNumber);
|
||||||
void targetIoPortsUpdated();
|
void targetIoPortsUpdated();
|
||||||
|
void targetControllerSuspended();
|
||||||
|
void targetControllerResumed(const Bloom::Targets::TargetDescriptor& targetDescriptor);
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,7 @@ using Bloom::Targets::TargetPackage;
|
|||||||
|
|
||||||
void InsightWindow::init(
|
void InsightWindow::init(
|
||||||
QApplication& application,
|
QApplication& application,
|
||||||
TargetDescriptor targetDescriptor,
|
TargetDescriptor targetDescriptor
|
||||||
const InsightConfig& config,
|
|
||||||
const TargetConfig& targetConfig
|
|
||||||
) {
|
) {
|
||||||
this->targetDescriptor = targetDescriptor;
|
this->targetDescriptor = targetDescriptor;
|
||||||
|
|
||||||
@@ -44,7 +42,7 @@ void InsightWindow::init(
|
|||||||
|
|
||||||
application.setWindowIcon(QIcon(":/compiled/Insight/UserInterfaces/InsightWindow/Images/BloomIcon.svg"));
|
application.setWindowIcon(QIcon(":/compiled/Insight/UserInterfaces/InsightWindow/Images/BloomIcon.svg"));
|
||||||
this->ioContainerWidget = this->mainWindowWidget->findChild<QWidget*>("io-container");
|
this->ioContainerWidget = this->mainWindowWidget->findChild<QWidget*>("io-container");
|
||||||
this->ioUnavailableWidget = this->mainWindowWidget->findChild<QWidget*>("io-inspection-unavailable");
|
this->ioUnavailableWidget = this->mainWindowWidget->findChild<QLabel*>("io-inspection-unavailable");
|
||||||
this->mainMenuBar = this->mainWindowWidget->findChild<QMenuBar*>("menu-bar");
|
this->mainMenuBar = this->mainWindowWidget->findChild<QMenuBar*>("menu-bar");
|
||||||
|
|
||||||
auto fileMenu = this->mainMenuBar->findChild<QMenu*>("file-menu");
|
auto fileMenu = this->mainMenuBar->findChild<QMenu*>("file-menu");
|
||||||
@@ -70,67 +68,10 @@ void InsightWindow::init(
|
|||||||
});
|
});
|
||||||
|
|
||||||
this->footer = this->mainWindowWidget->findChild<QWidget*>("footer");
|
this->footer = this->mainWindowWidget->findChild<QWidget*>("footer");
|
||||||
auto targetNameLabel = this->footer->findChild<QLabel*>("target-name");
|
|
||||||
auto targetIdLabel = this->footer->findChild<QLabel*>("target-id");
|
|
||||||
this->targetStatusLabel = this->footer->findChild<QLabel*>("target-state");
|
this->targetStatusLabel = this->footer->findChild<QLabel*>("target-state");
|
||||||
this->programCounterValueLabel = this->footer->findChild<QLabel*>("target-program-counter-value");
|
this->programCounterValueLabel = this->footer->findChild<QLabel*>("target-program-counter-value");
|
||||||
targetNameLabel->setText(QString::fromStdString(this->targetDescriptor.name));
|
|
||||||
targetIdLabel->setText("0x" + QString::fromStdString(this->targetDescriptor.id).remove("0x").toUpper());
|
|
||||||
|
|
||||||
this->variantMenu = this->footer->findChild<QMenu*>("target-variant-menu");
|
this->activate();
|
||||||
|
|
||||||
for (const auto& targetVariant: this->targetDescriptor.variants) {
|
|
||||||
auto variantAction = new QAction(this->variantMenu);
|
|
||||||
variantAction->setText(
|
|
||||||
QString::fromStdString(targetVariant.name + " (" + targetVariant.packageName + ")")
|
|
||||||
);
|
|
||||||
|
|
||||||
if (this->isVariantSupported(targetVariant)) {
|
|
||||||
this->supportedVariantsByName.insert(
|
|
||||||
std::pair(QString::fromStdString(targetVariant.name).toLower().toStdString(), targetVariant)
|
|
||||||
);
|
|
||||||
|
|
||||||
connect(
|
|
||||||
variantAction,
|
|
||||||
&QAction::triggered,
|
|
||||||
this,
|
|
||||||
[this, &targetVariant] {
|
|
||||||
this->selectVariant(&targetVariant);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
variantAction->setEnabled(false);
|
|
||||||
variantAction->setText(variantAction->text() + " (unsupported)");
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
this->variantMenu->addAction(variantAction);
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger::debug("Number of target variants supported by Insight: " + std::to_string(supportedVariantsByName.size()));
|
|
||||||
|
|
||||||
if (!this->supportedVariantsByName.empty()) {
|
|
||||||
if (!targetConfig.variantName.empty() && this->supportedVariantsByName.contains(targetConfig.variantName)) {
|
|
||||||
// The user has specified a valid variant name in their config file, so use that as the default
|
|
||||||
this->selectVariant(&(this->supportedVariantsByName.at(targetConfig.variantName)));
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if (!targetConfig.variantName.empty()) {
|
|
||||||
Logger::error("Invalid target variant name \"" + targetConfig.variantName
|
|
||||||
+ "\" - no such variant with the given name was found.");
|
|
||||||
}
|
|
||||||
|
|
||||||
this->selectVariant(&(this->supportedVariantsByName.begin()->second));
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if (this->targetDescriptor.variants.empty()) {
|
|
||||||
this->variantMenu->parentWidget()->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
this->ioUnavailableWidget->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do not delete svgWidget. It seems like it's absolutely pointless, but it's really not. I know this is gross but
|
* Do not delete svgWidget. It seems like it's absolutely pointless, but it's really not. I know this is gross but
|
||||||
@@ -155,6 +96,134 @@ void InsightWindow::init(
|
|||||||
auto svgWidget = QSvgWidget();
|
auto svgWidget = QSvgWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InsightWindow::activate() {
|
||||||
|
auto targetNameLabel = this->footer->findChild<QLabel*>("target-name");
|
||||||
|
auto targetIdLabel = this->footer->findChild<QLabel*>("target-id");
|
||||||
|
targetNameLabel->setText(QString::fromStdString(this->targetDescriptor.name));
|
||||||
|
targetIdLabel->setText("0x" + QString::fromStdString(this->targetDescriptor.id).remove("0x").toUpper());
|
||||||
|
this->variantMenu = this->footer->findChild<QMenu*>("target-variant-menu");
|
||||||
|
|
||||||
|
this->ioUnavailableWidget->hide();
|
||||||
|
|
||||||
|
std::optional<QString> previouslySelectedVariantName;
|
||||||
|
if (this->selectedVariant != nullptr) {
|
||||||
|
previouslySelectedVariantName = QString::fromStdString(this->selectedVariant->name).toLower();
|
||||||
|
this->selectedVariant = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->supportedVariantsByName.clear();
|
||||||
|
|
||||||
|
for (const auto& targetVariant: this->targetDescriptor.variants) {
|
||||||
|
auto variantAction = new QAction(this->variantMenu);
|
||||||
|
variantAction->setText(
|
||||||
|
QString::fromStdString(targetVariant.name + " (" + targetVariant.packageName + ")")
|
||||||
|
);
|
||||||
|
|
||||||
|
if (this->isVariantSupported(targetVariant)) {
|
||||||
|
auto supportedVariantPtr = &(this->supportedVariantsByName.insert(
|
||||||
|
std::pair(QString::fromStdString(targetVariant.name).toLower(), targetVariant)
|
||||||
|
).first->second);
|
||||||
|
|
||||||
|
connect(
|
||||||
|
variantAction,
|
||||||
|
&QAction::triggered,
|
||||||
|
this,
|
||||||
|
[this, supportedVariantPtr] {
|
||||||
|
this->selectVariant(supportedVariantPtr);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
variantAction->setEnabled(false);
|
||||||
|
variantAction->setText(variantAction->text() + " (unsupported)");
|
||||||
|
}
|
||||||
|
|
||||||
|
this->variantMenu->addAction(variantAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->variantMenu->setEnabled(true);
|
||||||
|
|
||||||
|
Logger::debug("Number of target variants supported by Insight: " + std::to_string(supportedVariantsByName.size()));
|
||||||
|
|
||||||
|
if (!this->supportedVariantsByName.empty()) {
|
||||||
|
if (previouslySelectedVariantName.has_value()
|
||||||
|
&& this->supportedVariantsByName.contains(previouslySelectedVariantName.value())
|
||||||
|
) {
|
||||||
|
this->selectVariant(&(this->supportedVariantsByName.at(previouslySelectedVariantName.value())));
|
||||||
|
|
||||||
|
} else if (this->targetConfig.variantName.has_value()) {
|
||||||
|
auto selectedVariantName = QString::fromStdString(this->targetConfig.variantName.value());
|
||||||
|
if (this->supportedVariantsByName.contains(selectedVariantName)) {
|
||||||
|
// The user has specified a valid variant name in their config file, so use that as the default
|
||||||
|
this->selectVariant(&(this->supportedVariantsByName.at(selectedVariantName)));
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (this->targetConfig.variantName.has_value()) {
|
||||||
|
Logger::error("Invalid target variant name \"" + this->targetConfig.variantName.value()
|
||||||
|
+ "\" - no such variant with the given name was found.");
|
||||||
|
}
|
||||||
|
|
||||||
|
this->selectVariant(&(this->supportedVariantsByName.begin()->second));
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (this->targetDescriptor.variants.empty()) {
|
||||||
|
this->variantMenu->parentWidget()->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
this->ioUnavailableWidget->setText(
|
||||||
|
"GPIO inspection is not available for this target. "
|
||||||
|
"Please report this to Bloom developers by clicking Help -> Report An Issue"
|
||||||
|
);
|
||||||
|
this->ioUnavailableWidget->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
this->toggleUi(this->targetState != TargetState::STOPPED);
|
||||||
|
this->activated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InsightWindow::deactivate() {
|
||||||
|
if (this->targetPackageWidget != nullptr) {
|
||||||
|
this->targetPackageWidget->hide();
|
||||||
|
this->targetPackageWidget->deleteLater();
|
||||||
|
this->targetPackageWidget = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->ioUnavailableWidget->setText(
|
||||||
|
"Insight deactivated - Bloom has been disconnected from the target.\n"
|
||||||
|
"Bloom will attempt to reconnect upon the start of a debug session."
|
||||||
|
);
|
||||||
|
this->ioUnavailableWidget->show();
|
||||||
|
|
||||||
|
this->targetStatusLabel->setText("Unknown");
|
||||||
|
this->programCounterValueLabel->setText("-");
|
||||||
|
|
||||||
|
this->variantMenu->clear();
|
||||||
|
this->variantMenu->setEnabled(false);
|
||||||
|
|
||||||
|
this->toggleUi(true);
|
||||||
|
this->activated = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool InsightWindow::isVariantSupported(const TargetVariant& variant) {
|
||||||
|
if (variant.package == TargetPackage::DIP) {
|
||||||
|
// All DIP variants must have a pin count that is a multiple of two
|
||||||
|
if (variant.pinDescriptorsByNumber.size() % 2 == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (variant.package == TargetPackage::QFP) {
|
||||||
|
// All QFP variants must have a pin count that is a multiple of four
|
||||||
|
if (variant.pinDescriptorsByNumber.size() % 4 == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void InsightWindow::selectVariant(const TargetVariant* variant) {
|
void InsightWindow::selectVariant(const TargetVariant* variant) {
|
||||||
if (!this->isVariantSupported(*variant)) {
|
if (!this->isVariantSupported(*variant)) {
|
||||||
Logger::error("Attempted to select unsupported target variant.");
|
Logger::error("Attempted to select unsupported target variant.");
|
||||||
@@ -168,6 +237,7 @@ void InsightWindow::selectVariant(const TargetVariant* variant) {
|
|||||||
if (this->targetPackageWidget != nullptr) {
|
if (this->targetPackageWidget != nullptr) {
|
||||||
this->targetPackageWidget->hide();
|
this->targetPackageWidget->hide();
|
||||||
this->targetPackageWidget->deleteLater();
|
this->targetPackageWidget->deleteLater();
|
||||||
|
this->targetPackageWidget = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->selectedVariant = variant;
|
this->selectedVariant = variant;
|
||||||
@@ -209,22 +279,31 @@ void InsightWindow::close() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InsightWindow::isVariantSupported(const TargetVariant& variant) {
|
void InsightWindow::toggleUi(bool disable) {
|
||||||
if (variant.package == TargetPackage::DIP) {
|
this->uiDisabled = disable;
|
||||||
// All DIP variants must have a pin count that is a multiple of two
|
|
||||||
if (variant.pinDescriptorsByNumber.size() % 2 == 0) {
|
if (this->refreshIoInspectionButton != nullptr) {
|
||||||
return true;
|
this->refreshIoInspectionButton->setDisabled(disable);
|
||||||
}
|
this->refreshIoInspectionButton->repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (variant.package == TargetPackage::QFP) {
|
if (this->ioContainerWidget != nullptr) {
|
||||||
// All QFP variants must have a pin count that is a multiple of four
|
this->ioContainerWidget->setDisabled(disable);
|
||||||
if (variant.pinDescriptorsByNumber.size() % 4 == 0) {
|
this->ioContainerWidget->repaint();
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
void InsightWindow::onTargetControllerSuspended() {
|
||||||
|
if (this->activated) {
|
||||||
|
this->deactivate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void InsightWindow::onTargetControllerResumed(const TargetDescriptor& targetDescriptor) {
|
||||||
|
if (!this->activated) {
|
||||||
|
this->targetDescriptor = targetDescriptor;
|
||||||
|
this->activate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InsightWindow::openReportIssuesUrl() {
|
void InsightWindow::openReportIssuesUrl() {
|
||||||
@@ -324,4 +403,4 @@ void InsightWindow::togglePinIoState(TargetPinWidget* pinWidget) {
|
|||||||
TargetPinState::IoState::LOW : TargetPinState::IoState::HIGH;
|
TargetPinState::IoState::LOW : TargetPinState::IoState::HIGH;
|
||||||
emit this->setTargetPinState(this->selectedVariant->id, pinDescriptor, pinState.value());
|
emit this->setTargetPinState(this->selectedVariant->id, pinDescriptor, pinState.value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,12 @@ namespace Bloom
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
|
InsightConfig insightConfig;
|
||||||
|
EnvironmentConfig environmentConfig;
|
||||||
|
TargetConfig targetConfig;
|
||||||
|
|
||||||
|
bool activated = false;
|
||||||
|
|
||||||
Targets::TargetDescriptor targetDescriptor;
|
Targets::TargetDescriptor targetDescriptor;
|
||||||
Targets::TargetState targetState = Targets::TargetState::UNKNOWN;
|
Targets::TargetState targetState = Targets::TargetState::UNKNOWN;
|
||||||
|
|
||||||
@@ -31,14 +37,14 @@ namespace Bloom
|
|||||||
QToolButton* refreshIoInspectionButton = nullptr;
|
QToolButton* refreshIoInspectionButton = nullptr;
|
||||||
|
|
||||||
QWidget* ioContainerWidget = nullptr;
|
QWidget* ioContainerWidget = nullptr;
|
||||||
QWidget* ioUnavailableWidget = nullptr;
|
QLabel* ioUnavailableWidget = nullptr;
|
||||||
InsightTargetWidgets::TargetPackageWidget* targetPackageWidget = nullptr;
|
InsightTargetWidgets::TargetPackageWidget* targetPackageWidget = nullptr;
|
||||||
|
|
||||||
QWidget* footer = nullptr;
|
QWidget* footer = nullptr;
|
||||||
QLabel* targetStatusLabel = nullptr;
|
QLabel* targetStatusLabel = nullptr;
|
||||||
QLabel* programCounterValueLabel = nullptr;
|
QLabel* programCounterValueLabel = nullptr;
|
||||||
|
|
||||||
std::map<std::string, Targets::TargetVariant> supportedVariantsByName;
|
std::map<QString, Targets::TargetVariant> supportedVariantsByName;
|
||||||
const Targets::TargetVariant* selectedVariant = nullptr;
|
const Targets::TargetVariant* selectedVariant = nullptr;
|
||||||
bool uiDisabled = false;
|
bool uiDisabled = false;
|
||||||
|
|
||||||
@@ -46,33 +52,32 @@ namespace Bloom
|
|||||||
|
|
||||||
void selectVariant(const Targets::TargetVariant* variant);
|
void selectVariant(const Targets::TargetVariant* variant);
|
||||||
|
|
||||||
void toggleUi(bool disable) {
|
void toggleUi(bool disable);
|
||||||
this->uiDisabled = disable;
|
void activate();
|
||||||
|
void deactivate();
|
||||||
if (this->refreshIoInspectionButton != nullptr) {
|
|
||||||
this->refreshIoInspectionButton->setDisabled(disable);
|
|
||||||
this->refreshIoInspectionButton->repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->ioContainerWidget != nullptr) {
|
|
||||||
this->ioContainerWidget->setDisabled(disable);
|
|
||||||
this->ioContainerWidget->repaint();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
InsightWindow() = default;
|
InsightWindow() = default;
|
||||||
|
|
||||||
|
void setEnvironmentConfig(const EnvironmentConfig& environmentConfig) {
|
||||||
|
this->environmentConfig = environmentConfig;
|
||||||
|
this->targetConfig = environmentConfig.targetConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setInsightConfig(const InsightConfig& insightConfig) {
|
||||||
|
this->insightConfig = insightConfig;
|
||||||
|
}
|
||||||
|
|
||||||
void init(
|
void init(
|
||||||
QApplication& application,
|
QApplication& application,
|
||||||
Targets::TargetDescriptor targetDescriptor,
|
Targets::TargetDescriptor targetDescriptor
|
||||||
const InsightConfig& config,
|
|
||||||
const TargetConfig& targetConfig
|
|
||||||
);
|
);
|
||||||
|
|
||||||
void show();
|
void show();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void onTargetControllerSuspended();
|
||||||
|
void onTargetControllerResumed(const Bloom::Targets::TargetDescriptor& targetDescriptor);
|
||||||
void onTargetPinStatesUpdate(int variantId, Bloom::Targets::TargetPinStateMappingType pinStatesByNumber);
|
void onTargetPinStatesUpdate(int variantId, Bloom::Targets::TargetPinStateMappingType pinStatesByNumber);
|
||||||
void onTargetStateUpdate(Targets::TargetState newState);
|
void onTargetStateUpdate(Targets::TargetState newState);
|
||||||
void onTargetProgramCounterUpdate(quint32 programCounter);
|
void onTargetProgramCounterUpdate(quint32 programCounter);
|
||||||
|
|||||||
@@ -188,3 +188,7 @@ QToolTip {
|
|||||||
#target-variant-menu::item {
|
#target-variant-menu::item {
|
||||||
padding: 4px 10px 4px 10px;
|
padding: 4px 10px 4px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#io-inspection-unavailable {
|
||||||
|
color: #838386;
|
||||||
|
}
|
||||||
|
|||||||
@@ -88,8 +88,11 @@
|
|||||||
<item alignment="Qt::AlignHCenter">
|
<item alignment="Qt::AlignHCenter">
|
||||||
<widget class="QLabel" name="io-inspection-unavailable">
|
<widget class="QLabel" name="io-inspection-unavailable">
|
||||||
<property name="visible"><bool>false</bool></property>
|
<property name="visible"><bool>false</bool></property>
|
||||||
|
<property name="alignment">
|
||||||
|
<enum>Qt::AlignCenter</enum>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>IO inspection is not available for this target. Please report this to Bloom developers by clicking Help -> Report An Issue</string>
|
<string>-</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -186,4 +189,4 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
Reference in New Issue
Block a user