diff --git a/hunks/calibrations/lsq.js b/hunks/calibrations/lsq.js index c8ccf65c338d17c2ef47a731821f5c264910bc25..5bc58ac405062f2d4cad3592c4fa5341ef5fa2c2 100644 --- a/hunks/calibrations/lsq.js +++ b/hunks/calibrations/lsq.js @@ -1,7 +1,8 @@ /* -read calibrated loadcell values -from n- measurements +input previous system measurements as state (lists) +make predictions for y based on input at x, with lsq. from old data +to expand: accept arrays as inputs, from automatic measurements ? */ @@ -26,8 +27,8 @@ export default function LoadcellCalibration() { let isOkToCalc = false // admit unwillingness to write nice array wrappers, // do that locally .. - let xStateArray = new State('string', 'csv: readings: x', '0, 250, 500') - let yStateArray = new State('string', 'csv: readings: y', '-100, -14000, -15000') + let xStateArray = new State('string', 'csv: readings: x', '25, 14854, 29649, 44453, 74061, 103695') + let yStateArray = new State('string', 'csv: readings: y', '0, 100, 200, 300, 500, 700') // state! let m, b = 0 let writeCalExpression = () => { @@ -46,10 +47,11 @@ export default function LoadcellCalibration() { m = lsqr.m b = lsqr.b isOkToCalc = true + // we round 'em out a bit ... local values are full width; if (b >= 0) { - return `${m}x + ${b}` + return `${Math.round(m*1000)/1000}x + ${Math.round(b*1000)/1000}` } else { - return `${m}x ${b}` + return `${Math.round(m*1000)/1000}x ${Math.round(b*1000)/1000}` } } else { isOkToCalc = false @@ -75,7 +77,7 @@ export default function LoadcellCalibration() { if (loadCellInput.io()) { if (isOkToCalc) { if (!loadReading.io()) { - // proceeeed + loadReading.put(m * loadCellInput.get() + b) } } else { // not ok to calc, clear flow control anyways, diff --git a/hunks/data/log_numbers.js b/hunks/data/log_numbers.js new file mode 100644 index 0000000000000000000000000000000000000000..13b2c0c8dbecd7172e9dee686b5b3faaee3715bc --- /dev/null +++ b/hunks/data/log_numbers.js @@ -0,0 +1,43 @@ +/* + +debugger ! log anything ! + +*/ + +import { Hunkify, Input, Output, State } from '../hunks.js' + +export default function NumberLogger() { + Hunkify(this) + + // hmm... + let tolog = new Input('number', 'tolog', this) + this.inputs.push(tolog) + + let logToConsole = new State('boolean', 'console', false) + this.states.push(logToConsole) + + this.dom = {} + + this.init = () => { + this.dom = $('<div>').get(0) + } + + this.onload = () => { + //error here + let text = $('<div>').addClass('txt').append('- >').get(0) + $(this.dom).append(text) + } + + this.loop = () => { + // this will be called once every round turn + // typically we check flow control first + if (tolog.io()) { + // an input is occupied, and the exit path is empty + let val = tolog.get() + $(this.dom).children('.txt').html(val) + if (logToConsole.value === true) { + console.log(`logger ${this.ind}`, val) + } + } + } +} diff --git a/hunks/data/log_objects.js b/hunks/data/log_objects.js new file mode 100644 index 0000000000000000000000000000000000000000..3a349bf8763eb7e85114be12d3d2e5ab8878343d --- /dev/null +++ b/hunks/data/log_objects.js @@ -0,0 +1,49 @@ +/* + +debugger ! log anything ! + +*/ + +import { Hunkify, Input, Output, State } from '../hunks.js' + +export default function ObjectLogger() { + Hunkify(this) + + // hmm... + let tolog = new Input('reference', 'tolog', this) + this.inputs.push(tolog) + + let prefix = new State('string', 'prefix', 'LOG:') + let logToConsole = new State('boolean', 'console', true) + this.states.push(prefix, logToConsole) + + this.dom = {} + + this.init = () => { + this.dom = $('<div>').get(0) + } + + this.onload = () => { + //error here + let text = $('<div>').addClass('txt').append('- >').get(0) + $(this.dom).append(text) + } + + this.loop = () => { + // this will be called once every round turn + // typically we check flow control first + if (tolog.io()) { + // an input is occupied, and the exit path is empty + let val = tolog.get() + if (Array.isArray(val)) { + val = val.join(', ') + } else if (typeof val === "boolean") { + val = val.toString() + } + $(this.dom).children('.txt').html(val) + if (logToConsole.value === true) { + console.log(this.ind, prefix.value, val) + } + } + } +} diff --git a/hunks/data/logger.js b/hunks/data/logger.js deleted file mode 100644 index 3c3ffdc3a40004c0fe7e88417ee06a06428cee0e..0000000000000000000000000000000000000000 --- a/hunks/data/logger.js +++ /dev/null @@ -1,54 +0,0 @@ -/* - -debugger ! log anything ! - -*/ - -import { Hunkify, Input, Output, State } from '../hunks.js' - -function Logger() { - Hunkify(this, 'Logger') - - // hmm... - let tolog = new Input('reference', 'tolog', this) - this.inputs.push(tolog) - - let prefix = new State('string', 'prefix', 'LOG:') - let logToConsole = new State('boolean', 'console', true) - this.states.push(prefix, logToConsole) - - this.dom = {} - - this.init = () => { - // manager calls this once - // it is loaded and state is updated (from program) - this.log('HELLO LOGGER') - this.dom = $('<div>').get(0) - } - - this.onload = () => { - //error here - let text = $('<div>').addClass('txt').append('- >').get(0) - $(this.dom).append(text) - } - - this.loop = () => { - // this will be called once every round turn - // typically we check flow control first - if (tolog.io()) { - // an input is occupied, and the exit path is empty - let val = tolog.get() - if(Array.isArray(val)){ - val = val.join(', ') - } else if (typeof val === "boolean"){ - val = val.toString() - } - $(this.dom).children('.txt').html(val) - if (logToConsole.value === true) { - console.log(this.ind, prefix.value, val) - } - } - } -} - -export default Logger diff --git a/hunks/interface/button.js b/hunks/interface/button.js index 954095d512be0f1b3723494970846d629277bf62..e85a1d984a3e9b226f28d72bce22b058ba065e34 100644 --- a/hunks/interface/button.js +++ b/hunks/interface/button.js @@ -9,9 +9,6 @@ import { Hunkify, Input, Output, State } from '../hunks.js' function Button() { Hunkify(this, 'Button') - let trigger = new Input('any', 'trigger', this) - this.inputs.push(trigger) - let onclk = new Output('boolean', 'onclick', this) this.outputs.push(onclk) /* aspirationally @@ -48,12 +45,7 @@ function Button() { } this.loop = () => { - // this will be called once every round turn - // typically we check flow control first - if (trigger.io() && !(onclk.io())) { - // an input is occupied, and the exit path is empty - onclk.put(true) - } + // ... } } diff --git a/hunks/statemachines/dex.js b/hunks/statemachines/dex.js index b550785388d3f5da714a35072da3eeb62f6609ad..10a1027f3954467fd680172cfa0fa413cf26d5c3 100644 --- a/hunks/statemachines/dex.js +++ b/hunks/statemachines/dex.js @@ -8,6 +8,18 @@ etc */ +/* + +loadcell readings: +0g: 25 +100g: 14854 +200g: 29649 +300g: 44453 +500g: 74061 +700g: 103695 + +*/ + // these are ES6 modules import { Hunkify, diff --git a/save/systems/dex-calibrator.json b/save/systems/dex-calibrator.json new file mode 100644 index 0000000000000000000000000000000000000000..8a827cb598634973d743512e6296c8ba3b2fe158 --- /dev/null +++ b/save/systems/dex-calibrator.json @@ -0,0 +1,700 @@ +{ + "interpreterName": "cuttlefish", + "interpreterVersion": "v0.1", + "hunks": [ + { + "type": "manager", + "name": "nrol", + "inputs": [ + { + "name": "msgs", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "msgs", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "1", + "inHunkInput": "0" + } + ] + } + ] + }, + { + "type": "view", + "name": "tlview", + "inputs": [ + { + "name": "msgs", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "msgs", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "0", + "inHunkInput": "0" + } + ] + } + ] + }, + { + "type": "pipes/vfptc", + "name": "pipes/vfptc_2", + "inputs": [ + { + "name": "data", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "data", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "3", + "inHunkInput": "0" + } + ] + } + ], + "states": [ + { + "name": "pipe status", + "type": "string", + "value": "open" + }, + { + "name": "websocket port", + "type": "string", + "value": "2042" + }, + { + "name": "usb product id", + "type": "string", + "value": "8022" + }, + { + "name": "pipe reset", + "type": "boolean", + "value": "false" + }, + { + "name": "serialport status", + "type": "string", + "value": "open" + } + ] + }, + { + "type": "link", + "name": "link_3", + "inputs": [ + { + "name": "data", + "type": "byteArray" + }, + { + "name": "mgrMsgs", + "type": "byteArray" + }, + { + "name": "auto_5_2", + "type": "byteArray" + }, + { + "name": "auto_230_4", + "type": "boolean" + } + ], + "outputs": [ + { + "name": "data", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "2", + "inHunkInput": "0" + } + ] + }, + { + "name": "mgrMsgs", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "4", + "inHunkInput": "0" + } + ] + }, + { + "name": "auto_164_3", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "5", + "inHunkInput": "0" + } + ] + }, + { + "name": "auto_246_2", + "type": "int32", + "connections": [ + { + "inHunkIndex": "6", + "inHunkInput": "0" + }, + { + "inHunkIndex": "9", + "inHunkInput": "0" + } + ] + } + ], + "states": [ + { + "name": "isActive", + "type": "boolean", + "value": "true" + }, + { + "name": "otherLink", + "type": "uint16", + "value": "1" + }, + { + "name": "inputList", + "type": "string", + "value": "mgrMsgs (byteArray), auto_5_2 (byteArray), auto_230_4 (boolean)" + }, + { + "name": "outputList", + "type": "string", + "value": "mgrMsgs (byteArray), auto_164_3 (byteArray), auto_246_2 (int32)" + } + ], + "contains": { + "interpreterName": "ponyo", + "interpreterVersion": "v0.1", + "hunks": [ + { + "type": "manager", + "name": "ponyo_one", + "inputs": [ + { + "name": "mgrMsgs_1024", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "mgrMsgs_1024", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "1", + "inHunkInput": "1" + } + ] + } + ] + }, + { + "type": "link", + "name": "link_1", + "inputs": [ + { + "name": "data_1024", + "type": "byteArray" + }, + { + "name": "mgrMsgs_1024", + "type": "byteArray" + }, + { + "name": "auto_168_3_512", + "type": "byteArray" + }, + { + "name": "auto_236_3", + "type": "int32" + } + ], + "outputs": [ + { + "name": "data_1024", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "2", + "inHunkInput": "0" + } + ] + }, + { + "name": "mgrMsgs_1024", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "0", + "inHunkInput": "0" + } + ] + }, + { + "name": "auto_8_2_512", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "3", + "inHunkInput": "1" + } + ] + }, + { + "name": "auto_120_3", + "type": "boolean", + "connections": [ + { + "inHunkIndex": "3", + "inHunkInput": "2" + } + ] + } + ], + "states": [ + { + "name": "isActive", + "type": "boolean", + "value": "true" + }, + { + "name": "otherLink", + "type": "uint16", + "value": "3" + }, + { + "name": "inputList", + "type": "string", + "value": "mgrMsgs (byteArray), auto_168_3 (byteArray), auto_236_3 (int32)" + }, + { + "name": "outputList", + "type": "string", + "value": "mgrMsgs (byteArray), auto_8_2 (byteArray), auto_120_3 (boolean)" + } + ] + }, + { + "type": "comm/COBSerialUSB", + "name": "comm/COBSerialUSB_2", + "inputs": [ + { + "name": "data_1024", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "data_1024", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "1", + "inHunkInput": "0" + } + ] + } + ] + }, + { + "type": "link", + "name": "link_3", + "inputs": [ + { + "name": "data_1024", + "type": "byteArray" + }, + { + "name": "mgrMsgs_512", + "type": "byteArray" + }, + { + "name": "auto_250_3", + "type": "boolean" + } + ], + "outputs": [ + { + "name": "data_1024", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "4", + "inHunkInput": "0" + } + ] + }, + { + "name": "mgrMsgs_512", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "1", + "inHunkInput": "2" + } + ] + }, + { + "name": "auto_47_2", + "type": "int32", + "connections": [ + { + "inHunkIndex": "1", + "inHunkInput": "3" + } + ] + } + ], + "states": [ + { + "name": "isActive", + "type": "boolean", + "value": "true" + }, + { + "name": "otherLink", + "type": "uint16", + "value": "1" + }, + { + "name": "inputList", + "type": "string", + "value": "mgrMsgs (byteArray), auto_250_3 (boolean)" + }, + { + "name": "outputList", + "type": "string", + "value": "mgrMsgs (byteArray), auto_47_2 (int32)" + } + ], + "contains": { + "interpreterName": "ponyo", + "interpreterVersion": "v0.1", + "hunks": [ + { + "type": "manager", + "name": "ponyo_one", + "inputs": [ + { + "name": "mgrMsgs_1024", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "mgrMsgs_1024", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "1", + "inHunkInput": "1" + } + ] + } + ] + }, + { + "type": "link", + "name": "link_1", + "inputs": [ + { + "name": "data_1024", + "type": "byteArray" + }, + { + "name": "mgrMsgs_1024", + "type": "byteArray" + }, + { + "name": "auto_78_2", + "type": "int32" + } + ], + "outputs": [ + { + "name": "data_1024", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "2", + "inHunkInput": "0" + } + ] + }, + { + "name": "mgrMsgs_1024", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "0", + "inHunkInput": "0" + } + ] + }, + { + "name": "auto_214_4", + "type": "boolean", + "connections": [ + { + "inHunkIndex": "3", + "inHunkInput": "0" + } + ] + } + ], + "states": [ + { + "name": "isActive", + "type": "boolean", + "value": "true" + }, + { + "name": "otherLink", + "type": "uint16", + "value": "3" + }, + { + "name": "inputList", + "type": "string", + "value": "mgrMsgs (byteArray), auto_78_2 (int32)" + }, + { + "name": "outputList", + "type": "string", + "value": "mgrMsgs (byteArray), auto_214_4 (boolean)" + } + ] + }, + { + "type": "comm/COBSerialRJ45_A", + "name": "comm/COBSerialRJ45_A_2", + "inputs": [ + { + "name": "data_1024", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "data_1024", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "1", + "inHunkInput": "0" + } + ] + } + ] + }, + { + "type": "loadcell", + "name": "loadcell_3", + "inputs": [ + { + "name": "read", + "type": "boolean" + }, + { + "name": "tare", + "type": "boolean" + } + ], + "outputs": [ + { + "name": "24bit", + "type": "int32", + "connections": [ + { + "inHunkIndex": "1", + "inHunkInput": "2" + } + ] + } + ] + } + ] + } + }, + { + "type": "comm/COBSerialRJ45_E", + "name": "comm/COBSerialRJ45_E_4", + "inputs": [ + { + "name": "data_1024", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "data_1024", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "3", + "inHunkInput": "0" + } + ] + } + ] + } + ] + } + }, + { + "type": "view", + "name": "view_4", + "inputs": [ + { + "name": "msgs", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "msgs", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "3", + "inHunkInput": "1" + } + ] + } + ] + }, + { + "type": "view", + "name": "view_5", + "inputs": [ + { + "name": "msgs", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "msgs", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "3", + "inHunkInput": "2" + } + ] + } + ] + }, + { + "type": "data/log_numbers", + "name": "data/log_numbers_6", + "inputs": [ + { + "name": "tolog", + "type": "number" + } + ], + "states": [ + { + "name": "console", + "type": "boolean", + "value": "false" + } + ] + }, + { + "type": "interface/button", + "name": "interface/button_7", + "outputs": [ + { + "name": "onclick", + "type": "boolean", + "connections": [ + { + "inHunkIndex": "3", + "inHunkInput": "3" + } + ] + } + ] + }, + { + "type": "data/log_numbers", + "name": "data/log_numbers_9", + "inputs": [ + { + "name": "tolog", + "type": "number" + } + ], + "states": [ + { + "name": "console", + "type": "boolean", + "value": "false" + } + ] + }, + { + "type": "calibrations/lsq", + "name": "calibrations/lsq_10", + "inputs": [ + { + "name": "reading", + "type": "number" + } + ], + "outputs": [ + { + "name": "prediction", + "type": "number", + "connections": [ + { + "inHunkIndex": "8", + "inHunkInput": "0" + } + ] + } + ], + "states": [ + { + "name": "csv: readings: x", + "type": "string", + "value": "25, 14854, 29649, 44453, 74061, 103695" + }, + { + "name": "csv: readings: y", + "type": "string", + "value": "0, 100, 200, 300, 500, 700" + }, + { + "name": "calibration result", + "type": "string", + "value": "0.007x -0.218" + } + ] + } + ] +} \ No newline at end of file diff --git a/save/systems/dive-l1-e.json b/save/systems/dive-l1-e.json new file mode 100644 index 0000000000000000000000000000000000000000..e0b072dc4bc4f9f2ca783c38f7fd4827a45d2734 --- /dev/null +++ b/save/systems/dive-l1-e.json @@ -0,0 +1,525 @@ +{ + "interpreterName": "cuttlefish", + "interpreterVersion": "v0.1", + "hunks": [ + { + "type": "manager", + "name": "nrol", + "inputs": [ + { + "name": "msgs", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "msgs", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "1", + "inHunkInput": "0" + } + ] + } + ] + }, + { + "type": "view", + "name": "tlview", + "inputs": [ + { + "name": "msgs", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "msgs", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "0", + "inHunkInput": "0" + } + ] + } + ] + }, + { + "type": "pipes/vfptc", + "name": "pipes/vfptc_2", + "inputs": [ + { + "name": "data", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "data", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "3", + "inHunkInput": "0" + } + ] + } + ], + "states": [ + { + "name": "pipe status", + "type": "string", + "value": "open" + }, + { + "name": "websocket port", + "type": "string", + "value": "2042" + }, + { + "name": "usb product id", + "type": "string", + "value": "8022" + }, + { + "name": "pipe reset", + "type": "boolean", + "value": "false" + }, + { + "name": "serialport status", + "type": "string", + "value": "open" + } + ] + }, + { + "type": "link", + "name": "link_3", + "inputs": [ + { + "name": "data", + "type": "byteArray" + }, + { + "name": "mgrMsgs", + "type": "byteArray" + }, + { + "name": "auto_5_2", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "data", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "2", + "inHunkInput": "0" + } + ] + }, + { + "name": "mgrMsgs", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "4", + "inHunkInput": "0" + } + ] + }, + { + "name": "auto_164_3", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "5", + "inHunkInput": "0" + } + ] + } + ], + "states": [ + { + "name": "isActive", + "type": "boolean", + "value": "true" + }, + { + "name": "otherLink", + "type": "uint16", + "value": "1" + }, + { + "name": "inputList", + "type": "string", + "value": "mgrMsgs (byteArray), auto_5_2 (byteArray)" + }, + { + "name": "outputList", + "type": "string", + "value": "mgrMsgs (byteArray), auto_164_3 (byteArray)" + } + ], + "contains": { + "interpreterName": "ponyo", + "interpreterVersion": "v0.1", + "hunks": [ + { + "type": "manager", + "name": "ponyo_one", + "inputs": [ + { + "name": "mgrMsgs_1024", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "mgrMsgs_1024", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "1", + "inHunkInput": "1" + } + ] + } + ] + }, + { + "type": "link", + "name": "link_1", + "inputs": [ + { + "name": "data_1024", + "type": "byteArray" + }, + { + "name": "mgrMsgs_1024", + "type": "byteArray" + }, + { + "name": "auto_168_3_512", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "data_1024", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "2", + "inHunkInput": "0" + } + ] + }, + { + "name": "mgrMsgs_1024", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "0", + "inHunkInput": "0" + } + ] + }, + { + "name": "auto_8_2_512", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "3", + "inHunkInput": "1" + } + ] + } + ], + "states": [ + { + "name": "isActive", + "type": "boolean", + "value": "true" + }, + { + "name": "otherLink", + "type": "uint16", + "value": "3" + }, + { + "name": "inputList", + "type": "string", + "value": "mgrMsgs (byteArray), auto_168_3 (byteArray)" + }, + { + "name": "outputList", + "type": "string", + "value": "mgrMsgs (byteArray), auto_8_2 (byteArray)" + } + ] + }, + { + "type": "comm/COBSerialUSB", + "name": "comm/COBSerialUSB_2", + "inputs": [ + { + "name": "data_1024", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "data_1024", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "1", + "inHunkInput": "0" + } + ] + } + ] + }, + { + "type": "link", + "name": "link_3", + "inputs": [ + { + "name": "data_1024", + "type": "byteArray" + }, + { + "name": "mgrMsgs_512", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "data_1024", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "4", + "inHunkInput": "0" + } + ] + }, + { + "name": "mgrMsgs_512", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "1", + "inHunkInput": "2" + } + ] + } + ], + "states": [ + { + "name": "isActive", + "type": "boolean", + "value": "true" + }, + { + "name": "otherLink", + "type": "uint16", + "value": "1" + }, + { + "name": "inputList", + "type": "string", + "value": "mgrMsgs (byteArray)" + }, + { + "name": "outputList", + "type": "string", + "value": "mgrMsgs (byteArray)" + } + ], + "contains": { + "interpreterName": "ponyo", + "interpreterVersion": "v0.1", + "hunks": [ + { + "type": "manager", + "name": "ponyo_one", + "inputs": [ + { + "name": "mgrMsgs_1024", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "mgrMsgs_1024", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "1", + "inHunkInput": "1" + } + ] + } + ] + }, + { + "type": "link", + "name": "link_1", + "inputs": [ + { + "name": "data_1024", + "type": "byteArray" + }, + { + "name": "mgrMsgs_1024", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "data_1024", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "2", + "inHunkInput": "0" + } + ] + }, + { + "name": "mgrMsgs_1024", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "0", + "inHunkInput": "0" + } + ] + } + ], + "states": [ + { + "name": "isActive", + "type": "boolean", + "value": "true" + }, + { + "name": "otherLink", + "type": "uint16", + "value": "3" + }, + { + "name": "inputList", + "type": "string", + "value": "mgrMsgs (byteArray)" + }, + { + "name": "outputList", + "type": "string", + "value": "mgrMsgs (byteArray)" + } + ] + }, + { + "type": "comm/COBSerialRJ45_A", + "name": "comm/COBSerialRJ45_A_2", + "inputs": [ + { + "name": "data_1024", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "data_1024", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "1", + "inHunkInput": "0" + } + ] + } + ] + } + ] + } + }, + { + "type": "comm/COBSerialRJ45_E", + "name": "comm/COBSerialRJ45_E_4", + "inputs": [ + { + "name": "data_1024", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "data_1024", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "3", + "inHunkInput": "0" + } + ] + } + ] + } + ] + } + }, + { + "type": "view", + "name": "view_4", + "inputs": [ + { + "name": "msgs", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "msgs", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "3", + "inHunkInput": "1" + } + ] + } + ] + }, + { + "type": "view", + "name": "view_5", + "inputs": [ + { + "name": "msgs", + "type": "byteArray" + } + ], + "outputs": [ + { + "name": "msgs", + "type": "byteArray", + "connections": [ + { + "inHunkIndex": "3", + "inHunkInput": "2" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/typeset.js b/typeset.js index 3fbc869f68fc462baf0b2cf6451cdb1b0871f8b4..c1c9201f3975819f024bffd85bf4ca243486e1b6 100644 --- a/typeset.js +++ b/typeset.js @@ -245,6 +245,9 @@ const TSET = [ uint32: function(uint8){ // this could really get exhaustive, return uint8 + }, + number: function(uint8){ + return uint8 } } }, { // uint8Array 39 @@ -284,6 +287,9 @@ const TSET = [ }, uint8: function(uint16){ return bounds(uint16, 0, 255) + }, + number: function(uint16){ + return uint16 } } }, { // uint16 array 41 @@ -328,6 +334,9 @@ const TSET = [ copy: { uint32: function(uint32){ return bounds(uint32, 0, 4294967295) + }, + number: function(uint32){ + return uint32 } } }, // uint32array 43, @@ -373,6 +382,9 @@ const TSET = [ copy: { int32: function(int32){ return bounds(int32, -2147483647, 2147483647) + }, + number: function(int32){ + return int32 } } },