Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"vitest": "^4.0.18"
},
"dependencies": {
"@intechstudio/grid-protocol": "1.20260302.1321",
"@intechstudio/grid-protocol": "1.20260506.533",
"@intechstudio/grid-uikit": "^1.20260421.817",
"@intechstudio/profile-cloud-webcomponent": "1.20251107.1414",
"adm-zip": "^0.5.10",
Expand Down
7 changes: 7 additions & 0 deletions src/renderer/lib/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,11 @@ export namespace Grid {
{ value: "1", info: "Potmeter layer" },
{ value: "2", info: "Unused layer" },
];
case ElementType.TOUCH:
return [
{ value: "1", info: "Touch layer" },
{ value: "2", info: "Unused layer" },
];
default: {
const defaultLayerSuggestion = [
{ value: "1", info: "Layer 1" },
Expand All @@ -337,6 +342,7 @@ export namespace Grid {
PBF4 = "PBF4",
EF44 = "EF44",
VSNX = "VSNX",
XY = "XY",
}

const typeToArchetypeMap = {
Expand All @@ -351,6 +357,7 @@ export namespace Grid {
[ModuleType.VSN1L]: Module.Archetype.VSNX,
[ModuleType.VSN1R]: Module.Archetype.VSNX,
[ModuleType.VSN2]: Module.Archetype.VSNX,
[ModuleType.XY]: Module.Archetype.XY,
};

export function toArchetype(type: ModuleType): Module.Archetype {
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/main/grid-layout/grid-modules/Device.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import EF44 from "./devices/EF44.svelte";
import VSNX from "./devices/VSNX.svelte";
import OCTV from "./devices/OCTV.svelte";
import XY from "./devices/XY.svelte";

//Overlays
import ControlNameOverlay from "./overlays/ControlNameOverlay.svelte";
Expand Down Expand Up @@ -103,6 +104,7 @@
{ type: "VSN1R", component: VSNX },
{ type: "VSN2", component: VSNX },
{ type: "OCTV", component: OCTV },
{ type: "XY", component: XY },
];
component = components.find((e) => e.type === device?.type).component;
});
Expand Down
113 changes: 113 additions & 0 deletions src/renderer/main/grid-layout/grid-modules/devices/XY.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<script lang="ts">
import Led from "../elements/Led.svelte";
import { GridModule, GridRuntime } from "../../../../runtime/runtime.js";

export let moduleWidth;
export let id = "XY";
export let device: GridModule;

let runtime = device.parent as GridRuntime;
let eps = runtime?.elementPositionStore;
let lcs = runtime?.ledColorStore;

let [dx, dy] = [device?.dx, device?.dy];

let ledcolor_array = Array(25)
.fill(null)
.map(() => [0, 0, 0]);

$: {
const value = $lcs;
try {
let lcs = value[dx][dy];
for (const key in lcs) {
ledcolor_array[key] = lcs[key];
}
} catch (error) {
//ERROR
}
}

$: if (id) {
if (id !== undefined && id.length > 4) {
dx = +id.split(";")[0].split(":").pop();
dy = +id.split(";")[1].split(":").pop();
}
}
</script>

<div
{...$$restProps}
class="module-dimensions relative bg-background"
style="--module-size: {moduleWidth + 'px'}; transform: rotate({device?.rot *
-90}deg)"
>
<div class="module-underlay-container">
<slot name="module-underlay" {device} />
</div>

<!-- Touch element covering the full module -->
<div class="absolute inset-0">
<div class="normal-cell-underlay-container">
<slot name="cell-underlay" elementNumber={0} />
</div>
<div class="normal-cell-ui-container">
<div
class="absolute inset-0 rounded"
style="background: color-mix(in srgb, var(--background-soft) 30%, transparent);"
/>
<svg class="absolute inset-0 w-full h-full pointer-events-none">
{#each [10, 30, 50, 70, 90] as pct}
{#each [0, 1, 2, 3] as seg}
<line
x1="calc({seg * 20 + 10}% + 4.2px)"
y1="{pct}%"
x2="calc({seg * 20 + 30}% - 4.2px)"
y2="{pct}%"
stroke="color-mix(in srgb, var(--foreground) 15%, transparent)"
stroke-width="1"
/>
<line
x1="{pct}%"
y1="calc({seg * 20 + 10}% + 4.2px)"
x2="{pct}%"
y2="calc({seg * 20 + 30}% - 4.2px)"
stroke="color-mix(in srgb, var(--foreground) 15%, transparent)"
stroke-width="1"
/>
{/each}
{/each}
</svg>
{#each ledcolor_array as color, i}
{@const col = i % 5}
{@const row = Math.floor(i / 5)}
<div
class="absolute"
style="left: {col * 20 + 10}%; top: {row * 20 +
10}%; transform: translate(-50%, -50%);"
>
<Led {color} size={1.4} />
</div>
{/each}
</div>
<div class="normal-cell-overlay-container">
<slot name="cell-overlay" elementNumber={0} />
</div>
</div>

<!-- System element -->
<div
class="bottom-0 left-1/2 -translate-x-1/2 w-[50px] h-[27px] rounded-t-full system-cell-underlay-container"
>
<slot name="cell-underlay" elementNumber={255} />
</div>
<div
class="bottom-0 left-1/2 -translate-x-1/2 w-[50px] h-[27px] rounded-t-full system-cell-overlay-container"
>
<slot name="cell-overlay" elementNumber={255} />
</div>

<div class="module-overlay-container">
<slot name="module-overlay" {device} />
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
export let elementNumber;
</script>

<div class="w-full h-full" data-control-number={elementNumber} />
7 changes: 7 additions & 0 deletions src/renderer/main/modals/AddVirtualModule.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import EF44 from "./../grid-layout/grid-modules/devices/EF44.svelte";
import VSNX from "./../grid-layout/grid-modules/devices/VSNX.svelte";
import OCTV from "./../grid-layout/grid-modules/devices/OCTV.svelte";
import XY from "./../grid-layout/grid-modules/devices/XY.svelte";

import { ModuleType } from "@intechstudio/grid-protocol";
import { Analytics } from "./../../runtime/analytics.js";
Expand Down Expand Up @@ -77,6 +78,12 @@
unrelease: true,
hwcfg: 123,
},
{
id: ModuleType.XY,
type: ModuleType.XY,
component: XY,
hwcfg: 161,
},
];

export let dx = 0;
Expand Down
12 changes: 7 additions & 5 deletions src/renderer/runtime/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2272,16 +2272,16 @@ export class GridRuntime extends RuntimeNode<RuntimeData> {

create_module(header_param, heartbeat_class_param, virtual = false) {
const hwcfg = Number(heartbeat_class_param.HWCFG);
const revision: string = grid
.module_hwcfgs()
.find((e) => Number(e.hwcfg) === hwcfg).revision;
const moduleType = grid.module_type_from_hwcfg(hwcfg);
const hwcfgEntry = grid
.module_hwcfgs()
.find((e) => Number(e.hwcfg) === hwcfg);

// generic check, code below if works only if all parameters are provided
if (
header_param === undefined ||
moduleType === undefined ||
heartbeat_class_param === undefined
heartbeat_class_param === undefined ||
hwcfgEntry === undefined
) {
console.warn(
hwcfg,
Expand All @@ -2293,6 +2293,8 @@ export class GridRuntime extends RuntimeNode<RuntimeData> {
throw "Error creating new module.";
}

const revision: string = hwcfgEntry.revision;

return new GridModule(
this,
new ModuleData(
Expand Down
4 changes: 1 addition & 3 deletions src/renderer/tests/string-operations.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ test("Default configuration compression/expansion", function () {
const events = grid.get_element_events(element);
if (typeof events !== "undefined") {
events.forEach((event) => {
const defaultConfig = event.defaultConfig
.split("<?lua ")[1]
.split(" ?>")[0];
const defaultConfig = event.defaultConfig;
const expanded = GridScript.expandScript(defaultConfig);
const compressed = GridScript.compressScript(expanded);
// Compare compressed versions since minification normalizes whitespace
Expand Down
Loading