automation reinstated in a better way

main
mwinter 11 months ago
parent 19232846d5
commit bfca2cd8eb

@ -36,8 +36,8 @@ bool ySafeMode = false;
long yLimitPos = 0;
int microsteps = 1;
float maxSpeedConstant = 300 * microsteps;
float accelerationConstant = 100 * microsteps;
float maxSpeedConstant = 150 * microsteps;
float accelerationConstant = 50 * microsteps;
void setup() {

@ -36,8 +36,8 @@
"left": "auto",
"id": "main_panel",
"linkId": "",
"width": 502,
"height": 312,
"width": 500,
"height": 390,
"css": "> .panel {\n background-color: black;\n border: 2px solid grey;\n}\n:host {\n top:calc(50% - 156rem);\n left:calc(50% - 251rem);\n z-index:15;\n}",
"scroll": true,
"default": "",
@ -50,19 +50,52 @@
"widgets": [
{
"type": "text",
"top": 248,
"left": 10,
"top": 250,
"left": 30,
"id": "message",
"linkId": "",
"width": 478,
"width": 450,
"height": 50,
"css": ".text {\n background-color: black;\n border: 1px solid grey;\n}",
"default": " ",
"value": "",
"address": "/message",
"preArgs": "",
"decimals": 2,
"colorWidget": "white",
"lock": false,
"visible": true,
"comments": "",
"expand": "false",
"colorText": "auto",
"colorStroke": "auto",
"colorFill": "auto",
"alphaStroke": "auto",
"alphaFillOff": "auto",
"alphaFillOn": "auto",
"lineWidth": "auto",
"borderRadius": "auto",
"padding": "auto",
"html": "",
"target": "",
"onCreate": "",
"onValue": "",
"vertical": false,
"wrap": false,
"align": "",
"align": "center"
},
{
"type": "text",
"top": 325,
"left": 30,
"id": "pos_message",
"linkId": "",
"width": 450,
"height": 50,
"css": ".text {\n background-color: black;\n border: 1px solid grey;\n}",
"default": " ",
"value": "",
"address": "/message",
"address": "/pos_message",
"preArgs": "",
"decimals": 2,
"colorWidget": "white",
@ -82,7 +115,10 @@
"html": "",
"target": "",
"onCreate": "",
"onValue": ""
"onValue": "",
"vertical": false,
"wrap": false,
"align": "center"
},
{
"type": "panel",
@ -331,6 +367,52 @@
"ignoreDefaults": false,
"onCreate": "",
"onValue": ""
},
{
"type": "button",
"top": 160,
"left": 200,
"id": "automate_play",
"linkId": "",
"width": 30,
"height": 30,
"label": "#{\n@{this} == 1 ? \"^stop\" : \"^play\"\n}",
"css": ":host{\n--color-raised:#2A2A2D;\n> .label {\nfont-size: 150%;\n}",
"doubleTap": false,
"on": 1,
"off": 0,
"value": "",
"address": "/automate_play",
"preArgs": "",
"target": "",
"bypass": false,
"default": "",
"decimals": 1,
"colorWidget": "grey",
"mode": "toggle",
"lock": false,
"visible": true,
"interaction": true,
"comments": "",
"expand": "false",
"colorText": "auto",
"colorStroke": "auto",
"colorFill": "auto",
"alphaStroke": "auto",
"alphaFillOff": "auto",
"alphaFillOn": "auto",
"lineWidth": "auto",
"borderRadius": "auto",
"padding": "auto",
"html": "",
"colorTextOn": "auto",
"vertical": false,
"wrap": false,
"decoupled": false,
"typeTags": "",
"ignoreDefaults": false,
"onCreate": "function shuffle(array) {\n let currentIndex = array.length, randomIndex;\n\n // While there remain elements to shuffle.\n while (currentIndex > 0) {\n\n // Pick a remaining element.\n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex--;\n\n // And swap it with the current element.\n [array[currentIndex], array[randomIndex]] = [\n array[randomIndex], array[currentIndex]];\n }\n\n return array;\n}\n\nset(\"automate\", false)\n\nvar imageShuffle = shuffle([1, 2, 3, 4, 5, 6, 7, 8, 9])\nvar time = 0;\nvar imageCount = 0;\nvar imageInterval = 60 * 2\nvar automateInterval = setInterval(function() {\n if(get(\"automate_play\") !== 0){\n //set(\"lock\", false)\n //set(\"automate\", true)\n //var curImageTime = (time % (60 * 3))\n if(time === imageInterval){\n imageCount = imageCount + 1;\n set(\"img_\" + imageShuffle[imageCount] + \"_select\", imageShuffle[imageCount])\n if(imageCount === 8){\n imageShuffle = shuffle([1, 2, 3, 4, 5, 6, 7, 8, 9])\n }\n time = 0\n }\n \n time = time + 1\n set(\"message\", \"another tiling/message will be selected in \" + (imageInterval - time) + \" seconds\")\n set(\"message_public\", \"another tiling/message will be selected in \" + (imageInterval - time) + \" seconds\")\n }\n \n}, 1000);",
"onValue": "if(get(\"automate_play\") !== 0){\n set(\"lock\", false)\n set(\"automate\", true)\n} else {\n set(\"lock\", true)\n set(\"automate\", false)\n }"
}
],
"tabs": [],
@ -827,6 +909,60 @@
"ignoreDefaults": false,
"onCreate": "",
"onValue": ""
},
{
"type": "variable",
"lock": false,
"id": "lock",
"comments": "",
"value": 0,
"default": "",
"linkId": "",
"address": "auto",
"preArgs": "",
"typeTags": "",
"decimals": 2,
"target": "",
"ignoreDefaults": false,
"bypass": false,
"onCreate": "",
"onValue": ""
},
{
"type": "variable",
"lock": false,
"id": "automate",
"comments": "",
"value": "",
"default": "",
"linkId": "",
"address": "auto",
"preArgs": "",
"typeTags": "",
"decimals": 2,
"target": "",
"ignoreDefaults": false,
"bypass": false,
"onCreate": "",
"onValue": ""
},
{
"type": "variable",
"lock": false,
"id": "message_public",
"comments": "",
"value": "",
"default": "",
"linkId": "",
"address": "auto",
"preArgs": "",
"typeTags": "",
"decimals": 2,
"target": "",
"ignoreDefaults": false,
"bypass": false,
"onCreate": "",
"onValue": ""
}
],
"tabs": [],

@ -0,0 +1,625 @@
{
"createdWith": "Open Stage Control",
"version": "1.25.2",
"type": "session",
"content": {
"type": "root",
"id": "root",
"linkId": "",
"css": "JS{\nif(@{lock}) return `\n:host > inner > .navigation {\n pointer-events: none;\n filter: grayscale(100%);\n}`\n}",
"default": "",
"value": "",
"address": "/root",
"preArgs": "",
"target": "",
"bypass": false,
"traversing": false,
"variables": {},
"tabs": [
{
"type": "tab",
"id": "main_tab",
"linkId": "",
"label": "a history of the domino problem",
"css": ":root {\n--color-bg: black;\n--color-raised: black;\n--color-accent: grey;\n--color-light: grey;\n}\n> .panel {\n display: flex;\n align-items: center;\n justify-content: center;\n}",
"default": "",
"value": "",
"address": "/tab_1",
"preArgs": "",
"target": "",
"bypass": false,
"variables": "@{parent.variables}",
"widgets": [
{
"type": "panel",
"top": "auto",
"left": "auto",
"id": "main_panel",
"linkId": "",
"width": 520,
"height": 480,
"css": "> .panel {\n background-color: black;\n border: 2px solid grey;\n}\n:host {\n top:calc(50% - 156rem);\n left:calc(50% - 251rem);\n z-index:15;\n font-size: 125%;\n}",
"scroll": true,
"default": "",
"value": "",
"address": "/main_panel",
"preArgs": "",
"target": "",
"bypass": true,
"variables": "@{parent.variables}",
"widgets": [
{
"type": "text",
"top": 410,
"left": 20,
"id": "message_public",
"linkId": "",
"width": 480,
"height": 50,
"css": ".text {\n background-color: black;\n border: 1px solid grey;\n}",
"vertical": false,
"wrap": false,
"align": "",
"default": " ",
"value": "",
"address": "/message_public",
"preArgs": "",
"decimals": 2,
"colorWidget": "white",
"lock": false,
"visible": true,
"comments": "",
"expand": "false",
"colorText": "auto",
"colorStroke": "auto",
"colorFill": "auto",
"alphaStroke": "auto",
"alphaFillOff": "auto",
"alphaFillOn": "auto",
"lineWidth": "auto",
"borderRadius": "auto",
"padding": "auto",
"html": "",
"target": "",
"onCreate": "",
"onValue": ""
},
{
"type": "button",
"top": 20,
"left": 20,
"id": "img_1_select",
"linkId": "",
"width": 96,
"height": 72,
"label": "Berger",
"css": ":host{\n--color-raised:#2A2A2D;\n}\n:host.on{\n--color-bg:white;\n}",
"doubleTap": false,
"on": 1,
"off": -1,
"default": "",
"value": "",
"address": "/img_select",
"preArgs": "",
"target": "",
"bypass": false,
"decimals": 2,
"mode": "toggle",
"lock": false,
"visible": true,
"interaction": true,
"comments": "",
"expand": "false",
"colorText": "auto",
"colorWidget": "auto",
"colorStroke": "auto",
"colorFill": "auto",
"alphaStroke": "auto",
"alphaFillOff": "auto",
"alphaFillOn": "auto",
"lineWidth": "auto",
"borderRadius": "auto",
"padding": "auto",
"html": "",
"colorTextOn": "auto",
"vertical": false,
"wrap": false,
"decoupled": false,
"typeTags": "",
"ignoreDefaults": false,
"onCreate": "",
"onValue": "globals.lockFunc(get(this))"
},
{
"type": "button",
"top": 20,
"left": 212,
"id": "img_2_select",
"linkId": "",
"width": 96,
"height": 72,
"label": "Robinson",
"css": "JS{\n:host{\n--color-raised:#2A2A2D;\n}\n:host.on{\n--color-bg:white;\n}\n",
"doubleTap": false,
"on": 2,
"off": -2,
"default": "",
"value": "",
"address": "/img_select",
"preArgs": "",
"target": "",
"bypass": false,
"decimals": 2,
"mode": "toggle",
"lock": false,
"visible": true,
"interaction": true,
"comments": "",
"expand": "false",
"colorText": "auto",
"colorWidget": "auto",
"colorStroke": "auto",
"colorFill": "auto",
"alphaStroke": "auto",
"alphaFillOff": "auto",
"alphaFillOn": "auto",
"lineWidth": "auto",
"borderRadius": "auto",
"padding": "auto",
"html": "",
"colorTextOn": "auto",
"vertical": false,
"wrap": false,
"decoupled": false,
"typeTags": "",
"ignoreDefaults": false,
"onCreate": "",
"onValue": "globals.lockFunc(get(this))"
},
{
"type": "button",
"top": 20,
"left": 404,
"id": "img_3_select",
"linkId": "",
"width": 96,
"height": 72,
"label": "message 3",
"css": "",
"doubleTap": false,
"on": 3,
"off": -3,
"default": "",
"value": "",
"address": "/img_select",
"preArgs": "",
"target": "",
"bypass": false,
"decimals": 2,
"mode": "toggle",
"lock": false,
"visible": true,
"interaction": true,
"comments": "",
"expand": "false",
"colorText": "auto",
"colorWidget": "auto",
"colorStroke": "auto",
"colorFill": "auto",
"alphaStroke": "auto",
"alphaFillOff": "auto",
"alphaFillOn": "auto",
"lineWidth": "auto",
"borderRadius": "auto",
"padding": "auto",
"html": "",
"colorTextOn": "auto",
"vertical": false,
"wrap": false,
"decoupled": false,
"typeTags": "",
"ignoreDefaults": false,
"onCreate": "",
"onValue": "globals.lockFunc(get(this))"
},
{
"type": "button",
"top": 164,
"left": 20,
"id": "img_4_select",
"linkId": "",
"width": 96,
"height": 72,
"label": "Penrose",
"css": ":host{\n--color-raised:#2A2A2D;\n}\n:host.on{\n--color-bg:white;\n}",
"doubleTap": false,
"on": 4,
"off": -4,
"default": "",
"value": "",
"address": "/img_select",
"preArgs": "",
"target": "",
"bypass": false,
"decimals": 2,
"mode": "toggle",
"lock": false,
"visible": true,
"interaction": true,
"comments": "",
"expand": "false",
"colorText": "auto",
"colorWidget": "auto",
"colorStroke": "auto",
"colorFill": "auto",
"alphaStroke": "auto",
"alphaFillOff": "auto",
"alphaFillOn": "auto",
"lineWidth": "auto",
"borderRadius": "auto",
"padding": "auto",
"html": "",
"colorTextOn": "auto",
"vertical": false,
"wrap": false,
"decoupled": false,
"typeTags": "",
"ignoreDefaults": false,
"onCreate": "",
"onValue": "globals.lockFunc(get(this))"
},
{
"type": "button",
"top": 308,
"left": 20,
"id": "img_7_select",
"linkId": "",
"width": 96,
"height": 72,
"label": "message 1",
"css": ":host{\n--color-raised:#2A2A2D;\n}\n:host.on{\n--color-bg:white;\n}",
"doubleTap": false,
"on": 7,
"off": -7,
"default": "",
"value": "",
"address": "/img_select",
"preArgs": "",
"target": "",
"bypass": false,
"decimals": 2,
"mode": "toggle",
"lock": false,
"visible": true,
"interaction": true,
"comments": "",
"expand": "false",
"colorText": "auto",
"colorWidget": "auto",
"colorStroke": "auto",
"colorFill": "auto",
"alphaStroke": "auto",
"alphaFillOff": "auto",
"alphaFillOn": "auto",
"lineWidth": "auto",
"borderRadius": "auto",
"padding": "auto",
"html": "",
"colorTextOn": "auto",
"vertical": false,
"wrap": false,
"decoupled": false,
"typeTags": "",
"ignoreDefaults": false,
"onCreate": "",
"onValue": "globals.lockFunc(get(this))"
},
{
"type": "button",
"top": 164,
"left": 212,
"id": "img_5_select",
"linkId": "",
"width": 96,
"height": 72,
"css": ":host{\n--color-raised:#2A2A2D;\n}\n:host.on{\n--color-bg:white;\n}",
"default": "",
"value": "",
"address": "/img_select",
"preArgs": "",
"target": "",
"bypass": false,
"decimals": 2,
"mode": "toggle",
"lock": false,
"visible": true,
"interaction": true,
"comments": "",
"expand": "false",
"colorText": "auto",
"colorWidget": "auto",
"colorStroke": "auto",
"colorFill": "auto",
"alphaStroke": "auto",
"alphaFillOff": "auto",
"alphaFillOn": "auto",
"lineWidth": "auto",
"borderRadius": "auto",
"padding": "auto",
"html": "",
"colorTextOn": "auto",
"wrap": false,
"typeTags": "",
"ignoreDefaults": false,
"onCreate": "",
"onValue": "globals.lockFunc(get(this))",
"label": "message 2",
"doubleTap": false,
"on": 5,
"off": -5,
"vertical": false,
"decoupled": false
},
{
"type": "button",
"top": 164,
"left": 404,
"id": "img_6_select",
"linkId": "",
"width": 96,
"height": 72,
"label": "Ammann",
"css": ":host{\n--color-raised:#2A2A2D;\n}\n:host.on{\n--color-bg:white;\n}",
"doubleTap": false,
"on": 6,
"off": -6,
"default": "",
"value": "",
"address": "/img_select",
"preArgs": "",
"target": "",
"bypass": false,
"decimals": 2,
"mode": "toggle",
"lock": false,
"visible": true,
"interaction": true,
"comments": "",
"expand": "false",
"colorText": "auto",
"colorWidget": "auto",
"colorStroke": "auto",
"colorFill": "auto",
"alphaStroke": "auto",
"alphaFillOff": "auto",
"alphaFillOn": "auto",
"lineWidth": "auto",
"borderRadius": "auto",
"padding": "auto",
"html": "",
"colorTextOn": "auto",
"vertical": false,
"wrap": false,
"decoupled": false,
"typeTags": "",
"ignoreDefaults": false,
"onCreate": "",
"onValue": "globals.lockFunc(get(this))"
},
{
"type": "button",
"top": 308,
"left": 212,
"id": "img_8_select",
"linkId": "",
"width": 96,
"height": 72,
"label": "Kari",
"css": ":host{\n--color-raised:#2A2A2D;\n}\n:host.on{\n--color-bg:white;\n}",
"doubleTap": false,
"on": 8,
"off": -8,
"default": "",
"value": "",
"address": "/img_select",
"preArgs": "",
"target": "",
"bypass": false,
"decimals": 2,
"mode": "toggle",
"lock": false,
"visible": true,
"interaction": true,
"comments": "",
"expand": "false",
"colorText": "auto",
"colorWidget": "auto",
"colorStroke": "auto",
"colorFill": "auto",
"alphaStroke": "auto",
"alphaFillOff": "auto",
"alphaFillOn": "auto",
"lineWidth": "auto",
"borderRadius": "auto",
"padding": "auto",
"html": "",
"colorTextOn": "auto",
"vertical": false,
"wrap": false,
"decoupled": false,
"typeTags": "",
"ignoreDefaults": false,
"onCreate": "",
"onValue": "globals.lockFunc(get(this))"
},
{
"type": "button",
"top": 308,
"left": 404,
"id": "img_9_select",
"linkId": "",
"width": 96,
"height": 72,
"label": "Jaendel",
"css": ":host{\n--color-raised:#2A2A2D;\n}\n:host.on{\n--color-bg:white;\n}",
"doubleTap": false,
"on": 9,
"off": -9,
"default": "",
"value": "",
"address": "/img_select",
"preArgs": "",
"target": "",
"bypass": false,
"decimals": 2,
"mode": "toggle",
"lock": false,
"visible": true,
"interaction": true,
"comments": "",
"expand": "false",
"colorText": "auto",
"colorWidget": "auto",
"colorStroke": "auto",
"colorFill": "auto",
"alphaStroke": "auto",
"alphaFillOff": "auto",
"alphaFillOn": "auto",
"lineWidth": "auto",
"borderRadius": "auto",
"padding": "auto",
"html": "",
"colorTextOn": "auto",
"vertical": false,
"wrap": false,
"decoupled": false,
"typeTags": "",
"ignoreDefaults": false,
"onCreate": "",
"onValue": "globals.lockFunc(get(this))"
},
{
"type": "variable",
"lock": false,
"id": "lock",
"comments": "",
"value": 0,
"default": "",
"linkId": "",
"address": "auto",
"preArgs": "",
"typeTags": "",
"decimals": 2,
"target": "",
"ignoreDefaults": false,
"bypass": false,
"onCreate": "",
"onValue": ""
},
{
"type": "variable",
"lock": false,
"id": "automate",
"comments": "",
"value": false,
"default": "",
"linkId": "",
"address": "auto",
"preArgs": "",
"typeTags": "",
"decimals": 2,
"target": "",
"ignoreDefaults": false,
"bypass": false,
"onCreate": "",
"onValue": ""
}
],
"tabs": [],
"decimals": 2,
"innerPadding": false,
"padding": 0,
"alphaStroke": 0,
"lock": false,
"visible": true,
"interaction": "#{@{lock}}",
"comments": "",
"expand": "false",
"colorText": "auto",
"colorWidget": "auto",
"colorStroke": "auto",
"colorFill": "auto",
"alphaFillOff": "auto",
"alphaFillOn": "auto",
"lineWidth": "auto",
"borderRadius": "auto",
"html": "",
"colorBg": "auto",
"layout": "default",
"justify": "start",
"gridTemplate": "",
"contain": true,
"tabsPosition": "top",
"traversing": false,
"typeTags": "",
"ignoreDefaults": false,
"onCreate": "set(\"lock\", true)\nglobals.lockFunc = function(val){\n if(get(\"automate\") === false){\n if(val >= 0){\n var i = 180\n set(\"lock\", false)\n var timeOut = setInterval(function() {\n i = i - 1\n set(\"message_public\", \"you may select another tiling/message in \" + i + \" seconds\")\n //set(\"message\", get(\"lock\"))\n if(i < 1){\n set(\"lock\", true)\n set(\"message_public\", \"select another tiling/message\")\n //set(\"message\", get(\"lock\"))\n clearInterval(timeOut)\n }\n }, 1000);\n }\n }\n}",
"onValue": ""
}
],
"tabs": [],
"scroll": true,
"decimals": 2,
"colorWidget": "white",
"innerPadding": false,
"padding": 0,
"lock": false,
"visible": true,
"interaction": true,
"comments": "",
"colorText": "auto",
"colorFill": "auto",
"borderRadius": "auto",
"html": "",
"colorBg": "auto",
"layout": "default",
"justify": "start",
"gridTemplate": "",
"contain": true,
"tabsPosition": "top",
"traversing": false,
"typeTags": "",
"ignoreDefaults": false,
"onCreate": "",
"onValue": ""
}
],
"scroll": true,
"decimals": 2,
"lock": false,
"visible": true,
"interaction": true,
"comments": "",
"width": "auto",
"height": "auto",
"colorText": "auto",
"colorWidget": "auto",
"alphaFillOn": "auto",
"borderRadius": "auto",
"padding": "auto",
"html": "",
"colorBg": "auto",
"layout": "default",
"justify": "start",
"gridTemplate": "",
"contain": true,
"innerPadding": true,
"tabsPosition": "top",
"hideMenu": false,
"typeTags": "",
"ignoreDefaults": false,
"onCreate": "",
"onValue": "",
"widgets": []
}
}

@ -34,7 +34,8 @@ s.waitForBoot({
});
isPlaying = true;
piece = msg[1];
playDur = (5.0.rand + 5) * 60;
//playDur = (5.0.rand + 5) * 60;
playDur = 10 * 60;
numPlayFrames = playDur * recInfo[piece][1];
startFrame = (recInfo[piece][0] - numPlayFrames).rand;
playBuf.free;

@ -49,6 +49,7 @@ dirTuples = [ [ -1, -1 ], [ -1, 0 ], [ -1, 1 ], [ 0, -1 ], [ 0, 1 ], [ 1, -1 ],
if(byte==13, {
if(str[1].asString == "[", {
valArray = str.asString.interpret.postln;
netAddress.sendMsg("/STATE/SET", "{pos_message: \"x_pos: " + valArray[0] + " | y_pos: " + valArray[1] + "\"}");
curPos = Point.new(valArray[0], valArray[1]);
limitSwitchNeg = valArray[2];
limitSwitchPos = valArray[3];
@ -124,9 +125,9 @@ imgSelect = {
lastSelect = imgIndex;
audioIndex = imgIndexToAudioIndex[imgIndex];
if(audioIndex != nil, {localAddress.sendMsg('/playTiling', audioIndex)});
dirTuplesSeq = dirTuples.deepCopy.scramble;
dirTuplesSeq = dirTuples.deepCopy.scramble.collect({arg tup; [tup, tup * -1]}).flatten;
dirAdjustRoutine = Routine({
60.wait;
180.wait;
imgPositions[imgIndex] = curPos.deepCopy;
trackLock = true;
10.wait;
@ -138,7 +139,7 @@ imgSelect = {
trackLock = false;
10.wait;
trackLock = true;
10.wait;
5.wait;
});
}).play;
}, {

Loading…
Cancel
Save