Commit 2cfe5959 authored by Jake Read's avatar Jake Read

ok flow ready to poll robot

parent e8d0418d
......@@ -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 ?
......
......@@ -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
}
......
......@@ -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')
}
}
......
......@@ -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
// 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
......@@ -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')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment