Commit c96e76cb authored by Jake Read's avatar Jake Read

prgmem for mm

parent f07b00ae
......@@ -267,6 +267,9 @@ View.assignProgram(program)
## Immediately
- ui objects ... refresh ... use state model ?
- ui objects client drop below inputs / outputs
- ui / button
- would like to send board with new buck out to fab
......
......@@ -45,11 +45,29 @@ body {
color: #eee;
}
.outputs {
width: 78px;
float: right;
margin-right: 2px;
text-align: right;
font-size: 11px;
background-color: #1a1a1a;
color: #eee;
}
.state {
padding: 0 83px 0 83px;
color: #eee;
}
.uidiv {
width: 396px;
padding-top: 5px;
margin-left: 2px;
margin-right: 2px;
float: left;
}
textarea {
resize: none;
}
......@@ -75,16 +93,6 @@ textarea {
margin-right: 0px;
}
.outputs {
width: 78px;
float: right;
margin-right: 2px;
text-align: right;
font-size: 11px;
background-color: #1a1a1a;
color: #eee;
}
.clear {
clear: both;
}
......
......@@ -11,7 +11,7 @@
li.appendChild(document.createElement('br'))
var txtArea = document.createElement('textarea')
txtArea.rows = 25
txtArea.cols = 25
txtArea.cols = 45
txtArea.value = '-'
txtArea.addEventListener('change', function() {
var data = {
......@@ -35,11 +35,11 @@
// upstream, and besides, wouldn't be able to get anything from
// the server
multiline.onMessage = function(msg) {
console.log('got message in client side ui object', msg)
//console.log('got message in client side ui object', msg)
if (msg.call == 'setContents') {
txtArea.value = msg.argument
} else if (msg.call == 'setLabel'){
label.innerHTML- msg.argument
label.textContent = msg.argument
} else if (msg.call == 'setRows') {
txtArea.rows = msg.argument
}
......
......@@ -33,11 +33,18 @@ function ATKBreadBoardBoard() {
// and state as well
var state = atkbbb.state
state.servoButton = Button('SEND VALUE', onServoValChange)
state.servoVal = 0 // 0->100 does 1 -> 2ms duty on 20ms period
state.onUiChange('servoVal', onServoValChange)
state.adcButton = Button('REQUEST ADC CONVERSION', onADCRequest)
var ui = atkbbb.ui
ui.addElement('servoButton', './ui/uiButton.js', onServoValChange)
ui.servoButton.onload = function(){
ui.servoButton.setText('click to send servo value')
}
ui.addElement('adcReqButton', './ui/uiButton.js', onADCRequest)
ui.adcReqButton.onload = function(){
ui.adcReqButton.setText('click to request adc conversion')
}
// to send things down the well, we can use
// atkbbb.route.send(packet)
......
......@@ -15,7 +15,7 @@ function ATKSerialLink() {
description: {
isHardware: true,
isLink: true,
name: 'Serialport ATK Link',
name: 'SerialportATKLink',
alt: 'window into hardware world'
},
routes: new Array()
......
......@@ -36,18 +36,22 @@ function MultiLineIn() {
ui.previously.onload = function(){
ui.previously.setContents('-')
ui.previously.setLabel('previously:')
ui.previously.setRows(15)
}
ui.addElement('justNow', './ui/multiline.js', null)
ui.justNow.onload = function(){
ui.justNow.setContents('-')
ui.justNow.setLabel('just now:')
ui.justNow.setRows(1)
}
ui.addElement('incoming', './ui/multiline.js', null)
ui.incoming.onload = function(){
ui.incoming.setContents('G0 F50 X10Y10Z10\nG0 X20Y20Z0\nG0 X0\nG0 Y10\nG0 F50 X10Y10Z10\nG0 X20Y20Z0\nG0 X0\nG0 Y10\nG0 F50 X10Y10Z10\nG0 X20Y20Z0\nG0 X0\nG0 Y10\nG0 F50 X10Y10Z10\nG0 X20Y20Z0\nG0 X0\nG0 Y10\n')
//ui.incoming.setContents('G0 F50 X10Y10Z10\nG0 X20Y20Z0\nG0 X0\nG0 Y10\nG0 F50 X10Y10Z10\nG0 X20Y20Z0\nG0 X0\nG0 Y10\nG0 F50 X10Y10Z10\nG0 X20Y20Z0\nG0 X0\nG0 Y10\nG0 F50 X10Y10Z10\nG0 X20Y20Z0\nG0 X0\nG0 Y10\n')
ui.incoming.setLabel('incoming:')
ui.incoming.setRows(50)
onLoadFile('./files/dogbone.gcode')
}
multilinein.inputs = {
......@@ -104,15 +108,12 @@ function MultiLineIn() {
if (err) throw err;
console.log('Loading:')
console.log(data);
//state.incoming.value = data
//state.incoming = state.incoming
ui.incoming.setContents(data)
})
}
multilinein.load = onLoadFile
onLoadFile('./files/dogbone.gcode')
function onExternalLine(str) {
// push new str to bottom of queue
}
......
......@@ -36,8 +36,6 @@ function uiNum() {
ui.onNumberButton.setText('number out ->')
}
state.button = Button('WHAM', onNumberDesire)
// inputs are required, and must be Input('type', callback)
uinum.inputs = {
thru: Input('any', onThruInput), // makes anything into num event
......
......@@ -61,9 +61,15 @@ function loadModuleFromSource(program, path, id) {
// state items get wrapped in a getter / setter
// so that changes from internal modules can
// push to UI
mod.state.init(mod.description.id, socket)
// and not all have state
if(mod.state != null){
mod.state.init(mod.description.id, socket)
}
mod.ui.init(mod.description.id, socket)
// not all have ui,
if(mod.ui != null){
mod.ui.init(mod.description.id, socket)
}
/*
for (key in mod.state) {
......
{
"description": {
"name": "new program",
"counter": 2
},
"modules": {
"SerialportATKLink-0": {
"description": {
"isHardware": true,
"isLink": true,
"name": "SerialportATKLink",
"alt": "window into hardware world",
"id": "SerialportATKLink-0",
"path": "./modules/hardware/atkseriallink.js",
"position": {
"left": 650,
"top": 307
}
},
"inputs": {},
"outputs": {},
"state": {
"portName": "---",
"portStatus": "closed"
},
"ui": {
"kickButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
}
}
},
"ATKStepper-1": {
"description": {
"name": "ATKStepper",
"alt": "software representation of stepper motor",
"isHardware": true,
"id": "ATKStepper-1",
"path": "./modules/hardware/atkstepper.js",
"position": {
"left": 177,
"top": 118
}
},
"inputs": {
"trapezoid": {
"accepts": "move instruction"
},
"accel": {
"accepts": "number"
},
"rmtrig": {
"accepts": "event"
}
},
"outputs": {
"ack": {
"emits": "move acknowledgement",
"calls": []
},
"position": {
"emits": "number",
"calls": []
}
},
"state": {
"message": "click below to test network",
"route": "0,0",
"rate": 2000,
"axis": "X",
"spu": 200,
"rawMove": -10,
"lead": 0,
"position": 0
},
"ui": {
"resetButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
},
"testButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
},
"rawButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
}
}
},
"ATKStepper-2": {
"description": {
"name": "ATKStepper",
"alt": "software representation of stepper motor",
"isHardware": true,
"id": "ATKStepper-2",
"path": "./modules/hardware/atkstepper.js",
"position": {
"left": 183,
"top": 545
}
},
"inputs": {
"trapezoid": {
"accepts": "move instruction"
},
"accel": {
"accepts": "number"
},
"rmtrig": {
"accepts": "event"
}
},
"outputs": {
"ack": {
"emits": "move acknowledgement",
"calls": []
},
"position": {
"emits": "number",
"calls": []
}
},
"state": {
"message": "click below to test network",
"route": "0,0",
"rate": 2000,
"axis": "X",
"spu": 200,
"rawMove": -10,
"lead": 0,
"position": 0
},
"ui": {
"resetButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
},
"testButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
},
"rawButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
}
}
}
}
}
\ No newline at end of file
{
"description": {
"name": "new program",
"counter": 6
},
"modules": {
"SerialportATKLink-0": {
"description": {
"isHardware": true,
"isLink": true,
"name": "SerialportATKLink",
"alt": "window into hardware world",
"id": "SerialportATKLink-0",
"path": "./modules/hardware/atkseriallink.js",
"position": {
"left": 2379,
"top": 568
}
},
"inputs": {},
"outputs": {},
"state": {
"portName": "---",
"portStatus": "closed"
},
"ui": {
"kickButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
}
}
},
"ATKStepper-1": {
"description": {
"name": "ATKStepper",
"alt": "software representation of stepper motor",
"isHardware": true,
"id": "ATKStepper-1",
"path": "./modules/hardware/atkstepper.js",
"position": {
"left": 1826,
"top": 77
}
},
"inputs": {
"trapezoid": {
"accepts": "move instruction"
},
"accel": {
"accepts": "number"
},
"rmtrig": {
"accepts": "event"
}
},
"outputs": {
"ack": {
"emits": "move acknowledgement",
"calls": []
},
"position": {
"emits": "number",
"calls": []
}
},
"state": {
"message": "click below to test network",
"route": "0,0",
"rate": 2000,
"axis": "X",
"spu": 200,
"rawMove": -10,
"lead": 0,
"position": 0
},
"ui": {
"resetButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
},
"testButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
},
"rawButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
}
}
},
"ATKStepper-2": {
"description": {
"name": "ATKStepper",
"alt": "software representation of stepper motor",
"isHardware": true,
"id": "ATKStepper-2",
"path": "./modules/hardware/atkstepper.js",
"position": {
"left": 1827,
"top": 499
}
},
"inputs": {
"trapezoid": {
"accepts": "move instruction"
},
"accel": {
"accepts": "number"
},
"rmtrig": {
"accepts": "event"
}
},
"outputs": {
"ack": {
"emits": "move acknowledgement",
"calls": []
},
"position": {
"emits": "number",
"calls": []
}
},
"state": {
"message": "click below to test network",
"route": "0,0",
"rate": 2000,
"axis": "X",
"spu": 200,
"rawMove": -10,
"lead": 0,
"position": 0
},
"ui": {
"resetButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
},
"testButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
},
"rawButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
}
}
},
"ATKStepper-4": {
"description": {
"name": "ATKStepper",
"alt": "software representation of stepper motor",
"isHardware": true,
"id": "ATKStepper-4",
"path": "./modules/hardware/atkstepper.js",
"position": {
"left": 1826,
"top": 928
}
},
"inputs": {
"trapezoid": {
"accepts": "move instruction"
},
"accel": {
"accepts": "number"
},
"rmtrig": {
"accepts": "event"
}
},
"outputs": {
"ack": {
"emits": "move acknowledgement",
"calls": []
},
"position": {
"emits": "number",
"calls": []
}
},
"state": {
"message": "click below to test network",
"route": "0,0",
"rate": 2000,
"axis": "X",
"spu": 200,
"rawMove": -10,
"lead": 0,
"position": 0
},
"ui": {
"resetButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
},
"testButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
},
"rawButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
}
}
},
"ATKStepper-5": {
"description": {
"name": "ATKStepper",
"alt": "software representation of stepper motor",
"isHardware": true,
"id": "ATKStepper-5",
"path": "./modules/hardware/atkstepper.js",
"position": {
"left": 1834,
"top": 1354
}
},
"inputs": {
"trapezoid": {
"accepts": "move instruction"
},
"accel": {
"accepts": "number"
},
"rmtrig": {
"accepts": "event"
}
},
"outputs": {
"ack": {
"emits": "move acknowledgement",
"calls": []
},
"position": {
"emits": "number",
"calls": []
}
},
"state": {
"message": "click below to test network",
"route": "0,0",
"rate": 2000,
"axis": "X",
"spu": 200,
"rawMove": -10,
"lead": 0,
"position": 0
},
"ui": {
"resetButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
},
"testButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
},
"rawButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
}
}
},
"ATKBBB-Servo-6": {
"description": {
"name": "ATKBBB-Servo",
"alt": "software representation of networked hardware object",
"isHardware": true,
"id": "ATKBBB-Servo-6",
"path": "./modules/hardware/atkbreadboardboard.js",
"position": {
"left": 2320,
"top": 1484
}
},
"inputs": {
"servoVal": {
"accepts": "number"
},
"adcRequest": {
"accepts": "event"
}
},
"outputs": {
"servoConf": {
"emits": "event",
"calls": []
},
"adcValue": {
"emits": "number",
"calls": []
}
},
"state": {
"message": "click below to test network",
"route": "0,0",
"servoVal": 0
},
"ui": {
"resetButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
},
"testButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
},
"servoButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
},
"adcReqButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
}
}
}
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"description": {
"name": "new program",
"counter": 7
},
"modules": {
"Gcode Parser-0": {
"description": {
"name": "Gcode Parser",
"alt": "line of gcode -> planner recognized move",
"id": "Gcode Parser-0",
"path": "./modules/parsing/gcode.js",
"position": {
"left": 676,
"top": 96
}
},
"inputs": {
"lineIn": {
"accepts": "string"
}
},
"outputs": {
"instructionOut": {
"emits": "move instruction",
"calls": []
},
"modeChange": {
"emits": "string",
"calls": []
}
},
"state": {
"mode": "G0",
"G0": 1200,
"G1": 400
},
"ui": {}
},
"Multi-line Text Input-1": {
"description": {
"name": "Multi-line Text Input",
"alt": "sequential txt input",
"id": "Multi-line Text Input-1",
"path": "./modules/ui/multiline.js",
"position": {
"left": 109,
"top": 93
}
},
"inputs": {
"req": {
"accepts": "number"
},
"lineIn": {
"accepts": "string"
},
"load": {
"accepts": "path"
}
},
"outputs": {
"lineOut": {
"emits": "string",
"calls": []
}
},
"state": {},
"ui": {
"thruButton": {
"type": "button",
"clientPath": "ui/uiButton.js"
},
"previously": {
"type": "button",