pigpiod is only on ipv6?

This commit is contained in:
legop3
2026-01-15 12:06:22 -05:00
parent d272a33dc2
commit 6c01087738
6 changed files with 12 additions and 2 deletions
Vendored
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+5
View File
@@ -115,6 +115,7 @@ type IRConfig struct {
Repeat int `yaml:"repeat" json:"repeat"` Repeat int `yaml:"repeat" json:"repeat"`
GapMs int `yaml:"gapMs" json:"gapMs"` GapMs int `yaml:"gapMs" json:"gapMs"`
ActiveLow bool `yaml:"activeLow" json:"activeLow"` ActiveLow bool `yaml:"activeLow" json:"activeLow"`
PigpioAddr string `yaml:"pigpioAddr" json:"pigpioAddr"`
} }
type Config struct { type Config struct {
@@ -196,6 +197,7 @@ func LoadConfig(path string) (*Config, error) {
Repeat: 3, Repeat: 3,
GapMs: 100, GapMs: 100,
ActiveLow: true, ActiveLow: true,
PigpioAddr: "localhost:8888",
}, },
} }
if err := yaml.Unmarshal(data, &cfg); err != nil { if err := yaml.Unmarshal(data, &cfg); err != nil {
@@ -354,6 +356,9 @@ func validateIRConfig(cfg *IRConfig) error {
if cfg.Pin <= 0 { if cfg.Pin <= 0 {
return errors.New("pin must be > 0") return errors.New("pin must be > 0")
} }
if cfg.PigpioAddr == "" {
cfg.PigpioAddr = "localhost:8888"
}
if cfg.CarrierHz <= 0 { if cfg.CarrierHz <= 0 {
return errors.New("carrierHz must be > 0") return errors.New("carrierHz must be > 0")
} }
+5 -2
View File
@@ -14,7 +14,6 @@ import (
) )
const ( const (
pigpioAddr = "127.0.0.1:8888"
piCmdSetMode = 0 piCmdSetMode = 0
piCmdWrite = 4 piCmdWrite = 4
piCmdWaveClear = 27 piCmdWaveClear = 27
@@ -104,7 +103,11 @@ func NewIRTransmitter(cfg IRConfig, logger *log.Logger) (*IRTransmitter, error)
return nil, fmt.Errorf("ir disabled") 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 { if err != nil {
return nil, fmt.Errorf("connect pigpio: %w", err) return nil, fmt.Errorf("connect pigpio: %w", err)
} }
+1
View File
@@ -65,3 +65,4 @@ ir:
repeat: 3 repeat: 3
gapMs: 100 gapMs: 100
activeLow: true activeLow: true
pigpioAddr: localhost:8888
+1
View File
@@ -43,3 +43,4 @@ ir:
repeat: 3 repeat: 3
gapMs: 100 gapMs: 100
activeLow: true activeLow: true
pigpioAddr: localhost:8888