Remove needless couts, add systemd service
This commit is contained in:
@@ -32,3 +32,4 @@ target_include_directories(${PROJECT_NAME} PUBLIC include /opt/cuda)
|
|||||||
target_link_libraries(${PROJECT_NAME} PUBLIC sensors nvidia-ml nlohmann_json::nlohmann_json tbb ${Boost_LIBRARIES})
|
target_link_libraries(${PROJECT_NAME} PUBLIC sensors nvidia-ml nlohmann_json::nlohmann_json tbb ${Boost_LIBRARIES})
|
||||||
|
|
||||||
install(TARGETS ${PROJECT_NAME} DESTINATION usr/local/bin)
|
install(TARGETS ${PROJECT_NAME} DESTINATION usr/local/bin)
|
||||||
|
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/unit/fantasize.service DESTINATION usr/lib/systemd/system)
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ FanCurve::FanCurve(std::vector<FanStep> steps,
|
|||||||
|
|
||||||
void FanCurve::DoFanControl() {
|
void FanCurve::DoFanControl() {
|
||||||
int temp = AggregateTemperature();
|
int temp = AggregateTemperature();
|
||||||
cout << "Temp: " << temp << "C" << endl;
|
|
||||||
|
|
||||||
int t0, t1, p0, p1;
|
int t0, t1, p0, p1;
|
||||||
int targetFanSpeed;
|
int targetFanSpeed;
|
||||||
@@ -37,8 +36,6 @@ void FanCurve::DoFanControl() {
|
|||||||
targetFanSpeed = p0 + ((p1 - p0) / (t1 - t0)) * (temp - t0);
|
targetFanSpeed = p0 + ((p1 - p0) / (t1 - t0)) * (temp - t0);
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << "Power: " << targetFanSpeed << "%" << endl;
|
|
||||||
|
|
||||||
for (auto f : mFans) {
|
for (auto f : mFans) {
|
||||||
f->PWM(targetFanSpeed);
|
f->PWM(targetFanSpeed);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ using namespace std;
|
|||||||
HwmonFan::HwmonFan(std::shared_ptr<PWMControl> pwmControl,
|
HwmonFan::HwmonFan(std::shared_ptr<PWMControl> pwmControl,
|
||||||
std::shared_ptr<Sensor> rpmSensor)
|
std::shared_ptr<Sensor> rpmSensor)
|
||||||
: mPWMControl(pwmControl), mRpmSensor(rpmSensor) {
|
: mPWMControl(pwmControl), mRpmSensor(rpmSensor) {
|
||||||
cout << "Enabling manual control" << endl;
|
|
||||||
mPWMControl->EnableManualControl();
|
mPWMControl->EnableManualControl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
10
app/unit/fantasize.service
Normal file
10
app/unit/fantasize.service
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Fantasize fan control service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/usr/local/bin/fantasize
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
Reference in New Issue
Block a user