Skip to content

Commit

Permalink
added voicetarget led functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
talkkonnect committed Aug 30, 2021
1 parent b042926 commit 6d4675f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ keyPressListenerLoop:
case "record":
b.cmdAudioTrafficRecord()
b.cmdAudioMicRecord()
case "voicetargetset":
case "setvoicetarget":
voicetarget, err := strconv.Atoi(TTYKeyMap[ev.Ch].ParamValue)
if err != nil {
log.Println("error: Target is Non-Numeric Value")
Expand Down
6 changes: 6 additions & 0 deletions clientcommands.go
Original file line number Diff line number Diff line change
Expand Up @@ -729,8 +729,10 @@ func (b *Talkkonnect) VoiceTargetUserSet(TargetID uint32, TargetUser string) {
b.Client.VoiceTarget = vtarget
if TargetID > 0 {
log.Printf("debug: Added User %v to VT ID %v\n", TargetUser, TargetID)
LEDOnFunc(VoiceTargetLED)
} else {
//b.VoiceTarget.Clear()
LEDOffFunc(VoiceTargetLED)
log.Println("debug: Cleared Voice Targets")
}
b.Client.Send(vtarget)
Expand Down Expand Up @@ -765,6 +767,7 @@ func (b *Talkkonnect) VoiceTargetChannelSet(targetID uint32, targetChannelName s
b.Client.VoiceTarget = vtarget
b.Client.Send(vtarget)
log.Printf("debug: Shouting to Root Channel %v to VT ID %v with recursive %v links %v group %v\n", vChannel.Name, targetID, recursive, links, group)
LEDOffFunc(VoiceTargetLED)
return
}

Expand All @@ -777,4 +780,7 @@ func (b *Talkkonnect) VoiceTargetChannelSet(targetID uint32, targetChannelName s
b.Client.VoiceTarget = vtarget
b.Client.Send(vtarget)
log.Printf("debug: Shouting to Child Channel %v to VT ID %v with recursive %v links %v group %v\n", vChannel.Name, targetID, recursive, links, group)
if targetID > 0 {
LEDOnFunc(VoiceTargetLED)
}
}
9 changes: 9 additions & 0 deletions gpio.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,11 @@ func (b *Talkkonnect) initGPIO() {
if VoiceActivityLEDPin > 0 {
VoiceActivityLED = gpio.NewOutput(VoiceActivityLEDPin, false)
}

if VoiceTargetLEDPin > 0 {
VoiceTargetLED = gpio.NewOutput(VoiceTargetLEDPin, false)
}

}

func LEDOnFunc(LED gpio.Pin) {
Expand Down Expand Up @@ -397,6 +402,10 @@ func (b *Talkkonnect) LEDOffAll() {
LEDOffFunc(VoiceActivityLED)
}

if VoiceTargetLEDPin > 0 {
LEDOffFunc(VoiceTargetLED)
}

}

func MyLedStripLEDOffAll() {
Expand Down
23 changes: 15 additions & 8 deletions xmlparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import (

//version and release date
const (
talkkonnectVersion string = "1.67.21"
talkkonnectVersion string = "1.67.22"
talkkonnectReleased string = "Aug 30 2021"
)

Expand Down Expand Up @@ -326,13 +326,16 @@ var (
OnlineLEDPin uint
AttentionLEDPin uint
HeartBeatLEDPin uint
VoiceActivityLED gpio.Pin
ParticipantsLED gpio.Pin
TransmitLED gpio.Pin
OnlineLED gpio.Pin
AttentionLED gpio.Pin
HeartBeatLED gpio.Pin
BackLightLED gpio.Pin
VoiceTargetLEDPin uint

VoiceActivityLED gpio.Pin
ParticipantsLED gpio.Pin
TransmitLED gpio.Pin
OnlineLED gpio.Pin
AttentionLED gpio.Pin
HeartBeatLED gpio.Pin
BackLightLED gpio.Pin
VoiceTargetLED gpio.Pin
)

//heartbeat light settings
Expand Down Expand Up @@ -746,6 +749,7 @@ type DocumentStruct struct {
TransmitLedPin string `xml:"transmitledpin"`
OnlineLedPin string `xml:"onlineledpin"`
AttentionLedPin string `xml:"attentionledpin"`
VoiceTargetLedPin string `xml:"voicetargetledpin"`
} `xml:"lights"`
HeartBeat struct {
Enabled bool `xml:"enabled,attr"`
Expand Down Expand Up @@ -1476,6 +1480,8 @@ func readxmlconfig(file string) error {
OnlineLEDPin = uint(temp4)
temp14, _ := strconv.ParseUint(Document.Global.Hardware.Lights.AttentionLedPin, 10, 64)
AttentionLEDPin = uint(temp14)
temp15, _ := strconv.ParseUint(Document.Global.Hardware.Lights.VoiceTargetLedPin, 10, 64)
VoiceTargetLEDPin = uint(temp15)

temp5, _ := strconv.ParseUint(Document.Global.Hardware.HeartBeat.LEDPin, 10, 64)
HeartBeatLEDPin = uint(temp5)
Expand Down Expand Up @@ -1823,6 +1829,7 @@ func printxmlconfig() {
log.Println("info: Transmit Led Pin " + fmt.Sprintf("%v", TransmitLEDPin))
log.Println("info: Online Led Pin " + fmt.Sprintf("%v", OnlineLEDPin))
log.Println("info: Attention Led Pin " + fmt.Sprintf("%v", AttentionLEDPin))
log.Println("info: VoiceTarget Led Pin " + fmt.Sprintf("%v", VoiceTargetLEDPin))
} else {
log.Println("info: ------------ LEDS ---------------------- SKIPPED ")
}
Expand Down

0 comments on commit 6d4675f

Please sign in to comment.