Start adding stubs and tests for combined axis, and updating RuleTargetAxis to support it.
This commit is contained in:
parent
4c04a9215d
commit
a7e78c33f3
3 changed files with 109 additions and 1 deletions
|
@ -14,6 +14,8 @@ type RuleTargetAxis struct {
|
|||
Inverted bool
|
||||
DeadzoneStart int32
|
||||
DeadzoneEnd int32
|
||||
OutputMin int32
|
||||
OutputMax int32
|
||||
axisSize int32
|
||||
deadzoneSize int32
|
||||
}
|
||||
|
@ -24,6 +26,26 @@ func NewRuleTargetAxis(device_name string,
|
|||
inverted bool,
|
||||
deadzoneStart int32,
|
||||
deadzoneEnd int32) (*RuleTargetAxis, error) {
|
||||
return NewRuleTargetAxisPartial(
|
||||
device_name,
|
||||
device,
|
||||
axis,
|
||||
inverted,
|
||||
deadzoneStart,
|
||||
deadzoneEnd,
|
||||
AxisValueMin,
|
||||
AxisValueMax,
|
||||
)
|
||||
}
|
||||
|
||||
func NewRuleTargetAxisPartial(device_name string,
|
||||
device Device,
|
||||
axis evdev.EvCode,
|
||||
inverted bool,
|
||||
deadzoneStart int32,
|
||||
deadzoneEnd int32,
|
||||
minOutput int32,
|
||||
maxOutput int32) (*RuleTargetAxis, error) {
|
||||
|
||||
info, err := device.AbsInfos()
|
||||
|
||||
|
@ -77,7 +99,7 @@ func NewRuleTargetAxis(device_name string,
|
|||
// in the deadzone, among other things.
|
||||
func (target *RuleTargetAxis) NormalizeValue(value int32) int32 {
|
||||
axisStrength := target.GetAxisStrength(value)
|
||||
return LerpInt(AxisValueMin, AxisValueMax, axisStrength)
|
||||
return LerpInt(target.OutputMin, target.OutputMax, axisStrength)
|
||||
}
|
||||
|
||||
func (target *RuleTargetAxis) CreateEvent(value int32, mode *string) *evdev.InputEvent {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue