Matrix/matrix.go

30 lines
895 B
Go

package main
import (
"fmt"
"os"
)
func loadMatrixData() (string, uint, uint) {
// Remote server info
API_SERVER_IP, _ := getEnvFallback("API_SERVER_IP", "localhost")
API_SERVER_PORT, _ := getEnvFallback("API_SERVER_PORT", "8080")
// LED panel info
PUBLIC_LED_WIDTH, _ := convertFallback(os.Getenv("PUBLIC_LED_WIDTH"), 64)
PUBLIC_LED_HEIGHT, _ := convertFallback(os.Getenv("PUBLIC_LED_HEIGHT"), 64)
// Matrix arrangement info
PUBLIC_LED_CHAIN, _ := convertFallback(os.Getenv("PUBLIC_LED_CHAIN"), 1)
PUBLIC_LED_PARALLEL, _ := convertFallback(os.Getenv("PUBLIC_LED_PARALLEL"), 1)
// Prepare remote server url
url := fmt.Sprintf("http://%s:%s", API_SERVER_IP, API_SERVER_PORT)
// Calculate combined resolution
width := uint(PUBLIC_LED_WIDTH * PUBLIC_LED_CHAIN)
height := uint(PUBLIC_LED_HEIGHT * PUBLIC_LED_PARALLEL)
return url, width, height
}