From 7f7e3199b99367c0dfe7a873f8e4bc1cb98e11b0 Mon Sep 17 00:00:00 2001
From: Jake Read <jake.read@cba.mit.edu>
Date: Fri, 25 Oct 2019 18:50:46 -0400
Subject: [PATCH] pipes pipes pipes, notes

---
 LOG.md                                     |  6 +++++-
 hunks/pipes/{filepipe.js => devicepipe.js} | 11 ++++++++---
 processes/devicepipe.js                    | 11 +++++++++++
 3 files changed, 24 insertions(+), 4 deletions(-)
 rename hunks/pipes/{filepipe.js => devicepipe.js} (93%)

diff --git a/LOG.md b/LOG.md
index 3445d72..354d24a 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 d675998..5ea4e65 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 e730cbb..72991c1 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)
-- 
GitLab