Cleanup, more documentation
This commit is contained in:
@@ -23,6 +23,7 @@ public:
|
||||
private:
|
||||
std::shared_ptr<PWMControl> mPWMControl;
|
||||
std::shared_ptr<Sensor> mRpmSensor;
|
||||
std::string mLabel;
|
||||
};
|
||||
|
||||
#endif // HWMONFAN_H_
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#ifndef PWMCONTROLFACADE_H_
|
||||
#define PWMCONTROLFACADE_H_
|
||||
|
||||
#include <filesystem>
|
||||
#include <memory>
|
||||
#include <regex>
|
||||
#include <vector>
|
||||
|
||||
#include <pwm/PWMControl.h>
|
||||
|
||||
@@ -14,7 +14,7 @@ int HwmonFan::rpm() { return mRpmSensor->value(); }
|
||||
|
||||
json HwmonFan::toJson() const {
|
||||
json obj;
|
||||
obj = {mPWMControl->toJson(), mRpmSensor->toJson()};
|
||||
obj = {mPWMControl->toJson(), mRpmSensor->toJson(), mLabel};
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
|
||||
#include <FanGenerator.h>
|
||||
@@ -7,8 +6,6 @@
|
||||
#include <pwm/PWMControlFacade.h>
|
||||
#include <sensor/SensorManager.h>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
int main() {
|
||||
SensorManager sensorManager;
|
||||
auto pwmSensors = sensorManager.RPMSensors();
|
||||
@@ -21,12 +18,7 @@ int main() {
|
||||
|
||||
std::vector<std::shared_ptr<Fan>> fans;
|
||||
|
||||
if (fs::exists(fs::path(SERIALIZATION_DIR) / FANS_JSON_FILENAME)) {
|
||||
fans = s.DeserializeFans(pwmSensors);
|
||||
} else {
|
||||
fans = m.FindFans(pwmSensors, controls);
|
||||
s.SerializeFans(fans);
|
||||
}
|
||||
|
||||
for (auto f : fans) {
|
||||
std::cout << f->toString() << std::endl;
|
||||
|
||||
@@ -4,7 +4,7 @@ interface Sensor {
|
||||
}
|
||||
|
||||
class LMSensor {
|
||||
- Identifier: string
|
||||
- string Label
|
||||
|
||||
+ int Value()
|
||||
}
|
||||
@@ -14,19 +14,23 @@ class GPUSensor {
|
||||
}
|
||||
|
||||
class HWMONFan {
|
||||
- Identifier: string
|
||||
- RPMSensor: Sensor
|
||||
- PWMControl: PWMControl
|
||||
- string Label
|
||||
- Sensor RPMSensor
|
||||
- PWMControl PWMControl
|
||||
|
||||
+ int RPM()
|
||||
+ void PWM(value: int)
|
||||
+ void PWMPercent(int value)
|
||||
}
|
||||
|
||||
class PWMControl {
|
||||
+ void PWM(value: int)
|
||||
+ void PWMPercent(int value)
|
||||
+ int PWM()
|
||||
}
|
||||
|
||||
class PWMControlFacade {
|
||||
+ List<PWMControl> PWMControls()
|
||||
}
|
||||
|
||||
class LMSensorsFacade
|
||||
{
|
||||
+ List<Sensor> RPMSensors()
|
||||
@@ -52,8 +56,41 @@ class FanGenerator
|
||||
+ FanList FindFans(List<RPMSensor>, List<PWMControl>)
|
||||
}
|
||||
|
||||
struct Coordinate
|
||||
{
|
||||
int X
|
||||
int Y
|
||||
}
|
||||
|
||||
enum SensorAggregateFunction
|
||||
{
|
||||
MIN
|
||||
MAX
|
||||
AVG
|
||||
}
|
||||
|
||||
class FanCurve
|
||||
{
|
||||
- List<Coordinate> Steps
|
||||
- List<Sensor> TempSensor
|
||||
- SensorAggregateFunction Fun
|
||||
- HWMONFan Fan
|
||||
|
||||
+ int TargetPWMPercent()
|
||||
}
|
||||
|
||||
class FanController
|
||||
{
|
||||
- List<HWMONFan>
|
||||
|
||||
+ void StartFanControlLoop()
|
||||
}
|
||||
|
||||
HWMONFan -- Sensor
|
||||
HWMONFan -- PWMControl
|
||||
HWMONFan - FanCurve
|
||||
|
||||
PWMControl -- PWMControlFacade
|
||||
|
||||
Sensor <|-- LMSensor
|
||||
Sensor <|-- GPUSensor
|
||||
@@ -68,4 +105,10 @@ GPUSensorsFacade -- SensorManager
|
||||
FanGenerator - HWMONFan
|
||||
FanGenerator - SensorManager
|
||||
FanGenerator - PWMControl
|
||||
|
||||
Sensor - FanCurve
|
||||
FanCurve -- Coordinate
|
||||
FanCurve -- SensorAggregateFunction
|
||||
|
||||
FanController -- FanCurve
|
||||
@enduml
|
||||
|
||||
Reference in New Issue
Block a user