Fix weather announce loop
This commit is contained in:
parent
c9596faa78
commit
0ea7bc2a49
@ -34,7 +34,6 @@ type Player struct {
|
|||||||
endRoutines []*reveil.Routine
|
endRoutines []*reveil.Routine
|
||||||
|
|
||||||
ntick int64
|
ntick int64
|
||||||
hasClaironed bool
|
|
||||||
hasSpokeWeather bool
|
hasSpokeWeather bool
|
||||||
launched time.Time
|
launched time.Time
|
||||||
volume uint16
|
volume uint16
|
||||||
@ -170,7 +169,7 @@ loop:
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-p.currentCmdCh:
|
case <-p.currentCmdCh:
|
||||||
if !p.hasClaironed && time.Since(p.launched) >= p.claironTime {
|
if time.Since(p.launched) >= p.claironTime {
|
||||||
log.Println("clairon time!")
|
log.Println("clairon time!")
|
||||||
p.claironTime += p.claironTime / 2
|
p.claironTime += p.claironTime / 2
|
||||||
p.SetVolume(65535)
|
p.SetVolume(65535)
|
||||||
@ -178,8 +177,8 @@ loop:
|
|||||||
go p.playFile(p.claironFile)
|
go p.playFile(p.claironFile)
|
||||||
} else if p.weatherAction != nil && !p.hasSpokeWeather && time.Since(p.launched) >= p.weatherTime {
|
} else if p.weatherAction != nil && !p.hasSpokeWeather && time.Since(p.launched) >= p.weatherTime {
|
||||||
log.Println("weather time!")
|
log.Println("weather time!")
|
||||||
p.SetVolume(65535)
|
|
||||||
p.dontUpdateVolume = true
|
p.dontUpdateVolume = true
|
||||||
|
p.hasSpokeWeather = true
|
||||||
go p.launchAction(p.weatherAction)
|
go p.launchAction(p.weatherAction)
|
||||||
} else {
|
} else {
|
||||||
p.dontUpdateVolume = false
|
p.dontUpdateVolume = false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user