diff --git a/LOG.md b/LOG.md index 3445d72935aedec7db5b45b363cd943f999e287f..354d24aae7320c47c425934fd5d8a93eb4cf7771 100644 --- a/LOG.md +++ b/LOG.md @@ -2,7 +2,7 @@ ## Dev Golf -hour- + long tasks under existing structures, +hour +/- long tasks under existing structures, ``` - assign meaning to charts and graphs (date / location / etc) @@ -23,6 +23,10 @@ hour- + long tasks under existing structures, - arrow keys to bump through items ``` +## Examples + +Build a looping structure that replaces / stands in for traditional 'for/while' type structures. Recursing through offsets for the path is the currently pertinent example. Again this is a kind of polymorphic issue / etc. Want to write one kind of recursor, often need some secondary trigger / flowcontrol gate item that is of-the-appropriate-type. + ## Aspirational Dev Things we want to see, extensions, etc, diff --git a/hunks/pipes/filepipe.js b/hunks/pipes/devicepipe.js similarity index 93% rename from hunks/pipes/filepipe.js rename to hunks/pipes/devicepipe.js index d675998da8a2ffe53c6f389113d93ba153d723af..5ea4e65f92c6b48b19ec1cfcd81883e626592e28 100644 --- a/hunks/pipes/filepipe.js +++ b/hunks/pipes/devicepipe.js @@ -19,7 +19,12 @@ const STATUS_OPEN = 'open' const STATUS_CLOSED = 'closed' const STATUS_ERROR = 'error' -export default function VFPTC() { +// catch this? +throw new Error('thou shalt not load this incomplete hunk') + +// incomplete - *just* able to open pipe downstream, + +export default function DevicePipe() { Hunkify(this) let debug = false @@ -69,7 +74,7 @@ export default function VFPTC() { if (pipeStatusMessage.value === STATUS_OPEN || pipeStatusMessage.value === STATUS_OPENING) return // ask the server to instantiate the reciprocal process, pipeStatusMessage.set(STATUS_OPENING) - jQuery.get(`spawnProcess/filepipe.js?args=${portSelect.value},${usbPidSelect.value}`, (data) => { + jQuery.get(`spawnProcess/devicepipe.js?args=${portSelect.value},${usbPidSelect.value}`, (data) => { if (data.startup) { console.log(`serverside launched with pid ${data.pid}, starting client`) remoteProcessId = data.pid @@ -119,7 +124,7 @@ export default function VFPTC() { } else if (data.type === 'serial status'){ serialStatusMessage.set(data.status) } else { - console.error('vfptc unhandled:', data) + console.error('DevicePipe unhandled:', data) } } else { if(msg.data instanceof Blob){ diff --git a/processes/devicepipe.js b/processes/devicepipe.js index e730cbb93ae054cc07ea2cf1b69485098130ba0e..72991c1f9ca61b58eaab8427806503fce535167d 100644 --- a/processes/devicepipe.js +++ b/processes/devicepipe.js @@ -71,8 +71,19 @@ let sendToBrowser = (msg) => { // device business, +/* +So, right now (tired!) I'm trying to figure out how Neil writes commands to the Modelas... So far: + - neil has 'command' and 'file' types: these look like just writing strings to the device + - the path walks the segments, writes to strings, makes a big blob, sends that to the device server, OK + - 'jog height' is some path-work built into the machine code... should be separate: path should *just* be move segments ... + - serverside device server writes to the device at `dev/name` ... in a medium-odd loop, might take a minute to get this together. +*/ + let findDevice = () => { + // default: no real way to 'find' without some secondary usb library, + // or: make a call to system lsusb ? let file = 'lp0' + // the 'write' (w) flag is ~ important ~ fs.open(`/dev/usb/${file}`, 'w', (err, fd) => { if(err){ console.log(err)