Hysteresis, Inhibit-Stop Timeframe
This commit is contained in:
@@ -22,6 +22,8 @@ public:
|
||||
|
||||
virtual void FindPWMLimits() = 0;
|
||||
virtual void AdjustPWMLimits() = 0;
|
||||
|
||||
virtual void EnforceSetValue() = 0;
|
||||
};
|
||||
|
||||
#endif // FAN_H_
|
||||
|
||||
@@ -8,30 +8,32 @@
|
||||
#include <fan/HwmonFan.h>
|
||||
#include <sensor/Sensor.h>
|
||||
|
||||
struct FanStep
|
||||
{
|
||||
struct FanStep {
|
||||
int Temp;
|
||||
int Percent;
|
||||
};
|
||||
|
||||
class FanCurve
|
||||
{
|
||||
class FanCurve {
|
||||
public:
|
||||
FanCurve(std::vector<FanStep> steps,
|
||||
std::vector<std::shared_ptr<Sensor>> sensors,
|
||||
std::vector<std::shared_ptr<Fan>> fans,
|
||||
std::unique_ptr<Aggregator> aggregator);
|
||||
std::unique_ptr<Aggregator> aggregator, int hysteresis);
|
||||
|
||||
void DoFanControl();
|
||||
|
||||
private:
|
||||
int AggregateTemperature();
|
||||
void PrintInfo();
|
||||
bool ExceedsHysteresis(int temperature);
|
||||
void ApplyFanPower(std::shared_ptr<Fan> fan, int targetFanPower);
|
||||
|
||||
std::vector<FanStep> mSteps;
|
||||
std::vector<std::shared_ptr<Sensor>> mTempSensors;
|
||||
std::vector<std::shared_ptr<Fan>> mFans;
|
||||
std::unique_ptr<Aggregator> mAggregator;
|
||||
int mHystersis;
|
||||
int mLastTemperature;
|
||||
};
|
||||
|
||||
#endif // FANCURVE_H_
|
||||
|
||||
@@ -30,11 +30,16 @@ public:
|
||||
void FindPWMLimits() override;
|
||||
void AdjustPWMLimits() override;
|
||||
|
||||
void EnforceSetValue() override;
|
||||
|
||||
json toJson() const override;
|
||||
|
||||
const std::string toString() const override;
|
||||
|
||||
private:
|
||||
bool InhibitStopPeriodExpired();
|
||||
void SetPower(int percent);
|
||||
|
||||
std::shared_ptr<PWMControl> mPWMControl;
|
||||
std::shared_ptr<Sensor> mRpmSensor;
|
||||
std::string mLabel;
|
||||
@@ -43,6 +48,9 @@ private:
|
||||
int mStartPWM = 0;
|
||||
bool mZeroFanModeSupported = false;
|
||||
std::chrono::time_point<std::chrono::steady_clock> mLastAdjustmentTime;
|
||||
std::chrono::time_point<std::chrono::steady_clock> mLastStartTime;
|
||||
int mSetValue = 0;
|
||||
bool mWasStopped = false;
|
||||
};
|
||||
|
||||
#endif // HWMONFAN_H_
|
||||
|
||||
Reference in New Issue
Block a user