Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
de4758c563 | ||
![]() |
a85c9ccd66 | ||
![]() |
da78a00446 | ||
![]() |
ba3c55dc34 | ||
![]() |
e0950b44ee |
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@@ -36,9 +36,9 @@ jobs:
|
||||
run: |
|
||||
mkdir -p build
|
||||
if [ "${{ matrix.goos }}" == "windows" ]; then
|
||||
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o build/tecamino-driver-artNet-${{ matrix.goos }}-${{ matrix.goarch }}.exe main.go
|
||||
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-s -w" -trimpath -o build/tecamino-driver-artNet-${{ matrix.goos }}-${{ matrix.goarch }}.exe main.go
|
||||
else
|
||||
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o build/tecamino-driver-artNet-${{ matrix.goos }}-${{ matrix.goarch }} main.go
|
||||
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-s -w" -trimpath -o build/tecamino-driver-artNet-${{ matrix.goos }}-${{ matrix.goarch }} main.go
|
||||
fi
|
||||
|
||||
- name: Upload artifacts
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
.DS_Store
|
||||
*.cfg
|
||||
*.log
|
||||
artNetDriver-arm64
|
||||
|
@@ -107,9 +107,11 @@ func (b *Bus) Start(log *logging.Logger) error {
|
||||
var ctx context.Context
|
||||
ctx, b.Watchdog = context.WithCancel(context.Background())
|
||||
|
||||
b.Send = make(chan *DMX, 1024)
|
||||
|
||||
go func() {
|
||||
var interval time.Duration = 10 * time.Second
|
||||
log.Info("bus.Start", fmt.Sprintf("device:%s ip:%s watchdog stopped", b.Name, b.Ip))
|
||||
log.Info("bus.Start", fmt.Sprintf("device:%s ip:%s watchdog starting", b.Name, b.Ip))
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
@@ -126,6 +128,8 @@ func (b *Bus) Start(log *logging.Logger) error {
|
||||
interval = 5 * time.Second
|
||||
} else {
|
||||
b.Reachable = true
|
||||
// send data as a heartbeat for she ArtNet Protocol
|
||||
b.Send <- b.Data
|
||||
log.Info("bus.Start", fmt.Sprintf("device:%s ip:%s watchdog running", b.Name, b.Ip))
|
||||
interval = 30 * time.Second
|
||||
}
|
||||
@@ -143,12 +147,11 @@ func (b *Bus) Start(log *logging.Logger) error {
|
||||
return err
|
||||
}
|
||||
|
||||
b.Send = make(chan *DMX, 1024)
|
||||
|
||||
go func() {
|
||||
defer conn.Close()
|
||||
//close send channel
|
||||
close(b.Send)
|
||||
defer close(b.Send)
|
||||
|
||||
for send := range b.Send {
|
||||
_, err = conn.Write(NewArtNetPackage(send))
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user