Skip to content

Commit

Permalink
feature: implemented some of the error msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
klonyyy committed Aug 23, 2023
1 parent 9853222 commit a8091d1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Gui/GuiSwoControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void Gui::drawStartButtonSwo()
ImGui::PushStyleColor(ImGuiCol_ButtonActive, color);
}

if (ImGui::Button(viewerStateMap.at(state).c_str(), ImVec2(-1, 50)))
if (ImGui::Button((viewerStateMap.at(state) + " " + tracePlotHandler->getLastReaderError()).c_str(), ImVec2(-1, 50)))
{
if (state == PlotHandlerBase::state::STOP)
{
Expand Down
13 changes: 9 additions & 4 deletions src/TraceReader/TraceReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ bool TraceReader::startAcqusition(std::array<bool, 32>& activeChannels)

if (traceDevice->startTrace(coreFrequency * 1000, tracePrescaler, activeChannelsMask))
{
lastErrorMsg = "";
isRunning = true;
readerHandle = std::thread(&TraceReader::readerThread, this);
return true;
Expand Down Expand Up @@ -273,21 +274,24 @@ void TraceReader::readerThread()

if (length < 0)
{
logger->error("CRITICAL ERROR");
lastErrorMsg = "Stlink trace critical error!";
logger->error(lastErrorMsg);

isRunning.store(false);
break;
}

if (sleepCycles > 1000)
{
logger->error("No trace registered for 1000 cycles!");
lastErrorMsg = "No trace registered for 1000 cycles!";
logger->error(lastErrorMsg);
isRunning.store(false);
break;
}

if (length == 0)
{
logger->info("SLEEP");
logger->info("sleep");
sleepCycles++;
logger->info("sleep cycles: {}", sleepCycles);
std::this_thread::sleep_for(std::chrono::microseconds(100));
Expand All @@ -296,7 +300,8 @@ void TraceReader::readerThread()

if (length == size)
{
logger->error("OVERFLOW");
lastErrorMsg = "Trace overflow!";
logger->error(lastErrorMsg);
isRunning.store(false);
continue;
}
Expand Down

0 comments on commit a8091d1

Please sign in to comment.