Remove needless couts, add systemd service

This commit is contained in:
2022-10-02 14:54:33 +02:00
parent a935bbe265
commit c70a262f86
4 changed files with 11 additions and 4 deletions

View File

@@ -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})
install(TARGETS ${PROJECT_NAME} DESTINATION usr/local/bin)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/unit/fantasize.service DESTINATION usr/lib/systemd/system)

View File

@@ -14,7 +14,6 @@ FanCurve::FanCurve(std::vector<FanStep> steps,
void FanCurve::DoFanControl() {
int temp = AggregateTemperature();
cout << "Temp: " << temp << "C" << endl;
int t0, t1, p0, p1;
int targetFanSpeed;
@@ -37,8 +36,6 @@ void FanCurve::DoFanControl() {
targetFanSpeed = p0 + ((p1 - p0) / (t1 - t0)) * (temp - t0);
}
cout << "Power: " << targetFanSpeed << "%" << endl;
for (auto f : mFans) {
f->PWM(targetFanSpeed);
}

View File

@@ -14,7 +14,6 @@ using namespace std;
HwmonFan::HwmonFan(std::shared_ptr<PWMControl> pwmControl,
std::shared_ptr<Sensor> rpmSensor)
: mPWMControl(pwmControl), mRpmSensor(rpmSensor) {
cout << "Enabling manual control" << endl;
mPWMControl->EnableManualControl();
}

View 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