Skip to content

Commit

Permalink
Merge pull request #113 from intechstudio/SUKU-dev
Browse files Browse the repository at this point in the history
ED-10 ED-69
  • Loading branch information
SukuWc authored Jul 11, 2022
2 parents 36ecd99 + 23723f5 commit 8d507a6
Show file tree
Hide file tree
Showing 13 changed files with 363 additions and 45 deletions.
2 changes: 1 addition & 1 deletion configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

"FIRMWARE_REQUIRED_MAJOR":1,
"FIRMWARE_REQUIRED_MINOR":2,
"FIRMWARE_REQUIRED_PATCH":17,
"FIRMWARE_REQUIRED_PATCH":18,

"USB_VID_0": "0x03eb",
"USB_PID_0": "0xecac",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "grid_editor",
"version": "1.2.25",
"version": "1.2.26",
"main": "./src/electron.js",
"repository": {
"type": "git",
Expand Down
48 changes: 48 additions & 0 deletions src/app/config-blocks/EncoderPushRotLeftRight_Else.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<script context="module">
// config descriptor parameters
export const information = {
short: 'eprlrel',
name: 'EncoderPushRotLeftRight_Else',
rendering: 'modifier',
category: null,
desc: 'Just Rotate Right',
blockTitle: 'Just Rotate Right',
defaultLua: 'else',
icon: `
<svg width="100%" height="100%" viewBox="0 0 445 338" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M432.948 93.9257L395.246 109.556C357.194 50.9139 296.268 11.809 226.276 9.98442C165.88 8.40996 110.709 34.9309 70.3406 78.6089C46.0213 104.922 27.0302 137.494 15.3859 174.038C15.2179 174.566 15.0515 175.094 14.8866 175.622L12.4303 183.499L12.4284 183.505L28.2646 188.4L28.266 188.395L30.7228 180.517C41.6155 145.588 59.5921 114.619 82.5431 89.7861C120.085 49.166 170.814 25.0519 225.842 26.4864C285.255 28.0352 338.164 59.0953 373.846 107.692C375.842 110.411 377.785 113.185 379.672 116.013L344.57 130.565L420.632 188.441L432.948 93.9257ZM364.4 111.607L324.834 128.011L428.254 206.703L445 78.1928L398.946 97.2856C359.14 40.111 297.454 1.91866 226.535 0.0698728C162.943 -1.58788 105.12 26.3655 63.057 71.8773C37.3556 99.686 17.4397 134.122 5.41835 172.67L0 190.045L34.7876 200.796L40.191 183.47C50.6592 149.902 67.907 120.235 89.8267 96.5177C125.672 57.7331 173.749 35.0497 225.584 36.4009C280.736 37.8387 330.326 66.2797 364.4 111.607Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M222.688 307.456C271.986 307.456 311.95 267.492 311.95 218.194C311.95 168.897 271.986 128.933 222.688 128.933C173.391 128.933 133.427 168.897 133.427 218.194C133.427 267.492 173.391 307.456 222.688 307.456ZM222.688 337.209C288.419 337.209 341.704 283.924 341.704 218.194C341.704 152.464 288.419 99.1792 222.688 99.1792C156.958 99.1792 103.673 152.464 103.673 218.194C103.673 283.924 156.958 337.209 222.688 337.209Z" fill="black"/>
<path d="M395.246 109.556C357.194 50.9139 296.268 11.809 226.276 9.98442C165.88 8.40996 110.709 34.9309 70.3406 78.6089C46.0213 104.922 27.0302 137.494 15.3859 174.038C15.2179 174.566 15.0515 175.094 14.8866 175.622L12.4303 183.499L12.4284 183.505L28.2646 188.4L28.266 188.395L30.7228 180.517C41.6155 145.588 59.5921 114.619 82.5431 89.7861C120.085 49.166 170.814 25.0519 225.842 26.4864C285.255 28.0352 338.164 59.0953 373.846 107.692C375.842 110.411 377.785 113.185 379.672 116.013L344.57 130.565L420.632 188.441L432.948 93.9257L395.246 109.556Z" fill="black"/>
</svg>
`,
color: '#4A4AA7'
}
</script>

<script>
import { onMount, createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher();
function sendData(){
dispatch('output', {short: information.short, script: information.defaultLua})
}
onMount(()=>{
sendData();
})
</script>




<else-block class="w-full h-fit flex flex-col text-white py-1" style="min-height: 2.5rem; background: {information.color};">



</else-block>

117 changes: 117 additions & 0 deletions src/app/config-blocks/EncoderPushRotLeftRight_ElseIf.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<script context="module">
// config descriptor parameters
export const information = {
short: 'eprlrei',
name: 'Condition_ElseIf',
rendering: 'modifier',
category: null,
desc: 'PRLR Else IF',
blockTitle: 'PRLR Else IF',
defaultLua: 'else if then',
icon: `
<svg width="100%" height="100%" viewBox="0 0 277 277" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M131.429 2.92893C135.334 -0.976311 141.666 -0.976311 145.571 2.92893L274.071 131.429C277.976 135.334 277.976 141.666 274.071 145.571L145.571 274.071C141.666 277.976 135.334 277.976 131.429 274.071L2.92893 145.571C-0.976311 141.666 -0.976311 135.334 2.92893 131.429L131.429 2.92893ZM24.1421 138.5L138.5 252.858L252.858 138.5L138.5 24.1421L24.1421 138.5Z" fill="black"/>
</svg>
`,
color: '#4A4AA7'
}
</script>

<script>
import { createEventDispatcher, onDestroy, onMount } from 'svelte';
import stringManipulation from '../main/user-interface/_string-operations';
import { parenthesis } from './_validators';
const dispatch = createEventDispatcher();
export let config = ''
export let index;
export let access_tree;
import LineEditor from '../main/user-interface/LineEditor.svelte'
import { appSettings, windowSize } from "../runtime/app-helper.store";
let sidebarWidth;
export let informationOverride = {
blockTitle: ""
};
$: if(windowSize.rightSidebarWidth){
sidebarWidth = windowSize.rightSidebarWidth
}
let loaded = false;
let scriptSegment = ''; // local script part
$: if(config.script && !loaded){
scriptSegment = stringManipulation.humanize(config.script.slice(7, -5));
loaded = true;
if (scriptSegment.includes("64")){
informationOverride.blockTitle = "Just Rotate Left";
informationOverride.icon = `
<svg width="100%" height="100%" viewBox="0 0 445 338" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M362.457 89.786C324.915 49.1659 274.185 25.0518 219.158 26.4863C156.42 28.1218 100.934 62.6639 65.3276 116.012L100.43 130.565L24.3675 188.44L12.0516 93.9256L49.754 109.556C87.8056 50.9138 148.732 11.8089 218.724 9.98434C279.12 8.40988 334.291 34.9308 374.659 78.6088C399.329 105.302 418.516 138.435 430.113 175.622L432.571 183.505L416.735 188.399L414.277 180.517C403.384 145.587 385.408 114.619 362.457 89.786Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.0516 93.9256L49.754 109.556C87.8056 50.9138 148.732 11.8089 218.724 9.98434C279.12 8.40988 334.291 34.9308 374.659 78.6088C398.978 104.922 417.97 137.494 429.614 174.038C429.782 174.566 429.948 175.094 430.113 175.622L432.57 183.499L432.571 183.505L416.735 188.399L416.734 188.395L414.277 180.517C403.384 145.587 385.408 114.619 362.457 89.786C324.915 49.1659 274.185 25.0518 219.158 26.4863C159.744 28.0351 106.836 59.0953 71.1543 107.692C69.1576 110.411 67.2146 113.185 65.3276 116.012L100.43 130.565L24.3675 188.44L12.0516 93.9256ZM80.5998 111.607L120.166 128.011L16.7456 206.703L0 78.1928L46.054 97.2856C85.8604 40.111 147.546 1.91866 218.465 0.0698728C282.057 -1.58788 339.88 26.3655 381.943 71.8773C407.644 99.686 427.56 134.122 439.582 172.67L445 190.045L410.212 200.796L404.809 183.47C394.341 149.902 377.093 120.235 355.173 96.5177C319.328 57.7331 271.251 35.0497 219.416 36.4009C164.264 37.8387 114.674 66.2797 80.5998 111.607Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M222.312 307.456C271.609 307.456 311.573 267.492 311.573 218.194C311.573 168.897 271.609 128.933 222.312 128.933C173.014 128.933 133.05 168.897 133.05 218.194C133.05 267.492 173.014 307.456 222.312 307.456ZM222.312 337.209C288.042 337.209 341.327 283.924 341.327 218.194C341.327 152.464 288.042 99.1792 222.312 99.1792C156.581 99.1792 103.296 152.464 103.296 218.194C103.296 283.924 156.581 337.209 222.312 337.209Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.0516 93.9256L49.754 109.556C87.8056 50.9138 148.732 11.8089 218.724 9.98434C279.12 8.40988 334.291 34.9308 374.659 78.6088C398.978 104.922 417.97 137.494 429.614 174.038C429.782 174.566 429.948 175.094 430.113 175.622L432.57 183.499L432.571 183.505L416.735 188.399L416.734 188.395L414.277 180.517C403.384 145.587 385.408 114.619 362.457 89.786C324.915 49.1659 274.185 25.0518 219.158 26.4863C159.744 28.0351 106.836 59.0953 71.1543 107.692C69.1576 110.411 67.2146 113.185 65.3276 116.012L100.43 130.565L24.3675 188.44L12.0516 93.9256ZM80.5998 111.607L120.166 128.011L16.7456 206.703L0 78.1928L46.054 97.2856C85.8604 40.111 147.546 1.91866 218.465 0.0698728C282.057 -1.58788 339.88 26.3655 381.943 71.8773C407.644 99.686 427.56 134.122 439.582 172.67L445 190.045L410.212 200.796L404.809 183.47C394.341 149.902 377.093 120.235 355.173 96.5177C319.328 57.7331 271.251 35.0497 219.416 36.4009C164.264 37.8387 114.674 66.2797 80.5998 111.607Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M222.312 307.456C271.609 307.456 311.573 267.492 311.573 218.194C311.573 168.897 271.609 128.933 222.312 128.933C173.014 128.933 133.05 168.897 133.05 218.194C133.05 267.492 173.014 307.456 222.312 307.456ZM222.312 337.209C288.042 337.209 341.327 283.924 341.327 218.194C341.327 152.464 288.042 99.1792 222.312 99.1792C156.581 99.1792 103.296 152.464 103.296 218.194C103.296 283.924 156.581 337.209 222.312 337.209Z" fill="black"/>
</svg>
`
}
else{
informationOverride.blockTitle = "Push & Rotate Right";
informationOverride.icon = `
<svg width="100%" height="100%" viewBox="0 0 445 338" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M82.5432 89.786C120.085 49.1659 170.815 25.0519 225.842 26.4864C288.58 28.1219 344.065 62.6639 379.672 116.012L344.57 130.565L420.632 188.44L432.948 93.9256L395.246 109.556C357.194 50.9138 296.268 11.809 226.276 9.98439C165.88 8.40993 110.709 34.9308 70.3406 78.6089C45.6706 105.302 26.4834 138.435 14.8866 175.622L12.4284 183.505L28.2647 188.4L30.7229 180.517C41.6156 145.588 59.5922 114.619 82.5432 89.786Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M432.948 93.9256L395.246 109.556C357.194 50.9139 296.268 11.809 226.276 9.98442C165.88 8.40996 110.709 34.9309 70.3406 78.6089C46.0213 104.922 27.0302 137.494 15.3859 174.038C15.2179 174.566 15.0515 175.094 14.8866 175.622L12.4303 183.499L12.4284 183.505L28.2646 188.4L28.266 188.395L30.7228 180.517C41.6155 145.588 59.5921 114.619 82.5431 89.7861C120.085 49.166 170.814 25.0519 225.842 26.4864C285.255 28.0352 338.164 59.0953 373.846 107.692C375.842 110.411 377.785 113.185 379.672 116.013L344.57 130.565L420.632 188.441L432.948 93.9256ZM364.4 111.607L324.834 128.011L428.254 206.703L445 78.1928L398.946 97.2856C359.14 40.111 297.454 1.91866 226.535 0.0698728C162.943 -1.58788 105.12 26.3655 63.057 71.8773C37.3556 99.686 17.4397 134.122 5.41835 172.67L9.5058e-07 190.045L34.7876 200.796L40.191 183.47C50.6592 149.902 67.907 120.235 89.8267 96.5177C125.672 57.7331 173.749 35.0497 225.584 36.4009C280.736 37.8387 330.326 66.2797 364.4 111.607Z" fill="black"/>
<path d="M341.703 218.194C341.703 283.924 288.419 337.209 222.688 337.209C156.958 337.209 103.673 283.924 103.673 218.194C103.673 152.464 156.958 99.1792 222.688 99.1792C288.419 99.1792 341.703 152.464 341.703 218.194Z" fill="black"/>
</svg>
`
}
}
onDestroy(()=>{
loaded = false;
})
onMount(()=>{
dispatch('informationOverride',informationOverride)
})
function sendData(e){
if(parenthesis(e)){
const script = stringManipulation.shortify(e);
dispatch('output', {short: 'ei', script: `elseif ${script} then`})
}
}
</script>


<if-block class="w-full h-fit flex flex-col text-white py-1" style="min-height: 2.5rem; background: {information.color};">

<div class="bg-secondary p-1 my-auto mr-1 rounded flex items-center w-full hidden" >
<LineEditor
on:output={(e)=>{sendData(e.detail.script)}}
{access_tree}
{sidebarWidth}
value={scriptSegment}
/>
</div>




</if-block>
45 changes: 45 additions & 0 deletions src/app/config-blocks/EncoderPushRotLeftRight_End.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<script context="module">
// config descriptor parameters
export const information = {
short: 'eprlre',
name: 'EncoderPushRotLeftRight_End',
rendering: 'modifier',
category: null,
desc: 'End',
blockTitle: 'End',
rounding: 'bottom',
hiddenIcon: true,
defaultLua: 'end',
icon: `
<svg width="100%" height="100%" viewBox="0 0 277 277" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M131.429 2.92893C135.334 -0.976311 141.666 -0.976311 145.571 2.92893L274.071 131.429C277.976 135.334 277.976 141.666 274.071 145.571L145.571 274.071C141.666 277.976 135.334 277.976 131.429 274.071L2.92893 145.571C-0.976311 141.666 -0.976311 135.334 2.92893 131.429L131.429 2.92893ZM24.1421 138.5L138.5 252.858L252.858 138.5L138.5 24.1421L24.1421 138.5Z" fill="black"/>
</svg>
`,
color: '#4A4AA7'
}
</script>

<script>
import { onMount, createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher();
function sendData(){
dispatch('output', {short: information.short, script: information.defaultLua})
}
onMount(()=>{
sendData();
})
</script>




<else-block class="w-full h-fit flex flex-col text-white py-1 {information.rounding == 'top'?"rounded-tl-2xl ":""} {information.rounding == 'bottom'?"rounded-bl-2xl ":""} " style="min-height: 2.5rem; background: {information.color};">



</else-block>

81 changes: 81 additions & 0 deletions src/app/config-blocks/EncoderPushRotLeftRight_If.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<script context="module">
// config descriptor parameters
export const information = {
short: 'eprlr',
name: 'EncoderPushRotLeftRight_If',
rendering: 'modifier',
rounding: 'top',
category: 'special',
eventtype: [2], // 2: encoder
desc: 'Push & Rotate L R',
blockTitle: 'Push & Rotate Left',
defaultLua: 'if (self:bst()>0 and self:est()<64) then--[[@eprlrei]] elseif (self:bst()>0 and self:est()>63) then--[[@eprlrei]] elseif (self:bst()==0 and self:est()<64) then--[[@eprlrel]] else--[[@eprlre]] end',
icon: `
<svg width="100%" height="100%" viewBox="0 0 445 338" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M362.457 89.7861C324.915 49.166 274.186 25.0519 219.158 26.4864C156.42 28.1219 100.935 62.664 65.3279 116.013L100.43 130.565L24.3677 188.441L12.0518 93.9257L49.7542 109.556C87.8058 50.9139 148.732 11.809 218.724 9.98442C279.12 8.40996 334.291 34.9309 374.659 78.6089C399.33 105.302 418.517 138.436 430.113 175.622L432.572 183.505L416.735 188.4L414.277 180.517C403.385 145.588 385.408 114.619 362.457 89.7861Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.0518 93.9257L49.7542 109.556C87.8058 50.9139 148.732 11.809 218.724 9.98442C279.12 8.40996 334.291 34.9309 374.659 78.6089C398.979 104.922 417.97 137.494 429.614 174.038C429.782 174.566 429.949 175.094 430.113 175.622L432.57 183.499L432.572 183.505L416.735 188.4L414.277 180.517C403.385 145.588 385.408 114.619 362.457 89.7861C324.915 49.166 274.186 25.0519 219.158 26.4864C159.745 28.0352 106.836 59.0953 71.1543 107.692C69.1576 110.411 67.2148 113.185 65.3279 116.013L100.43 130.565L24.3677 188.441L12.0518 93.9257ZM80.5998 111.607L120.166 128.011L16.7456 206.703L0 78.1928L46.054 97.2856C85.8604 40.111 147.546 1.91866 218.465 0.0698728C282.057 -1.58788 339.88 26.3655 381.943 71.8773C407.644 99.686 427.56 134.122 439.582 172.67L445 190.045L410.212 200.796L404.809 183.47C394.341 149.902 377.093 120.235 355.173 96.5177C319.328 57.7331 271.251 35.0497 219.416 36.4009C164.264 37.8387 114.674 66.2797 80.5998 111.607Z" fill="black"/>
<path d="M341.327 218.194C341.327 283.925 288.042 337.209 222.312 337.209C156.582 337.209 103.297 283.925 103.297 218.194C103.297 152.464 156.582 99.1793 222.312 99.1793C288.042 99.1793 341.327 152.464 341.327 218.194Z" fill="black"/>
</svg>
`,
color: '#4A4AA7 '
}
</script>

<script>
import { createEventDispatcher, onDestroy } from 'svelte';
import stringManipulation from '../main/user-interface/_string-operations';
import { parenthesis } from './_validators';
export let config = ''
export let index;
export let access_tree;
import LineEditor from '../main/user-interface/LineEditor.svelte'
let sidebarWidth;
const dispatch = createEventDispatcher();
let scriptSegment = ''; // local script part
let loaded = false;
$: if(config.script && !loaded){
scriptSegment = stringManipulation.humanize(config.script.slice(3, -5));
loaded = true;
}
onDestroy(()=>{
loaded = false;
})
function sendData(e){
if(parenthesis(e)){
const script = stringManipulation.shortify(e);
dispatch('output', {short: information.short, script: information.defaultLua})
}
}
</script>


<svelte:window bind:innerWidth={sidebarWidth} />

<if-block class="w-full h-fit flex flex-col text-white py-1 {information.rounding == 'top'?"rounded-tl-2xl ":""} {information.rounding == 'bottom'?"rounded-bl-2xl ":""} " style="min-height: 2.5rem; background: {information.color};">




<div class="bg-secondary p-1 my-auto mr-1 rounded hidden" >
<LineEditor
on:output={(e)=>{sendData(e.detail.script)}}
{access_tree}
{sidebarWidth}
value={scriptSegment}
/>
</div>


</if-block>
12 changes: 2 additions & 10 deletions src/app/main/panels/WebsocketMonitor/WebsocketMonitor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,12 @@
}
let websocketMessage = `{"zyp": "hy"}`;
let websocketMessage = `{zyp: "hy"}`;
function sendMessage(){
try {
const obj = JSON.parse(websocketMessage);
wss_send_message(obj);
} catch (error) {
console.log("INVALID JSON", websocketMessage)
wss_send_message(websocketMessage);
}
Expand Down
Loading

0 comments on commit 8d507a6

Please sign in to comment.