commanderpro

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CMDGetFanMask           cmd = 0x20
	CMDGetFanRPM            cmd = 0x21 // CMDReadFanSpeed
	CMDGetFanFixedDutyCycle cmd = 0x22 // CMDReadFanPower
	CMDSetFanFixedDutyCycle cmd = 0x23 // CMDWriteFanPower
	CMDSetFanFixedRPM       cmd = 0x24 // CMDWriteFanSpeed
	CMDSetFanCustomCurve    cmd = 0x25 // CMDWriteFanCurve
	CMDWriteFanExternalTemp cmd = 0x26 // CMDWriteFanExternalTemp
	CMDFanForceThreePinMode cmd = 0x27 // CMDWriteFanForceThreePinMode
	CMDSetFanMode           cmd = 0x28 // CMDWriteFanDetectionType
	CMDGetFanMode           cmd = 0x29 // CMDReadFanDetectionType

	FanCh1 FanCh = 0x00
	FanCh2 FanCh = 0x01
	FanCh3 FanCh = 0x02
	FanCh4 FanCh = 0x03
	FanCh5 FanCh = 0x04
	FanCh6 FanCh = 0x05

	FanModeAutoDisconnected FanMode = 0x00
	FanMode3Pin             FanMode = 0x01
	FanMode4Pin             FanMode = 0x02
	FanModeUnknown          FanMode = 0x03
)
View Source
const (
	CMDReadLedStripMask     cmd = 0x30
	CMDWriteLedRgbValue     cmd = 0x31
	CMDWriteLedColorValues  cmd = 0x32
	CMDWriteLedTrigger      cmd = 0x33 // transmitted as the last command after a sequence of 0x3? commands, save changes
	CMDWriteLedClear        cmd = 0x34
	CMDWriteLedGroupSet     cmd = 0x35 // led config, transmitted for each LED strip/fan enabled, for each LED channel
	CMDWriteLedExternalTemp cmd = 0x36
	CMDWriteLedGroupsClear  cmd = 0x37

	// port = channel
	// int corsairlink_commanderpro_set_port_state(
	//    struct corsair_device_info* dev,
	//    struct libusb_device_handle* handle,
	//    struct led_control *ctrl )
	//{
	//    int rr;
	//    uint8_t response[16];
	//    uint8_t commands[64];
	//    memset( response, 0, sizeof( response ) );
	//    memset( commands, 0, sizeof( commands ) );
	//
	//    commands[0] = 0x38;
	//    commands[1] = ctrl->channel;
	//    commands[2] = 0x01;
	//
	//    rr = dev->lowlevel->write( handle, dev->write_endpoint, commands, 64 );
	//    rr = dev->lowlevel->read( handle, dev->read_endpoint, response, 16 );
	//
	//    dump_packet( commands, sizeof( commands ) );
	//    dump_packet( response, sizeof( response ) );
	//    return rr;
	//}
	//
	//
	// /**
	// * The mode of an LEDChannel. The mode describes how the LED lighting is done.
	// *
	// * @see LEDController#setLEDMode()
	// */
	//enum class ChannelMode : byte {
	//	/** No lighting is active for the channel. The LEDs will not be updated. */
	//	Disabled = 0x00,
	//	/** The Hardware Playback uses lighting effects defined by LEDGroups and LEDController renders the effects themself.
	//	   This mode works even without an USB connection.  */
	//	HardwarePlayback = 0x01,
	//	/** All lighting effects are rendered by iCUE and only the RGB values are transferred via USB to the device. This
	//	   requires an USB connection. */
	//	SoftwarePlayback = 0x02
	//};
	CMDWriteLedMode       cmd = 0x38
	CMDWriteLedBrightness cmd = 0x39
	CMDWriteLedCount      cmd = 0x3a
	CMDWriteLedPortType   cmd = 0x3b // protocol

	LedCh1 = 0x00
	LedCh2 = 0x01

	LedMode_RainbowWave = 0x00
	LedMode_ColorShift  = 0x01
	LedMode_ColorPulse  = 0x02
	LedMode_ColorWave   = 0x03
	LedMode_Static      = 0x04
	LedMode_Temperature = 0x05
	LedMode_Visor       = 0x06
	LedMode_Marquee     = 0x07
	LedMode_Blink       = 0x08
	LedMode_Sequential  = 0x09
	LedMode_Rainbow     = 0x0A

	LedSpeedHigh   = 0x00
	LedSpeedMedium = 0x01
	LedSpeedLow    = 0x02

	LedDirection_Backward = 0x00
	LedDirection_Forward  = 0x01

	LedStyle_Alternating = 0x00
	LedStyle_RandomColor = 0x01
)
View Source
const (
	CMDConnectedSensors cmd = 0x10 // CMDReadTemperatureMask
	CMDGetTemp          cmd = 0x11 // CMDReadTemperatureValue
	CMDGetVoltage       cmd = 0x12 // CMDReadVoltageValue

	TempSensorExternal TempSensor = 0xFF // ...then send temperature regularly to the Commander Pro with 0x26 cmd
	TempSensor1        TempSensor = 0x00 // 1
	TempSensor2        TempSensor = 0x01 // 2
	TempSensor3        TempSensor = 0x02 // 3
	TempSensor4        TempSensor = 0x03 // 4
)

Variables

View Source
var (
	WarningColor = Color{
		R: 0xFF,
		G: 0x00,
		B: 0x00,
	}

	DefaultColor = Color{
		R: 0xFF,
		G: 0xFF,
		B: 0x00,
	}
)

Functions

This section is empty.

Types

type Color

type Color struct {
	R uint8
	G uint8
	B uint8
}

type CommanderPro

type CommanderPro struct {
	GetExternalTemp func(method, arg string) (temp float64, err error)
	// contains filtered or unexported fields
}

func Open

func Open() (cp *CommanderPro, err error)

func (*CommanderPro) CheckConfig

func (cp *CommanderPro) CheckConfig(configPath string)

func (*CommanderPro) Clear

func (cp *CommanderPro) Clear(ch uint8) (err error)

func (*CommanderPro) ClearGroup

func (cp *CommanderPro) ClearGroup(ch uint8) (err error)

func (*CommanderPro) Close

func (cp *CommanderPro) Close()

func (*CommanderPro) GetChannelDutyCycle

func (cp *CommanderPro) GetChannelDutyCycle(fan uint8) (dutyCycle uint8, err error)

func (*CommanderPro) GetChannelRPM

func (cp *CommanderPro) GetChannelRPM(fan FanCh) (rpm uint16, err error)

func (*CommanderPro) GetFanMask

func (cp *CommanderPro) GetFanMask() (fan1, fan2, fan3, fan4, fan5, fan6 FanMode, err error)

func (*CommanderPro) GetFanMode

func (cp *CommanderPro) GetFanMode(fan FanCh) (fanMode FanMode, err error)

func (*CommanderPro) GetTemp

func (cp *CommanderPro) GetTemp(sensor string) (temp float64, err error)

tempExtractor interface implementation

func (*CommanderPro) GetTempForSensor

func (cp *CommanderPro) GetTempForSensor(sensor TempSensor) (temp float64, err error)

func (*CommanderPro) LoadConfig

func (cp *CommanderPro) LoadConfig() (err error)

LoadConfigThresholds will update ipmi fan thresholds. `sudo watch ipmitool sensor` to get the current settings.

func (*CommanderPro) Name

func (cp *CommanderPro) Name() string

module interface implementation

func (*CommanderPro) Open

func (cp *CommanderPro) Open() (err error)

func (*CommanderPro) SetChannelCustomCurve

func (cp *CommanderPro) SetChannelCustomCurve(fan FanCh, tempSensor TempSensor, temps [6]uint16, rpms [6]uint16) error

Modes are listed in this order (shown with default values) "Default" (graph configuration request 0x25) 20 degC, 600 rpm ; 25 degC, 600 rpm ; 29 degC, 750 rpm ; 33 degC, 1000 rpm ; 37 degC, 1250 rpm ; 40 degC, 1500 rpm "Quiet" (graph configuration request 0x25) (same points as in "Default" mode above) "Balanced" (graph configuration request 0x25) 20 degC, 750 rpm ; 25 degC, 1000 rpm ; 29 degC, 1250 rpm ; 33 degC, 1500 rpm ; 37 degC, 1750 rpm ; 40 degC, 2000 rpm "Performance" (graph configuration request 0x25) 20 degC, 1000 rpm ; 25 degC, 1250 rpm ; 29 degC, 1500 rpm ; 33 degC, 1750 rpm ; 37 degC, 2000 rpm ; 40 degC, 2500 rpm "Custom" (graph configuration request 0x25) 20 degC, 600 rpm ; 30 degC, 600 rpm ; 40 degC, 750 rpm ; 50 degC, 1000 rpm ; 60 degC, 1250 rpm ; 70 degC, 1500 rpm "Fixed %" (percent configuration request 0x23) 40% "Fixed rpm" (rpm configuration request 0x24) 500 "Max" (percent configuration request) (100%) Note that the default mode seems to be "Balanced".

func (*CommanderPro) SetChannelDutyCycle

func (cp *CommanderPro) SetChannelDutyCycle(fan uint8, dutyCycle uint8) error

fanController interface implementation.

func (*CommanderPro) SetChannelFixedRPM

func (cp *CommanderPro) SetChannelFixedRPM(fan FanCh, rpm uint16) error

func (*CommanderPro) SetFanMode

func (cp *CommanderPro) SetFanMode(fan FanCh, fanMode FanMode) error

func (*CommanderPro) WriteFanExternalTemp

func (cp *CommanderPro) WriteFanExternalTemp(sensorIndex uint8, temp uint16) error

send to sensor? I don't think so... we send to a fan instead

func (*CommanderPro) WriteLedBrightness

func (cp *CommanderPro) WriteLedBrightness(ledCh uint8, brightness uint8) (err error)

brightness is 0-100

func (*CommanderPro) WriteLedCount

func (cp *CommanderPro) WriteLedCount(ledCh uint8, count uint8) (err error)

func (*CommanderPro) WriteLedExternalTemp

func (cp *CommanderPro) WriteLedExternalTemp(ledCh uint8, temp float64) (err error)

Transmitted regularly by the LINK software to notify temperature to each LED channel. These are transmitted for each LED channel, one for all strips/fans configured on that channel, if "Temperature" mode is enabled AND "Group" is set accordingly.

commands[0] = 0x36;
commands[1] = ctrl->channel;
commands[2] = ctrl->channel;
commands[3] = 0x0A;
commands[4] = 0x28;

func (*CommanderPro) WriteLedGroupSet

func (cp *CommanderPro) WriteLedGroupSet(ledCh, offset, len, ledMode, ledSpeed, ledDirection, ledStyle uint8,
	color1, color2, color3 Color,
	temp1, temp2, temp3 float64) (err error)

type Config

type Config struct {
	FanMode map[uint8]uint8 `yaml:"fan_mode"`

	// commanderpro, ipmi, cli
	// commanderpro: sensor_channel (int), ipmi: entityID, cli: custom_command
	ExternalTempExtractors map[string]externalTempExtractor `yaml:"external_temps"`

	LedCountPerCh map[uint8]uint8 `yaml:"led_count_per_ch"`

	TempShiftTest struct {
		Enabled bool
		Ch      uint8
		From    float64
		To      float64
	} `yaml:"temp_shift_test"`

	LedGroupConfigs map[string]struct {
		LedCh, LedOffset, LedCount, LedMode, LedSpeed, LedDirection, LedStyle uint8
		Color1, Color2, Color3                                                Color
		Temp1, Temp2, Temp3                                                   float64
		ExternalTemp                                                          string
	} `yaml:"led_group_configs"`
}

type FanCh

type FanCh byte

type FanMode

type FanMode byte

type TempSensor

type TempSensor byte

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL