mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
pigpiod is only on ipv6?
This commit is contained in:
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
@@ -115,6 +115,7 @@ type IRConfig struct {
|
||||
Repeat int `yaml:"repeat" json:"repeat"`
|
||||
GapMs int `yaml:"gapMs" json:"gapMs"`
|
||||
ActiveLow bool `yaml:"activeLow" json:"activeLow"`
|
||||
PigpioAddr string `yaml:"pigpioAddr" json:"pigpioAddr"`
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
@@ -196,6 +197,7 @@ func LoadConfig(path string) (*Config, error) {
|
||||
Repeat: 3,
|
||||
GapMs: 100,
|
||||
ActiveLow: true,
|
||||
PigpioAddr: "localhost:8888",
|
||||
},
|
||||
}
|
||||
if err := yaml.Unmarshal(data, &cfg); err != nil {
|
||||
@@ -354,6 +356,9 @@ func validateIRConfig(cfg *IRConfig) error {
|
||||
if cfg.Pin <= 0 {
|
||||
return errors.New("pin must be > 0")
|
||||
}
|
||||
if cfg.PigpioAddr == "" {
|
||||
cfg.PigpioAddr = "localhost:8888"
|
||||
}
|
||||
if cfg.CarrierHz <= 0 {
|
||||
return errors.New("carrierHz must be > 0")
|
||||
}
|
||||
|
||||
+5
-2
@@ -14,7 +14,6 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
pigpioAddr = "127.0.0.1:8888"
|
||||
piCmdSetMode = 0
|
||||
piCmdWrite = 4
|
||||
piCmdWaveClear = 27
|
||||
@@ -104,7 +103,11 @@ func NewIRTransmitter(cfg IRConfig, logger *log.Logger) (*IRTransmitter, error)
|
||||
return nil, fmt.Errorf("ir disabled")
|
||||
}
|
||||
|
||||
client, err := connectPigpioWithRetry(pigpioAddr, logger)
|
||||
addr := cfg.PigpioAddr
|
||||
if addr == "" {
|
||||
addr = "localhost:8888"
|
||||
}
|
||||
client, err := connectPigpioWithRetry(addr, logger)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("connect pigpio: %w", err)
|
||||
}
|
||||
|
||||
@@ -65,3 +65,4 @@ ir:
|
||||
repeat: 3
|
||||
gapMs: 100
|
||||
activeLow: true
|
||||
pigpioAddr: localhost:8888
|
||||
|
||||
@@ -43,3 +43,4 @@ ir:
|
||||
repeat: 3
|
||||
gapMs: 100
|
||||
activeLow: true
|
||||
pigpioAddr: localhost:8888
|
||||
|
||||
Reference in New Issue
Block a user