Corsair Lighting Protocol  0.15.0
Control LEDs connected to an Arduino with iCUE
SimpleFanController Class Reference

#include <SimpleFanController.h>

+ Inheritance diagram for SimpleFanController:
+ Collaboration diagram for SimpleFanController:

Public Member Functions

 SimpleFanController (TemperatureController *temperatureController, uint16_t updateRate, uint16_t eEPROMAdress)
 
void addFan (uint8_t index, PWMFan *fan)
 
virtual bool updateFans ()
 
- Public Member Functions inherited from FanController
virtual void handleFanControl (const Command &command, const CorsairLightingProtocolResponse *response) override
 

Protected Member Functions

virtual uint16_t getFanSpeed (uint8_t fan) override
 
virtual void setFanSpeed (uint8_t fan, uint16_t speed) override
 
virtual uint8_t getFanPower (uint8_t fan) override
 
virtual void setFanPower (uint8_t fan, uint8_t percentage) override
 
virtual void setFanCurve (uint8_t fan, uint8_t group, FanCurve &fanCurve) override
 
virtual void setFanExternalTemperature (uint8_t fan, uint16_t temp) override
 
virtual void setFanForce3PinMode (bool flag) override
 
virtual FanDetectionType getFanDetectionType (uint8_t fan) override
 
virtual void setFanDetectionType (uint8_t fan, FanDetectionType type) override
 
bool load ()
 
bool save ()
 

Protected Attributes

TemperatureController *const temperatureController
 
PWMFanfans [FAN_NUM] = {nullptr}
 
bool force3PinMode = false
 
FanData fanData [FAN_NUM]
 
uint16_t externalTemp [FAN_NUM]
 
uint16_t updateRate
 
uint16_t eEPROMAdress
 
bool triggerSave = false
 
unsigned long lastUpdate = 0
 

Detailed Description

This simple Fan Controller implementation does not implement all features of a Fan Controller. It should only demonstrate how to implement your own Fan Controller.

Constructor & Destructor Documentation

◆ SimpleFanController()

SimpleFanController::SimpleFanController ( TemperatureController temperatureController,
uint16_t  updateRate,
uint16_t  eEPROMAdress 
)

Fan Controller must use the EEPROM else on startup the fans can't be controlled

Parameters
temperatureControllerthe TemperatureController used to get the temperature to control the fans
updateRateis the time between fan speed updates in ms
eEPROMAdressthe address where the data is stored in EEPROM

Member Function Documentation

◆ addFan()

void SimpleFanController::addFan ( uint8_t  index,
PWMFan fan 
)

Add a fan to the Controller.

Parameters
indexthe index of the fan
fanthe fan object

◆ getFanDetectionType()

FanDetectionType SimpleFanController::getFanDetectionType ( uint8_t  fan)
overrideprotectedvirtual

Get the fan DetectionType for a fan.

Parameters
fanindex of the fan
Returns
the FanDetectionType

Implements FanController.

◆ getFanPower()

uint8_t SimpleFanController::getFanPower ( uint8_t  fan)
overrideprotectedvirtual

Get the power percentage of a fan.

Parameters
fanindex of the fan
Returns
power percentage, in range 0-255 with 255 mean 100%.

Implements FanController.

◆ getFanSpeed()

uint16_t SimpleFanController::getFanSpeed ( uint8_t  fan)
overrideprotectedvirtual

Get the fan speed.

Parameters
fanindex of the fan
Returns
fan speed in RPM.

Implements FanController.

◆ setFanCurve()

void SimpleFanController::setFanCurve ( uint8_t  fan,
uint8_t  group,
FanCurve fanCurve 
)
overrideprotectedvirtual

Set a FanCure for a fan.

Parameters
fanindex of the fan
groupthe temperature group used for getting the temperature for this fan
fanCurvethe fan curve data

Implements FanController.

◆ setFanDetectionType()

void SimpleFanController::setFanDetectionType ( uint8_t  fan,
FanDetectionType  type 
)
overrideprotectedvirtual

Set the fan DetectionType for a fan.

Parameters
fanindex of the fan
typethe FanDetectionType

Implements FanController.

◆ setFanExternalTemperature()

void SimpleFanController::setFanExternalTemperature ( uint8_t  fan,
uint16_t  temp 
)
overrideprotectedvirtual

Set the external temperature for a fan. The external temperature is provied by the iCUE.

Parameters
fanindex of the fan
tempThe temperature in hundredths of a degree Celsius.

Implements FanController.

◆ setFanForce3PinMode()

void SimpleFanController::setFanForce3PinMode ( bool  flag)
overrideprotectedvirtual

TODO not sure what this does, currently unused

Parameters
flagthe value

Implements FanController.

◆ setFanPower()

void SimpleFanController::setFanPower ( uint8_t  fan,
uint8_t  percentage 
)
overrideprotectedvirtual
Parameters
fanindex of the fan
percentage255 mean 100%.

Implements FanController.

◆ setFanSpeed()

void SimpleFanController::setFanSpeed ( uint8_t  fan,
uint16_t  speed 
)
overrideprotectedvirtual

Set the fan speed to a fixed value.

Parameters
fanindex of the fan
speedfan speed in RPM.

Implements FanController.

◆ updateFans()

bool SimpleFanController::updateFans ( )
virtual

Update the fan speeds based on the temperature and commands.

Member Data Documentation

◆ triggerSave

bool SimpleFanController::triggerSave = false
protected

Indicates that the configuration of the fans has been changed and should be saved.


The documentation for this class was generated from the following files: