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
2cfe5959
Commit
2cfe5959
authored
Dec 07, 2018
by
Jake Read
Browse files
ok flow ready to poll robot
parent
e8d0418d
Changes
6
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
2cfe5959
...
...
@@ -272,6 +272,8 @@ View.assignProgram(program)
-
ui / button
-
svg doesn't display on chrome
-
would like to send board with new buck out to fab
-
just do stepper23, bc if that's it, that's it ?
...
...
modules/hardware/atkmrobot.js
View file @
2cfe5959
...
...
@@ -34,10 +34,12 @@ function ATKMathRobot() {
// inputs and outputs as usual
atkmr
.
inputs
=
{
tick
:
Input
(
'
event
'
,
onPositionTickTock
),
pc_t
:
Input
(
'
number
'
,
onPositionTargetInput
)
set_pc_t
:
Input
(
'
number
'
,
onPositionTargetInput
),
get_pos
:
Input
(
'
event
'
,
onPositionRequest
)
}
atkmr
.
outputs
=
{
ok
:
Output
(
'
nothing-yet
'
)
ok
:
Output
(
'
nothing-yet
'
),
pos
:
Output
(
'
uint16_t
'
)
}
// and state as well
...
...
@@ -81,6 +83,15 @@ function ATKMathRobot() {
console
.
log
(
"
INPUTS NOT YET BOUND
"
,
evt
)
}
function
onPositionRequest
(
evt
){
var
pckt
=
[
145
]
atkmr
.
route
.
send
(
pckt
)
}
atkmr
.
route
.
subscribe
(
145
,
function
(
msg
){
console
.
log
(
'
145 return
'
,
msg
)
})
function
onPositionTargetUserChange
()
{
var
pc_t
=
state
.
pc_t
if
(
pc_t
>
16384
)
{
...
...
@@ -112,8 +123,6 @@ function ATKMathRobot() {
state
.
message
=
'
packet ok
'
})
atkmr
.
go
=
onKValsUpdate
return
atkmr
}
...
...
modules/util/gate.js
View file @
2cfe5959
...
...
@@ -45,14 +45,13 @@ function Gate() {
function
onButtonPress
(
evt
)
{
console
.
log
(
"
GATE BUTTON
"
)
state
.
toggle
.
isPressed
=
false
if
(
gate
.
isOpen
)
{
gate
.
isOpen
=
false
state
.
message
=
'
closed
'
}
else
{
gate
.
isOpen
=
true
state
.
message
=
'
open
'
gate
.
outputs
.
out
.
emit
(
'
go
'
)
//
gate.outputs.out.emit('go')
}
}
...
...
programs.js
View file @
2cfe5959
...
...
@@ -295,11 +295,22 @@ function openProgram(path) {
return
program
}
/* helper functions */
function
SetUI
(
module
,
left
,
top
){
if
(
module
.
description
.
position
==
null
)
{
module
.
description
.
position
=
{}
}
module
.
description
.
position
.
left
=
left
module
.
description
.
position
.
top
=
top
}
module
.
exports
=
{
new
:
newProgram
,
open
:
openProgram
,
save
:
saveProgram
,
loadModuleFromSource
:
loadModuleFromSource
,
removeModule
:
removeModuleFromProgram
,
assignSocket
:
assignSocket
assignSocket
:
assignSocket
,
setUI
:
SetUI
}
\ No newline at end of file
robot.js
0 → 100644
View file @
2cfe5959
// business
const
Reps
=
require
(
'
./reps.js
'
)
const
Programs
=
require
(
'
./programs.js
'
)
// the program object: real simple, just has a description, and a 'modules'
var
program
=
Programs
.
new
(
'
new program
'
)
var
link
=
Programs
.
loadModuleFromSource
(
program
,
'
./modules/hardware/atkseriallink.js
'
)
link
.
startUp
()
Programs
.
setUI
(
link
,
1050
,
50
)
var
mrbot
=
Programs
.
loadModuleFromSource
(
program
,
'
./modules/hardware/atkmrobot.js
'
)
Programs
.
setUI
(
mrbot
,
600
,
50
)
var
button
=
Programs
.
loadModuleFromSource
(
program
,
'
./modules/ui/button.js
'
)
var
delay
=
Programs
.
loadModuleFromSource
(
program
,
'
./modules/util/delay.js
'
)
var
gate
=
Programs
.
loadModuleFromSource
(
program
,
'
./modules/util/gate.js
'
)
//delay.outputs.out.attach(gate.inputs.thru)
//gate.outputs.out.attach(delay.inputs.thru)
Programs
.
setUI
(
button
,
90
,
50
)
Programs
.
setUI
(
delay
,
90
,
250
)
Programs
.
setUI
(
gate
,
90
,
400
)
button
.
outputs
.
whammy
.
attach
(
mrbot
.
inputs
.
get_pos
)
button
.
outputs
.
whammy
.
attach
(
delay
.
inputs
.
thru
)
delay
.
outputs
.
out
.
attach
(
gate
.
inputs
.
thru
)
gate
.
outputs
.
out
.
attach
(
button
.
inputs
.
thru
)
var
log
=
Programs
.
loadModuleFromSource
(
program
,
'
./modules/util/log.js
'
)
Programs
.
setUI
(
log
,
840
,
520
)
mrbot
.
outputs
.
pos
.
attach
(
log
.
inputs
.
thru
)
/*
var stest = Programs.loadModuleFromSource(program, './modules/ui/stest.js')
var rep = Reps.makeFromModule(stest)
console.log('rep', rep)
/* example program-like-an-api
// load some modules
var multiline = Programs.loadModuleFromSource(program, './modules/ui/multiline.js')
var gcode = Programs.loadModuleFromSource(program, './modules/parsing/gcode.js')
// attaching: always like outputs to inputs
multiline.outputs.lineOut.attach(gcode.inputs.lineIn)
// we can move things around here as well
multiline.description.position = {
left: 50,
top: 50
}
gcode.description.position = {
left: 500,
top: 100
}
// if I have a public function in a module, I can also use that
multiline.load('./files/dogbone.gcode')
*/
// UI
const
View
=
require
(
'
./views.js
'
)
View
.
startHttp
()
View
.
startWs
()
Programs
.
assignSocket
(
View
.
uiSocket
)
View
.
assignProgram
(
program
)
\ No newline at end of file
rundmc.js
View file @
2cfe5959
...
...
@@ -31,24 +31,6 @@ const Programs = require('./programs.js')
// the program object: real simple, just has a description, and a 'modules'
var
program
=
Programs
.
new
(
'
new program
'
)
var
link
=
Programs
.
loadModuleFromSource
(
program
,
'
./modules/hardware/atkseriallink.js
'
)
link
.
startUp
()
link
.
description
.
position
=
{
left
:
600
,
top
:
50
}
var
mrbot
=
Programs
.
loadModuleFromSource
(
program
,
'
./modules/hardware/atkmrobot.js
'
)
mrbot
.
description
.
position
=
{
left
:
20
,
top
:
50
}
mrbot
.
go
()
/*
var stest = Programs.loadModuleFromSource(program, './modules/ui/stest.js')
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment