diff --git a/README.md b/README.md index 18189017b6ad17a289ea3f3504c753c91168420b..1ec3780cb8f0cdd0847924ade101b2363026bc80 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ This project serves the developement environment / api we use to write and repre - change settings ## Questionable Moves + - test load of dmz.json - unordered list / names / no mdl ? - module deletion seems unclean - input / output objects should be able to unhook themselves: - keep references of what-is-attached ? diff --git a/client/dummies.js b/client/dummies.js deleted file mode 100644 index c2dafcb32c8e5042acefb81cd5ed401b9f453f20..0000000000000000000000000000000000000000 --- a/client/dummies.js +++ /dev/null @@ -1,47 +0,0 @@ - -var gcodeDummy = { - name: 'gcode', - id: 12, - state: { - mode: 'G0', - flavor: 'sensible', - speeds: { - G0: 1200, - G1: 400 - } - }, - inputs: { - lineIn: { - type: 'string', - description: 'single line to parse' - } - }, - outputs: { - instruction: { - type: 'object', - class: 'MoveInstruction', - description: 'parsed move instruction' - } - } -} - - -var terminalDummy = { - name: 'terminal', - id: 13, - state: { - width: 64, - height: 48 - }, - inputs: { - lineIn: { - type: 'object' - } - }, - outputs: { - lineOut: { - type: 'string', - description: 'line from terminal' - } - } -} \ No newline at end of file diff --git a/main.js b/main.js index 51c6645f7729326e98af4a5d194c5f9044056c70..aa864d43da140593ef4ea45b8b0e07cbc5f14531 100644 --- a/main.js +++ b/main.js @@ -31,7 +31,6 @@ var program = {} program = Programs.open('programs/default.json') - // UI const View = require('./views.js') View.startHttp() diff --git a/programs.js b/programs.js index f46a74909e6b52fa38d57993291da756238305de..072d432c88d12d2c5bdbf7719e2fe024bdcd483b 100644 --- a/programs.js +++ b/programs.js @@ -169,6 +169,7 @@ function openProgram(path){ // keys should be identical for rep and heap // this is the representation that we're opening up from var mdlRep = prgRep.modules[modName] + // this is the actual object, having functions and whatnot var mdl = program.modules[modName] @@ -198,6 +199,7 @@ function openProgram(path){ // restore position / UI state if(mdlRep.description.position != null){ + // ?? mdl.description.position = {} mdl.description.position.left = mdlRep.description.position.left mdl.description.position.top = mdlRep.description.position.top diff --git a/programs/dmz.json b/programs/dmz.json new file mode 100644 index 0000000000000000000000000000000000000000..f71cd7cdbe4e5e903fba0967ae786d3b1af8962b --- /dev/null +++ b/programs/dmz.json @@ -0,0 +1,210 @@ +{ + "description": { + "name": "tstprgmem", + "counter": 9 + }, + "modules": { + "gate-1": { + "description": { + "id": "gate-1", + "name": "gate", + "alt": "in ... out", + "path": "./src/util/gate.js", + "position": { + "left": 10, + "top": 30 + } + }, + "inputs": { + "thru": { + "accepts": "any" + } + }, + "outputs": { + "out": { + "emits": "any", + "calls": [ + { + "parentId": "delay-2", + "key": "thru" + } + ] + } + }, + "state": { + "toggle": { + "type": "button", + "label": "Open / Close" + }, + "message": "closed" + } + }, + "delay-2": { + "description": { + "id": "delay-2", + "name": "delay", + "alt": "in ... out", + "path": "./src/util/delay.js", + "position": { + "left": 132, + "top": 225 + } + }, + "inputs": { + "thru": { + "accepts": "any" + } + }, + "outputs": { + "out": { + "emits": "any", + "calls": [ + { + "parentId": "logger-3", + "key": "thru" + } + ] + } + }, + "state": { + "ms": 1200 + } + }, + "logger-3": { + "description": { + "id": "logger-3", + "name": "logger", + "alt": "in ... out to console", + "path": "./src/util/log.js", + "position": { + "left": 123, + "top": 367 + } + }, + "inputs": { + "thru": { + "accepts": "any" + } + }, + "outputs": { + "throughput": { + "emits": "any", + "calls": [] + } + }, + "state": { + "prefix": "LOGGER:", + "message": "---" + } + }, + "Breadboard Servo Signal Generator-6": { + "description": { + "id": "Breadboard Servo Signal Generator-6", + "name": "Breadboard Servo Signal Generator", + "alt": "servo", + "path": "./src/hardware/servo.js", + "position": { + "left": 583, + "top": 632 + } + }, + "inputs": { + "packet": { + "accepts": "headless packet" + } + }, + "outputs": { + "packet": { + "emits": "number", + "calls": [] + } + }, + "state": { + "button": { + "type": "button", + "label": "SEND" + }, + "servoVal": 0 + } + }, + "delay-7": { + "description": { + "id": "delay-7", + "name": "delay", + "alt": "in ... out", + "path": "./src/util/delay.js", + "position": { + "left": 627, + "top": 193 + } + }, + "inputs": { + "thru": { + "accepts": "any" + } + }, + "outputs": { + "out": { + "emits": "any", + "calls": [] + } + }, + "state": { + "ms": 100 + } + }, + "delay-8": { + "description": { + "id": "delay-8", + "name": "delay", + "alt": "in ... out", + "path": "./src/util/delay.js", + "position": { + "left": 676, + "top": 345 + } + }, + "inputs": { + "thru": { + "accepts": "any" + } + }, + "outputs": { + "out": { + "emits": "any", + "calls": [] + } + }, + "state": { + "ms": 100 + } + }, + "logger-9": { + "description": { + "id": "logger-9", + "name": "logger", + "alt": "in ... out to console", + "path": "./src/util/log.js", + "position": { + "left": 622, + "top": 467 + } + }, + "inputs": { + "thru": { + "accepts": "any" + } + }, + "outputs": { + "throughput": { + "emits": "any", + "calls": [] + } + }, + "state": { + "prefix": "LOGGER:", + "message": "---" + } + } + } +} \ No newline at end of file diff --git a/src/util/gate.js b/src/util/gate.js index cb46f95703784131cdc2e471ea5ea989160d452f..ea6e1c9e53a34afef3472d1e87895935dc347b90 100644 --- a/src/util/gate.js +++ b/src/util/gate.js @@ -21,9 +21,10 @@ function Gate() { var state = gate.state state.toggle = Button("Open / Close", onButtonPress) + state.message = 'closed' + // yikes gate.isOpen = false - state.message = 'closed' gate.inputs = { thru: Input('any', gateKeeper) // makes anything into '1' event