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