Skip to content

Commit

Permalink
fix: recroder setting is set per plot, not per group
Browse files Browse the repository at this point in the history
  • Loading branch information
klonyyy committed Dec 15, 2024
1 parent 8049b46 commit bba11ed
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 36 deletions.
17 changes: 0 additions & 17 deletions src/Gui/GuiGroupEdit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,6 @@ class GroupEditWindow
else
popup.show("Error!", "Group already exists!", 1.5f);
}

PlotGroup::Type groupType = editedGroup->getType();

GuiHelper::drawTextAlignedToSize("type:", alignment);
ImGui::SameLine();
ImGui::RadioButton("sampling", (int32_t*)(&groupType), 0);
ImGui::SameLine();
ImGui::RadioButton("recorder", (int32_t*)(&groupType), 1);
ImGui::SameLine();
ImGui::HelpMarker("A sampling group is sampled asynchonously in regular intervals without additional software on target's side. \r\n A recorder group is a group used for registering high frequency signals with predefined intervals. Recorder file and sampling function execution is needed for proper operation.");

if (groupType == PlotGroup::Type::RECORDER)
{
ImGui::Text("Recorder");
}

editedGroup->setType(groupType);
}

private:
Expand Down
29 changes: 29 additions & 0 deletions src/Gui/GuiPlotEdit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,35 @@ class PlotEditWindow
if (ImGui::Combo("##combo", &typeCombo, plotTypes, IM_ARRAYSIZE(plotTypes)))
editedPlot->setType((Plot::Type)typeCombo);

/* Acquisition type section */
bool isRecordable = editedPlot->getType() == Plot::Type::CURVE || editedPlot->getType() == Plot::Type::XY;

if (!isRecordable)
editedPlot->setAcquisitionType(Plot::AcquisitionType::SAMPLING);

ImGui::BeginDisabled(!isRecordable);

Plot::AcquisitionType acquisitionType = editedPlot->getAcquisitionType();

GuiHelper::drawTextAlignedToSize("acqusition:", alignment);
ImGui::SameLine();
ImGui::RadioButton("sampling", (int32_t*)(&acquisitionType), 0);
ImGui::SameLine();
ImGui::RadioButton("recorder", (int32_t*)(&acquisitionType), 1);
ImGui::SameLine();
ImGui::HelpMarker("A sampling plot is sampled asynchonously in regular intervals without additional software on target's side. \r\n A recorder group is a group used for registering high frequency signals with predefined intervals. Recorder file and sampling function execution is needed for proper operation.");

if (acquisitionType == Plot::AcquisitionType::RECORDER)
{
ImGui::Text("Recorder");
}

editedPlot->setAcquisitionType(acquisitionType);

ImGui::EndDisabled();

/* XY plot settings section*/

if (editedPlot->getType() == Plot::Type::XY)
{
GuiHelper::drawTextAlignedToSize("X-axis variable:", alignment);
Expand Down
10 changes: 10 additions & 0 deletions src/Plot/Plot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,3 +272,13 @@ void Plot::setXAxisVariable(Variable* var)
{
xAxisSeries.var = var;
}

Plot::AcquisitionType Plot::getAcquisitionType() const
{
return acquisitionType;
}

void Plot::setAcquisitionType(AcquisitionType type)
{
this->acquisitionType = type;
}
10 changes: 10 additions & 0 deletions src/Plot/Plot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ class Plot
XY = 3
};

enum class AcquisitionType : int32_t
{
SAMPLING = 0,
RECORDER = 1
};

enum class Domain : uint8_t
{
ANALOG = 0,
Expand Down Expand Up @@ -141,6 +147,9 @@ class Plot
Variable* getXAxisVariable();
void setXAxisVariable(Variable* var);

Plot::AcquisitionType getAcquisitionType() const;
void setAcquisitionType(AcquisitionType type);

displayFormat getSeriesDisplayFormat(const std::string& name) const;
void setSeriesDisplayFormat(const std::string& name, displayFormat format);
std::string getSeriesValueString(const std::string& name, double value);
Expand All @@ -158,6 +167,7 @@ class Plot
Domain domain = Domain::ANALOG;
TraceVarType traceVarType = TraceVarType::F32;
bool isHoveredOver = false;
AcquisitionType acquisitionType = AcquisitionType::SAMPLING;

Marker mx0;
Marker mx1;
Expand Down
19 changes: 0 additions & 19 deletions src/PlotGroupHandler/PlotGroupHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ class PlotGroup
std::shared_ptr<Plot> plot;
};

typedef enum
{
SAMPLING = 0,
RECORDER = 1
} Type;

PlotGroup(const std::string& name) : name(name)
{
}
Expand Down Expand Up @@ -82,22 +76,9 @@ class PlotGroup
{ return pair.second.visibility; });
}

Type getType() const
{
return type;
}

void setType(Type type)
{
this->type = type;
}

private:
std::string name;
std::map<std::string, PlotEntry> group;

Type type = Type::SAMPLING;

};

class PlotGroupHandler
Expand Down

0 comments on commit bba11ed

Please sign in to comment.