diff --git a/README.md b/README.md index 98ce70b9f1486de052b70671b735406c3be8cac5..e3f2c103f1b3dcbbf0d0f00ced9e8de4f28db981 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,7 @@ To assemble a representation of these, we want to have a kind of 'netlist' that, ## Desires - heirarchy zoom - architectural clarity betwixt UI and Heap +- some auto load / save currently.json file so that we can restart program w/o pain ... maybe just save on new user inputs ? - states / uis / etc - one off / one-at-a-time for updates - i.e. all f'n update calls are to single module-global state update - ! diff --git a/modules/hardware/atkseriallink.js b/modules/hardware/atkseriallink.js index 207dc8635ac0d77a47ce4192d0017f5c43880e1b..a42a6e2c7b07378358c1d295f4f5e248b97a2c22 100644 --- a/modules/hardware/atkseriallink.js +++ b/modules/hardware/atkseriallink.js @@ -26,6 +26,10 @@ function ATKSerialLink() { state.connect = Button('click to find and connect', findSerialPort) state.portStatus = 'closed' // or we hope it will be + atkSerialLink.init = function(){ + findSerialPort() + } + /* ------------------------------------------------------ HOOKING UP diff --git a/modules/motion/planner.js b/modules/motion/planner.js index 1ff4fe668fcf5d5e35c2582d2477882d682198b5..aec37ff256b9a13d37d8be3b3ad2be15ad9771ca 100644 --- a/modules/motion/planner.js +++ b/modules/motion/planner.js @@ -54,6 +54,13 @@ function Planner() { moveComplete: Output('number') } + // we'll use one of these to assert / do things + // after the module is loaded, and state is copied etc + // i.e. one thing we can do is assert a starting value + planner.init = function(){ + state.isRunning = 0 + } + /* ------------------------------------------------------ UPDATING / SETUP diff --git a/programs.js b/programs.js index 8f0f80d95eebc815b55beff1ad659678b59889c6..9582a6ec53a98a1b3612f50191257d6460b443b9 100644 --- a/programs.js +++ b/programs.js @@ -271,6 +271,11 @@ function openProgram(path) { } } + // and let's run init if it's there + if(mdl.init != null){ + mdl.init() + } + //console.log('mdlRep', mdlRep) //console.log('mdl', mdl) // restore position / UI state diff --git a/views.js b/views.js index 474197918071747b0a1b289bbf8cf0bd3275c0f5..689eb3dbe4faafa24f7a14ea4eba44941d32eadf 100644 --- a/views.js +++ b/views.js @@ -230,6 +230,10 @@ function uiRequestNewModule(data) { // just burn it down socketSend('restart', '') } + // TODO: questionable init - here and in loadProgram, should be better handled across board + if(program.modules[latest].init != null){ + program.modules[latest].init() + } socketSend('put module', Reps.makeFromModule(program.modules[keys[keys.length - 1]])) }