Skip to content

Commit

Permalink
Measure: Tweak logging of Min/MaxValue warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
brianferguson committed Dec 24, 2022
1 parent c6ca4ab commit 8e0c652
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
11 changes: 8 additions & 3 deletions Library/Measure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,13 @@ static const double g_TblScale[2][4] = {
const int MEDIAN_SIZE = 3;

Measure::Measure(Skin* skin, const WCHAR* name) : Section(skin, name),
m_Value(0.0),
m_Invert(false),
m_LogMaxValue(false),
m_MinValue(),
m_MinValue(0.0),
m_MaxValue(1.0),
m_Value(),
m_MinValueDefined(false),
m_MaxValueDefined(false),
m_RegExpSubstitute(false),
m_MedianPos(),
m_AveragePos(),
Expand All @@ -92,7 +94,7 @@ void Measure::Initialize()
{
m_Initialized = true;

if (GetRainmeter().GetDebug())
if (GetRainmeter().GetDebug() && (m_MinValueDefined || m_MaxValueDefined))
{
if (m_MaxValue == m_MinValue)
{
Expand Down Expand Up @@ -137,7 +139,10 @@ void Measure::ReadOptions(ConfigParser& parser, const WCHAR* section)
m_Paused = parser.ReadBool(section, L"Paused", false);

m_MinValue = parser.ReadFloat(section, L"MinValue", m_MinValue);
m_MaxValueDefined = parser.GetLastValueDefined();

m_MaxValue = parser.ReadFloat(section, L"MaxValue", m_MaxValue);
m_MaxValueDefined = parser.GetLastValueDefined();

m_IfActions.ReadOptions(parser, section);

Expand Down
21 changes: 13 additions & 8 deletions Library/Measure.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,24 +94,29 @@ class __declspec(novtable) Measure : public Section
const WCHAR* CheckSubstitute(const WCHAR* buffer);
bool MakePlainSubstitute(std::wstring& str, size_t index);

bool m_Invert; // If true, the value should be inverted
bool m_LogMaxValue; // If true, The maximum & minimum values are logged
double m_MinValue; // The minimum value (so far)
double m_MaxValue; // The maximum value (so far)
double m_Value; // The current value
double m_Value;

bool m_Invert;

bool m_LogMaxValue;
double m_MinValue;
double m_MaxValue;
bool m_MinValueDefined;
bool m_MaxValueDefined;

std::vector<std::wstring> m_Substitute; // Vec of substitute strings
std::vector<std::wstring> m_Substitute;
bool m_RegExpSubstitute;

std::vector<double> m_MedianValues; // The values for the median filtering
UINT m_MedianPos; // Position in the median array, where the new value is placed
UINT m_MedianPos; // Position in the median array, where the new value is placed

std::vector<double> m_AverageValues;
UINT m_AveragePos;
UINT m_AverageSize;

IfActions m_IfActions;
bool m_Disabled; // Status of the measure

bool m_Disabled;
bool m_Paused;
bool m_Initialized;

Expand Down

0 comments on commit 8e0c652

Please sign in to comment.