Documentation
¶
Index ¶
- Constants
- Variables
- func ComputePwmBoundaries(fan Fan) (startPwm int, maxPwm int)
- type CmdFan
- func (fan *CmdFan) AttachFanCurveData(curveData *map[int]float64) (err error)
- func (fan *CmdFan) GetCurveId() string
- func (fan *CmdFan) GetFanCurveData() *map[int]float64
- func (fan *CmdFan) GetId() string
- func (fan *CmdFan) GetMaxPwm() int
- func (fan *CmdFan) GetMinPwm() int
- func (fan *CmdFan) GetPwm() (result int, err error)
- func (fan *CmdFan) GetPwmEnabled() (int, error)
- func (fan *CmdFan) GetRpm() (int, error)
- func (fan *CmdFan) GetRpmAvg() float64
- func (fan *CmdFan) GetStartPwm() int
- func (fan *CmdFan) IsPwmAuto() (bool, error)
- func (fan *CmdFan) SetMaxPwm(pwm int, force bool)
- func (fan *CmdFan) SetMinPwm(pwm int, force bool)
- func (fan *CmdFan) SetPwm(pwm int) (err error)
- func (fan *CmdFan) SetPwmEnabled(value ControlMode) (err error)
- func (fan *CmdFan) SetRpmAvg(rpm float64)
- func (fan *CmdFan) SetStartPwm(pwm int, force bool)
- func (fan *CmdFan) ShouldNeverStop() bool
- func (fan *CmdFan) Supports(feature FeatureFlag) bool
- type ControlMode
- type Fan
- type FeatureFlag
- type FileFan
- func (fan *FileFan) AttachFanCurveData(curveData *map[int]float64) (err error)
- func (fan *FileFan) GetCurveId() string
- func (fan *FileFan) GetFanCurveData() *map[int]float64
- func (fan *FileFan) GetId() string
- func (fan *FileFan) GetMaxPwm() int
- func (fan *FileFan) GetMinPwm() int
- func (fan *FileFan) GetPwm() (result int, err error)
- func (fan *FileFan) GetPwmEnabled() (int, error)
- func (fan *FileFan) GetRpm() (result int, err error)
- func (fan *FileFan) GetRpmAvg() float64
- func (fan *FileFan) GetStartPwm() int
- func (fan *FileFan) IsPwmAuto() (bool, error)
- func (fan *FileFan) SetMaxPwm(pwm int, force bool)
- func (fan *FileFan) SetMinPwm(pwm int, force bool)
- func (fan *FileFan) SetPwm(pwm int) (err error)
- func (fan *FileFan) SetPwmEnabled(value ControlMode) (err error)
- func (fan *FileFan) SetRpmAvg(rpm float64)
- func (fan *FileFan) SetStartPwm(pwm int, force bool)
- func (fan *FileFan) ShouldNeverStop() bool
- func (fan *FileFan) Supports(feature FeatureFlag) bool
- type HwMonFan
- func (fan *HwMonFan) AttachFanCurveData(curveData *map[int]float64) (err error)
- func (fan *HwMonFan) GetCurveId() string
- func (fan *HwMonFan) GetFanCurveData() *map[int]float64
- func (fan *HwMonFan) GetId() string
- func (fan *HwMonFan) GetMaxPwm() int
- func (fan *HwMonFan) GetMinPwm() int
- func (fan *HwMonFan) GetPwm() (int, error)
- func (fan *HwMonFan) GetPwmEnabled() (int, error)
- func (fan *HwMonFan) GetRpm() (int, error)
- func (fan *HwMonFan) GetRpmAvg() float64
- func (fan *HwMonFan) GetStartPwm() int
- func (fan *HwMonFan) IsPwmAuto() (bool, error)
- func (fan *HwMonFan) SetMaxPwm(pwm int, force bool)
- func (fan *HwMonFan) SetMinPwm(pwm int, force bool)
- func (fan *HwMonFan) SetPwm(pwm int) (err error)
- func (fan *HwMonFan) SetPwmEnabled(value ControlMode) (err error)
- func (fan *HwMonFan) SetRpmAvg(rpm float64)
- func (fan *HwMonFan) SetStartPwm(pwm int, force bool)
- func (fan *HwMonFan) ShouldNeverStop() bool
- func (fan *HwMonFan) Supports(feature FeatureFlag) bool
Constants ¶
View Source
const ( MaxPwmValue = 255 MinPwmValue = 0 )
Variables ¶
View Source
var (
FanMap = map[string]Fan{}
)
Functions ¶
func ComputePwmBoundaries ¶
ComputePwmBoundaries calculates the startPwm and maxPwm values for a fan based on its fan curve data
Types ¶
type CmdFan ¶
type CmdFan struct { Config configuration.FanConfig `json:"config"` MovingAvg float64 `json:"movingAvg"` Rpm int `json:"rpm"` Pwm int `json:"pwm"` }
func (*CmdFan) AttachFanCurveData ¶
func (*CmdFan) GetCurveId ¶
func (*CmdFan) GetFanCurveData ¶
func (*CmdFan) GetPwmEnabled ¶
func (*CmdFan) GetStartPwm ¶
func (*CmdFan) SetPwmEnabled ¶
func (fan *CmdFan) SetPwmEnabled(value ControlMode) (err error)
func (*CmdFan) SetStartPwm ¶
func (*CmdFan) ShouldNeverStop ¶
func (*CmdFan) Supports ¶
func (fan *CmdFan) Supports(feature FeatureFlag) bool
type ControlMode ¶
type ControlMode int
const ( // ControlModeDisabled completely disables control, resulting in a 100% voltage/PWM signal output ControlModeDisabled ControlMode = 0 // ControlModePWM enables manual, fixed speed control via setting the pwm value ControlModePWM ControlMode = 1 // ControlModeAutomatic enables automatic control by the integrated control of the mainboard ControlModeAutomatic ControlMode = 2 )
type Fan ¶
type Fan interface { GetId() string // GetMinPwm returns the lowest PWM value where the fans are still spinning, when spinning previously GetMinPwm() int SetMinPwm(pwm int, force bool) // GetStartPwm returns the min PWM at which the fan starts to rotate from a stand still GetStartPwm() int SetStartPwm(pwm int, force bool) // GetMaxPwm returns the highest PWM value that yields an RPM increase GetMaxPwm() int SetMaxPwm(pwm int, force bool) // GetRpm returns the current RPM value of this fan GetRpm() (int, error) GetRpmAvg() float64 SetRpmAvg(rpm float64) // GetPwm returns the current PWM value of this fan GetPwm() (int, error) SetPwm(pwm int) (err error) // GetFanCurveData returns the fan curve data for this fan GetFanCurveData() *map[int]float64 AttachFanCurveData(curveData *map[int]float64) (err error) // GetCurveId returns the id of the speed curve associated with this fan GetCurveId() string // ShouldNeverStop indicated whether this fan should never stop rotating ShouldNeverStop() bool // GetPwmEnabled returns the current "pwm_enabled" value of this fan GetPwmEnabled() (int, error) SetPwmEnabled(value ControlMode) (err error) // IsPwmAuto indicates whether this fan is in "Auto" mode IsPwmAuto() (bool, error) Supports(feature FeatureFlag) bool }
type FeatureFlag ¶
type FeatureFlag int
const ( FeatureRpmSensor FeatureFlag = 0 FeatureControlMode FeatureFlag = 1 )
type FileFan ¶
type FileFan struct { Config configuration.FanConfig `json:"config"` MovingAvg float64 `json:"movingAvg"` Pwm int `json:"pwm"` Rpm int `json:"rpm"` }
func (*FileFan) AttachFanCurveData ¶
func (*FileFan) GetCurveId ¶
func (*FileFan) GetFanCurveData ¶
func (*FileFan) GetPwmEnabled ¶
func (*FileFan) GetStartPwm ¶
func (*FileFan) SetPwmEnabled ¶
func (fan *FileFan) SetPwmEnabled(value ControlMode) (err error)
func (*FileFan) SetStartPwm ¶
func (*FileFan) ShouldNeverStop ¶
func (*FileFan) Supports ¶
func (fan *FileFan) Supports(feature FeatureFlag) bool
type HwMonFan ¶
type HwMonFan struct { Label string `json:"label"` Index int `json:"index"` RpmMovingAvg float64 `json:"rpmMovingAvg"` Config configuration.FanConfig `json:"config"` MinPwm *int `json:"minPwm"` StartPwm *int `json:"startPwm"` MaxPwm *int `json:"maxPwm"` FanCurveData *map[int]float64 `json:"fanCurveData"` Rpm int `json:"rpm"` Pwm int `json:"pwm"` }
func (*HwMonFan) AttachFanCurveData ¶
AttachFanCurveData attaches fan curve data from persistence to a fan Note: When the given data is incomplete, all values up until the highest value in the given dataset will be interpolated linearly returns os.ErrInvalid if curveData is void of any data
func (*HwMonFan) GetCurveId ¶
func (*HwMonFan) GetFanCurveData ¶
func (*HwMonFan) GetPwmEnabled ¶
func (*HwMonFan) GetStartPwm ¶
func (*HwMonFan) SetPwmEnabled ¶
func (fan *HwMonFan) SetPwmEnabled(value ControlMode) (err error)
SetPwmEnabled writes the given value to pwmX_enable Possible values (unsure if these are true for all scenarios): 0 - no control (results in max speed) 1 - manual pwm control 2 - motherboard pwm control
func (*HwMonFan) SetStartPwm ¶
func (*HwMonFan) ShouldNeverStop ¶
func (*HwMonFan) Supports ¶
func (fan *HwMonFan) Supports(feature FeatureFlag) bool
Click to show internal directories.
Click to hide internal directories.