Vary framerate by env
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

Signed-off-by: Martyn Ranyard <m@rtyn.berlin>
This commit is contained in:
Martyn 2020-07-13 17:14:02 +02:00
parent 8edab5ba5e
commit 8c3df1dfa2
1 changed files with 7 additions and 1 deletions

View File

@ -30,9 +30,11 @@ var overrideEffect queue.QueueItem
var overrideFlag = make(chan queue.QueueItem, 1) var overrideFlag = make(chan queue.QueueItem, 1)
var previousEffect queue.QueueItem var previousEffect queue.QueueItem
var msDelay = 0
func foreverLoop() { func foreverLoop() {
for /*ever*/ { for /*ever*/ {
time.Sleep(40 * time.Millisecond) //25fps time.Sleep(time.Duration(msDelay) * time.Millisecond) //25fps
for u := 0; u < universeCount; u++ { for u := 0; u < universeCount; u++ {
sema <- struct{}{} // acquire token sema <- struct{}{} // acquire token
channels[u] <- currentFrame[u] channels[u] <- currentFrame[u]
@ -75,6 +77,10 @@ func main() {
if err != nil { if err != nil {
PanelHeight = 15 PanelHeight = 15
} }
msDelay, err = strconv.Atoi(os.Getenv("MS_DELAY"))
if err != nil {
msDelay = 40
}
universeCount = int(math.Ceil(float64(PanelHeight*PanelWidth*3) / 510)) universeCount = int(math.Ceil(float64(PanelHeight*PanelWidth*3) / 510))
fmt.Printf("Universe count is %d\n", universeCount) fmt.Printf("Universe count is %d\n", universeCount)