arson... again

also update password or whatever
This commit is contained in:
Riley L. 2024-03-30 18:33:19 +01:00
parent 5233111f25
commit 623553622c
5 changed files with 26 additions and 26 deletions

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
"github.com/rileys-trash-can/newtecrs82obs" "github.com/rileys-trash-can/rs8"
"log" "log"
"os" "os"
) )
@ -12,7 +12,7 @@ func main() {
} }
port := os.Args[1] port := os.Args[1]
conn, err := nt8.Open(port) conn, err := rs8.Open(port)
if err != nil { if err != nil {
log.Fatalf("Failed to connect: %s", err) log.Fatalf("Failed to connect: %s", err)
} }
@ -25,10 +25,10 @@ func main() {
e := <-ch e := <-ch
switch event := e.(type) { switch event := e.(type) {
case *nt8.EventButton: case *rs8.EventButton:
log.Printf("%T %#v", event, event) log.Printf("%T %#v", event, event)
case *nt8.EventSlider: case *rs8.EventSlider:
log.Printf("%X %3d", event.Type, event.Value) log.Printf("%X %3d", event.Type, event.Value)
} }
} }

View File

@ -3,7 +3,7 @@ serial.port: "/dev/ttyUSB0"
boolshit: true boolshit: true
obs.addr: "10.10.42.160:4444" obs.addr: "10.10.42.160:4444"
obs.pass: "asdfgh" obs.pass: "LiviT2005"
trans.auto: "Fade" trans.auto: "Fade"
trans.take: "Cut" trans.take: "Cut"

View File

@ -6,7 +6,7 @@ import (
obss "github.com/andreykaipov/goobs/api/events/subscriptions" obss "github.com/andreykaipov/goobs/api/events/subscriptions"
obssc "github.com/andreykaipov/goobs/api/requests/scenes" obssc "github.com/andreykaipov/goobs/api/requests/scenes"
obst "github.com/andreykaipov/goobs/api/requests/transitions" obst "github.com/andreykaipov/goobs/api/requests/transitions"
"github.com/rileys-trash-can/newtecrs82obs" "github.com/rileys-trash-can/rs8"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
"log" "log"
"math/rand" "math/rand"
@ -50,7 +50,7 @@ func main() {
readconfig() readconfig()
port := Config.Serial port := Config.Serial
conn, err := nt8.Open(port) conn, err := rs8.Open(port)
if err != nil { if err != nil {
log.Fatalf("Failed to connect: %s", err) log.Fatalf("Failed to connect: %s", err)
} }
@ -126,34 +126,34 @@ func main() {
switch event := l.(type) { switch event := l.(type) {
case *obse.CurrentPreviewSceneChanged: case *obse.CurrentPreviewSceneChanged:
log.Printf("current preview scene: %s %d", event.SceneName, scenenamemap[event.SceneName]+1) log.Printf("current preview scene: %s %d", event.SceneName, scenenamemap[event.SceneName]+1)
program := make([]nt8.CmdLight, 0) program := make([]rs8.CmdLight, 0)
for i := uint8(0); i < 8; i++ { for i := uint8(0); i < 8; i++ {
program = append(program, nt8.CmdLight{ program = append(program, rs8.CmdLight{
Type: nt8.ButtonPreview, Type: rs8.ButtonPreview,
Value: i, Value: i,
State: nt8.LightOff, State: rs8.LightOff,
}) })
} }
program[7-scenenamemap[event.SceneName]].State = nt8.LightOn program[7-scenenamemap[event.SceneName]].State = rs8.LightOn
conn.LightCmdCh <- program conn.LightCmdCh <- program
break break
case *obse.CurrentProgramSceneChanged: case *obse.CurrentProgramSceneChanged:
log.Printf("current program scene: %s %d", event.SceneName, scenenamemap[event.SceneName]+1) log.Printf("current program scene: %s %d", event.SceneName, scenenamemap[event.SceneName]+1)
program := make([]nt8.CmdLight, 0) program := make([]rs8.CmdLight, 0)
for i := uint8(0); i < 8; i++ { for i := uint8(0); i < 8; i++ {
program = append(program, nt8.CmdLight{ program = append(program, rs8.CmdLight{
Type: nt8.ButtonProgram, Type: rs8.ButtonProgram,
Value: i, Value: i,
State: nt8.LightOff, State: rs8.LightOff,
}) })
} }
program[7-scenenamemap[event.SceneName]].State = nt8.LightOn program[7-scenenamemap[event.SceneName]].State = rs8.LightOn
conn.LightCmdCh <- program conn.LightCmdCh <- program
break break
@ -182,30 +182,30 @@ func main() {
case e := <-ch: case e := <-ch:
switch event := e.(type) { switch event := e.(type) {
case *nt8.EventButton: case *rs8.EventButton:
if event.Direction != 0 { if event.Direction != 0 {
continue continue
} }
switch event.Type { switch event.Type {
case nt8.ButtonProgram: case rs8.ButtonProgram:
log.Printf("Setting Program to %d", 7-event.Value) log.Printf("Setting Program to %d", 7-event.Value)
obsc.Scenes.SetCurrentProgramScene(&obssc.SetCurrentProgramSceneParams{ obsc.Scenes.SetCurrentProgramScene(&obssc.SetCurrentProgramSceneParams{
SceneName: &sceneindex[7-event.Value], SceneName: &sceneindex[7-event.Value],
}) })
break break
case nt8.ButtonPreview: case rs8.ButtonPreview:
log.Printf("Setting Program to %d", 7-event.Value) log.Printf("Setting Program to %d", 7-event.Value)
obsc.Scenes.SetCurrentPreviewScene(&obssc.SetCurrentPreviewSceneParams{ obsc.Scenes.SetCurrentPreviewScene(&obssc.SetCurrentPreviewSceneParams{
SceneName: &sceneindex[7-event.Value], SceneName: &sceneindex[7-event.Value],
}) })
break break
case nt8.ButtonAutoTakeDSK: case rs8.ButtonAutoTakeDSK:
switch event.Value { switch event.Value {
case 0x01: // TAKE or 0x02 case 0x01: // TAKE or 0x02
if deb(nt8.ButtonAutoTakeDSK<<8 | 0x01) { if deb(rs8.ButtonAutoTakeDSK<<8 | 0x01) {
continue continue
} }
@ -274,8 +274,8 @@ func main() {
} }
break break
case *nt8.EventSlider: case *rs8.EventSlider:
if event.Type == nt8.SliderTbar { if event.Type == rs8.SliderTbar {
value := (float64(event.Value)) / 250 value := (float64(event.Value)) / 250
if value > 1 { if value > 1 {
value = 1 value = 1

2
go.mod
View File

@ -1,4 +1,4 @@
module github.com/rileys-trash-can/newtecrs82obs module github.com/rileys-trash-can/rs8
go 1.22.1 go 1.22.1

View File

@ -1,4 +1,4 @@
package nt8 package rs8
import ( import (
"bufio" "bufio"