Vary framerate by env
Signed-off-by: Martyn Ranyard <m@rtyn.berlin>
This commit is contained in:
parent
8edab5ba5e
commit
8c3df1dfa2
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue