Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jake Read
rndmc
Commits
c96e76cb
Commit
c96e76cb
authored
Nov 26, 2018
by
Jake Read
Browse files
prgmem for mm
parent
f07b00ae
Changes
18
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
c96e76cb
...
...
@@ -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
...
...
client/style.css
View file @
c96e76cb
...
...
@@ -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
;
}
...
...
client/ui/multiline.js
View file @
c96e76cb
...
...
@@ -11,7 +11,7 @@
li
.
appendChild
(
document
.
createElement
(
'
br
'
))
var
txtArea
=
document
.
createElement
(
'
textarea
'
)
txtArea
.
rows
=
25
txtArea
.
cols
=
2
5
txtArea
.
cols
=
4
5
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
}
...
...
modules/hardware/atkbreadboardboard.js
View file @
c96e76cb
...
...
@@ -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)
...
...
modules/hardware/atkseriallink.js
View file @
c96e76cb
...
...
@@ -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
()
...
...
modules/ui/multiline.js
View file @
c96e76cb
...
...
@@ -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
\n
G0 X20Y20Z0
\n
G0 X0
\n
G0 Y10
\n
G0 F50 X10Y10Z10
\n
G0 X20Y20Z0
\n
G0 X0
\n
G0 Y10
\n
G0 F50 X10Y10Z10
\n
G0 X20Y20Z0
\n
G0 X0
\n
G0 Y10
\n
G0 F50 X10Y10Z10
\n
G0 X20Y20Z0
\n
G0 X0
\n
G0 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
}
...
...
modules/ui/number.js
View file @
c96e76cb
...
...
@@ -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
...
...
programs.js
View file @
c96e76cb
...
...
@@ -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) {
...
...
programs/mm2.json
0 → 100644
View file @
c96e76cb
{
"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
programs/mm3.json
0 → 100644
View file @
c96e76cb
{
"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"