Skip to content

Commit

Permalink
fixed bug in volume level display
Browse files Browse the repository at this point in the history
  • Loading branch information
talkkonnect committed Jan 13, 2022
1 parent 330dcdc commit 7e3daa5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions commandkeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,19 @@ func (b *Talkkonnect) cmdCurrentVolume() {
}

func (b *Talkkonnect) cmdVolumeUp() {
log.Println("debug: F5 pressed Volume UP (+)")
origVolume, err := volume.GetVolume(Config.Global.Software.Settings.OutputVolControlDevice)
if err != nil {
log.Printf("warn: unable to get original volume: %+v\n", err)
log.Printf("warn: unable to get original volume: %+v volume control will not work!\n", err)
return
}

if origVolume < 100 {
err := volume.IncreaseVolume(Config.Global.Hardware.IO.VolumeButtonStep.VolUpStep, Config.Global.Software.Settings.OutputVolControlDevice)
if err != nil {
log.Println("warn: F5 Increase Volume Failed! ", err)
}

log.Println("debug: F5 pressed Volume UP (+)")
origVolume, _ := volume.GetVolume(Config.Global.Software.Settings.OutputVolControlDevice)
log.Println("info: Volume UP (+) Now At ", origVolume, "%")
if Config.Global.Hardware.TargetBoard == "rpi" {
if LCDEnabled {
Expand All @@ -214,24 +215,23 @@ func (b *Talkkonnect) cmdVolumeUp() {
}
}
}

TTSEvent("digitalvolumeup")
}

func (b *Talkkonnect) cmdVolumeDown() {
log.Println("info: F6 pressed Volume Down (-)")
origVolume, err := volume.GetVolume(Config.Global.Software.Settings.OutputVolControlDevice)
if err != nil {
log.Printf("error: unable to get original volume: %+v\n", err)
log.Printf("warn: unable to get original volume: %+v volume control will not work!\n", err)
return
}

if origVolume > 0 {
origVolume--
err := volume.IncreaseVolume(Config.Global.Hardware.IO.VolumeButtonStep.VolDownStep, Config.Global.Software.Settings.OutputVolControlDevice)
if err != nil {
log.Println("error: F6 Decrease Volume Failed! ", err)
}

log.Println("info: F6 pressed Volume Down (-)")
origVolume, _ := volume.GetVolume(Config.Global.Software.Settings.OutputVolControlDevice)
log.Println("info: Volume Down (-) Now At ", origVolume, "%")
if Config.Global.Hardware.TargetBoard == "rpi" {
if LCDEnabled {
Expand Down
4 changes: 2 additions & 2 deletions version.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
package talkkonnect

const (
talkkonnectVersion string = "2.07.23"
talkkonnectVersion string = "2.07.24"
talkkonnectReleased string = "Jan 13 2022"
)

/* Release Notes
1. Fixed not working cancellable stream bug in stream.go
1. Fixed bug in volume displayed
*/

0 comments on commit 7e3daa5

Please sign in to comment.