- fix RPI crash when changing state of output pin
(reason: DetectAnyEdge() was also configured for output pins) - version string has now also build date - updated golang dependencies
This commit is contained in:
@@ -70,22 +70,8 @@ func (p *Pin) Command(cmd PinCommand) error {
|
||||
}
|
||||
|
||||
func (p *Pin) Configure() {
|
||||
if p.Direction == Input {
|
||||
log.Infof("configuring pin %s (pin no: %d) as Input", p.Name, p.Id)
|
||||
p.PinHandle.Input()
|
||||
} else if p.Direction == Output {
|
||||
log.Infof("configuring pin %s (pin no: %d) as Output", p.Name, p.Id)
|
||||
p.PinHandle.Output()
|
||||
if p.InitialState != nil {
|
||||
log.Infof("set initial state \"%s\" for pin %s (pin no: %d)", *p.InitialState, p.Name, p.Id)
|
||||
_ = p.Command(*p.InitialState)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
p.PinHandle.Detect(AnyEdge)
|
||||
|
||||
if p.PullConfig != nil {
|
||||
log.Infof("configuring Pull Resistor for pin %s (pin no: %d) as %s", p.Name, p.Id, *p.PullConfig)
|
||||
if *p.PullConfig == PullUp {
|
||||
p.PinHandle.PullUp()
|
||||
} else if *p.PullConfig == PullDown {
|
||||
@@ -97,6 +83,18 @@ func (p *Pin) Configure() {
|
||||
}
|
||||
}
|
||||
|
||||
if p.Direction == Input {
|
||||
log.Infof("configuring pin %s (pin no: %d) as Input", p.Name, p.Id)
|
||||
p.PinHandle.Input()
|
||||
p.PinHandle.Detect(AnyEdge)
|
||||
} else if p.Direction == Output {
|
||||
log.Infof("configuring pin %s (pin no: %d) as Output", p.Name, p.Id)
|
||||
p.PinHandle.Output()
|
||||
if p.InitialState != nil {
|
||||
log.Infof("set initial state \"%s\" for pin %s (pin no: %d)", *p.InitialState, p.Name, p.Id)
|
||||
_ = p.Command(*p.InitialState)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Pin) Changed() bool {
|
||||
|
||||
Reference in New Issue
Block a user