Refactoring, housekeeping, documentation
Add a class diagram. Still needs some details. Refactor to better respect SOLID principles. Housekeeping, move and rename classes/files.
This commit is contained in:
@@ -3,14 +3,14 @@
|
||||
start
|
||||
:Initialization;
|
||||
|
||||
if (Mapping exists) then (yes)
|
||||
:Load mapping;
|
||||
if (Config exists) then (yes)
|
||||
:Load config;
|
||||
else (no)
|
||||
:Generate mapping;
|
||||
:Do first-start initialization;
|
||||
endif
|
||||
|
||||
:Enter fan control loop;
|
||||
:Load Fan Curves;
|
||||
:Enter fan control loop;
|
||||
|
||||
stop
|
||||
|
||||
|
||||
@@ -1,32 +1,71 @@
|
||||
@startuml
|
||||
interface Fan {
|
||||
{abstract} void PWM(int percent)
|
||||
{abstract} int RPM()
|
||||
}
|
||||
|
||||
interface Sensor {
|
||||
{abstract} int value()
|
||||
{abstract} string name()
|
||||
+ {abstract} int Value()
|
||||
}
|
||||
|
||||
class PwmControl {
|
||||
+void pwm(int percent)
|
||||
+int pwm()
|
||||
class LMSensor {
|
||||
- Identifier: string
|
||||
|
||||
+ void enableManualControl()
|
||||
+ void reset()
|
||||
|
||||
- System Paths
|
||||
- Initial Values
|
||||
+ int Value()
|
||||
}
|
||||
|
||||
Fan <|-- HwmonFan
|
||||
class GPUSensor {
|
||||
+ int Value()
|
||||
}
|
||||
|
||||
Sensor <|-- HwmonSensor
|
||||
Sensor <|-- NvidiaSensor
|
||||
class HWMONFan {
|
||||
- Identifier: string
|
||||
- RPMSensor: Sensor
|
||||
- PWMControl: PWMControl
|
||||
|
||||
HwmonFan - Sensor
|
||||
HwmonFan -- PwmControl
|
||||
+ int RPM()
|
||||
+ void PWM(value: int)
|
||||
}
|
||||
|
||||
class PWMControl {
|
||||
+ void PWM(value: int)
|
||||
+ int PWM()
|
||||
}
|
||||
|
||||
class LMSensorsFacade
|
||||
{
|
||||
+ List<Sensor> RPMSensors()
|
||||
+ List<Sensor> TemperatureSensors()
|
||||
}
|
||||
|
||||
class GPUSensorsFacade
|
||||
{
|
||||
+ List<Sensor> TemperatureSensors()
|
||||
}
|
||||
|
||||
class SensorManager
|
||||
{
|
||||
- LMSensorsFacade
|
||||
- GPUSensorsFacade
|
||||
|
||||
+ List<Sensor> RPMSensors()
|
||||
+ List<Sensor> TemperatureSensors()
|
||||
}
|
||||
|
||||
class FanGenerator
|
||||
{
|
||||
+ FanList FindFans(List<RPMSensor>, List<PWMControl>)
|
||||
}
|
||||
|
||||
HWMONFan -- Sensor
|
||||
HWMONFan -- PWMControl
|
||||
|
||||
Sensor <|-- LMSensor
|
||||
Sensor <|-- GPUSensor
|
||||
|
||||
SensorManager - Sensor
|
||||
|
||||
LMSensor -- LMSensorsFacade
|
||||
GPUSensor -- GPUSensorsFacade
|
||||
LMSensorsFacade -- SensorManager
|
||||
GPUSensorsFacade -- SensorManager
|
||||
|
||||
FanGenerator - HWMONFan
|
||||
FanGenerator - SensorManager
|
||||
FanGenerator - PWMControl
|
||||
@enduml
|
||||
|
||||
23
app/doc/Initialization.plantuml
Normal file
23
app/doc/Initialization.plantuml
Normal file
@@ -0,0 +1,23 @@
|
||||
@startuml
|
||||
participant main
|
||||
participant LMSensorsFacade as lms
|
||||
participant GPUSensor as gpus
|
||||
participant PWMControlFactory as pwmfc
|
||||
|
||||
main -> lms: RPMSensors()
|
||||
main <-- lms: vector<Sensor>
|
||||
|
||||
main -> lms: TemperatureSensors()
|
||||
main <-- lms: vector<Sensor>
|
||||
|
||||
main -> gpus: GPUSensor()
|
||||
main <-- gpus: Sensor
|
||||
note right
|
||||
Add GPUSensor to list
|
||||
of temperature sensors
|
||||
end note
|
||||
|
||||
main -> pwmfc: PWMControllers()
|
||||
main <-- pwmfc: vector<PWMControl>
|
||||
|
||||
@enduml
|
||||
Reference in New Issue
Block a user