implement matrix instance for clock

This commit is contained in:
waltem01 2024-03-08 11:26:32 +01:00
parent be55d35f67
commit 205d96f399

View File

@ -1,5 +1,12 @@
<script lang="ts">
import {
PUBLIC_LED_CHAIN,
PUBLIC_LED_HEIGHT,
PUBLIC_LED_PARALLEL,
PUBLIC_LED_WIDTH
} from '$env/static/public';
import { redirectAPI } from '$lib/client/httpRequests';
import type { Matrix } from '$lib/client/matrix';
import { onMount } from 'svelte';
// Data structure to keep track of clock
@ -39,6 +46,7 @@
//.System variables
let clockEnabled: boolean = false;
let matrix: Matrix;
const clock: Clock = {
body: 48,
hands: {
@ -101,6 +109,10 @@
onMount(() => {
setInterval(update, clock.speed * 1000);
matrix = {
width: +PUBLIC_LED_WIDTH * +PUBLIC_LED_CHAIN,
height: +PUBLIC_LED_HEIGHT * +PUBLIC_LED_PARALLEL
};
});
</script>