mirror of
https://gitlab1.ptb.de/waltem01/Matrix
synced 2024-12-26 12:01:45 +00:00
30 lines
881 B
Go
30 lines
881 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"os"
|
||
|
)
|
||
|
|
||
|
func loadMatrixData() (string, int, int) {
|
||
|
// 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 := PUBLIC_LED_WIDTH * PUBLIC_LED_CHAIN
|
||
|
height := PUBLIC_LED_HEIGHT * PUBLIC_LED_PARALLEL
|
||
|
|
||
|
return url, width, height
|
||
|
}
|