feat(workspace): add table-log node

This commit is contained in:
Kirill Shumilov
2021-01-19 20:47:02 +03:00
parent 765cd4eca0
commit f370d3fb9d
2 changed files with 79 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
node {
void printPrefix(Context ctx) {
TimeMs tNow = transactionTime();
XOD_DEBUG_SERIAL.print(F("+XOD:"));
XOD_DEBUG_SERIAL.print(tNow);
XOD_DEBUG_SERIAL.print(':');
XOD_DEBUG_SERIAL.print(getNodeId(ctx));
XOD_DEBUG_SERIAL.print(':');
}
void printEOL() {
XOD_DEBUG_SERIAL.print('\r');
XOD_DEBUG_SERIAL.print('\n');
XOD_DEBUG_SERIAL.flush();
}
void evaluate(Context ctx) {
if (isInputDirty<input_PUSH>(ctx)) {
printPrefix(ctx);
auto data = getValue<input_IN>(ctx);
for (auto it = data.iterate(); it; ++it)
XOD_DEBUG_SERIAL.print((char)*it);
printEOL();
}
if (isInputDirty<input_NEW>(ctx)) {
printPrefix(ctx);
// Page break character -> new page
XOD_DEBUG_SERIAL.print((char)0xC);
printEOL();
}
}
}

View File

@@ -0,0 +1,49 @@
{
"description": "Collects values as table rows and tables as sheets. Useful to conduct measurement sessions and then analyze the data gathered in spreadsheet software.",
"nodes": [
{
"id": "B1iYZOzoZ",
"position": {
"units": "slots",
"x": 1,
"y": 1
},
"type": "xod/patch-nodes/not-implemented-in-xod"
},
{
"description": "Adds values to the latest sheet.",
"id": "rkWILuNyu",
"label": "PUSH",
"position": {
"units": "slots",
"x": 3,
"y": 0
},
"type": "xod/patch-nodes/input-pulse"
},
{
"boundLiterals": {
"__out__": "Never"
},
"description": "Creates a new sheet.",
"id": "B1RI8OEyO",
"label": "NEW",
"position": {
"units": "slots",
"x": 1,
"y": 0
},
"type": "xod/patch-nodes/input-pulse"
},
{
"description": "Values to add as a new table row. All values should be separated with tab character `\\t`.",
"id": "rkvDUOV1O",
"position": {
"units": "slots",
"x": 5,
"y": 0
},
"type": "xod/patch-nodes/input-string"
}
]
}