[FAN Controller] Initial implementation for Asus TUF Fan controller

This commit is contained in:
Dmitry K
2023-07-06 16:33:25 +00:00
committed by Adam Honse
parent 779c15e41c
commit af23c04007
3 changed files with 65 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
#include <string>
#include "Detector.h"
#include "FanController_AsusTUFLaptop_Windows.h"
#include "RGBController_AsusTUFLaptop_Windows.h"
#include "wmi.h"
@@ -44,8 +45,10 @@ static void DetectAsusTUFLaptopWMIControllers()
if(controller)
{
RGBController* new_controller = new RGBController_AsusTUFLaptopWMI(controller);
FanController* fan_controller = new FanController_AsusTUFLaptopWMI(controller);
ResourceManager::get()->RegisterRGBController(new_controller);
ResourceManager::get()->RegisterFanController(fan_controller);
}
} /* DetectAsusTUFLaptopWMIControllers() */

View File

@@ -0,0 +1,44 @@
#include "FanController_AsusTUFLaptop_Windows.h"
FanController_AsusTUFLaptopWMI::FanController_AsusTUFLaptopWMI(AsusTUFLaptopController* dev)
{
controller = dev;
name = "ASUS TUF Laptop";
description = "WMI Device";
location = "\\\\.\\ATKACPI";
// Coolers RPM reading & current mode retrieval is still WIP
fans.resize(2);
fans[0].name = "CPU Cooler";
fans[0].speed_min = 0;
fans[0].speed_max = 2;
fans[0].speed_cmd = 1;
fans[0].prev_speed_cmd = 1;
fans[0].rpm_rdg = 0; // We don't have it, but we don't want an unitialized value either
}
void FanController_AsusTUFLaptopWMI::UpdateControl()
{
int mode = fans[0].speed_cmd;
switch(mode)
{
case 0:
mode = ASUS_WMI_FAN_SPEED_SILENT;
break;
case 1:
mode = ASUS_WMI_FAN_SPEED_NORMAL;
break;
case 2:
mode = ASUS_WMI_FAN_SPEED_TURBO;
break;
}
controller->setFanMode(mode);
}
void FanController_AsusTUFLaptopWMI::UpdateReading()
{
;
}

View File

@@ -0,0 +1,18 @@
#ifndef FANCONTROLLER_ASUSTUFLAPTOPWMI_H
#define FANCONTROLLER_ASUSTUFLAPTOPWMI_H
#include "FanController.h"
#include "AsusTUFLaptopController_Windows.h"
class FanController_AsusTUFLaptopWMI : public FanController
{
private:
AsusTUFLaptopController* controller;
public:
FanController_AsusTUFLaptopWMI(AsusTUFLaptopController* dev);
void UpdateControl() override;
void UpdateReading() override;
};
#endif // FANCONTROLLER_ASUSTUFLAPTOPWMI_H