Skip to content

_maximumSetPointNamePrev becomes unnecessary when _maximumSetPointName gets cleared in every loop #39

@huangalang

Description

@huangalang

@Krellan
in commit
/Allow disabling PID loops at runtime/
the following operation was added
https://github.com/openbmc/phosphor-pid-control/blob/7c6d35d5c439196254a7ca600b2d6bc0650adf4a/pid/zone.cpp#L138C13-L138C13

and it makes this condition check always be met in every loop (and it was not original
intention)
"
else if (_maximumSetPointName.compare(_maximumSetPointNamePrev))
"

else if (_maximumSetPointName.compare(_maximumSetPointNamePrev))

what's more, since the condition is met in every loop
so the debug log will be printed out as well
"
std::cerr << "PID Zone " << _zoneId << " max SetPoint "
<< _maximumSetPoint << " requested by "
<< _maximumSetPointName;
"
https://github.com/openbmc/phosphor-pid-control/blob/7c6d35d5c439196254a7ca600b2d6bc0650adf4a/pid/zone.cpp#L278C8-L280C43

_maximumSetPointName.clear() in every loop is a good idea
because it's consistent with _maximumSetPoint behaviour

but it changes the logic of _maximumSetPointName.compare completly
idea1
shall we modify it accordingly?

1 change the condition
"
else if (_maximumSetPointName.compare(_maximumSetPointNamePrev))
"
=>
'else'
2 add debug flag then the debug log will not be printed all the time

idea2
or simply remove
_maximumSetPointName.clear();
then the previous logic will still work
and _maximumSetPointName actually gets updated in addSetPoint()

if you have any better idea , feel free to let us know

Alang

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions