Cleanup, more documentation

This commit is contained in:
2022-09-27 22:50:01 +02:00
parent df943620d6
commit 0e75299c20
5 changed files with 52 additions and 18 deletions

View File

@@ -23,6 +23,7 @@ public:
private:
std::shared_ptr<PWMControl> mPWMControl;
std::shared_ptr<Sensor> mRpmSensor;
std::string mLabel;
};
#endif // HWMONFAN_H_

View File

@@ -1,9 +1,7 @@
#ifndef PWMCONTROLFACADE_H_
#define PWMCONTROLFACADE_H_
#include <filesystem>
#include <memory>
#include <regex>
#include <vector>
#include <pwm/PWMControl.h>

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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