Merge pull request #1657 from xodio/refactor-1625-move-debug-nodes

Move debug nodes into new library
This commit is contained in:
Kirill Shumilov
2019-02-01 18:18:38 +03:00
committed by GitHub
9 changed files with 127 additions and 2 deletions

View File

@@ -109,7 +109,12 @@ export const PULSE_CONST_NODETYPES = {
// to debug xod programm, it should be omitted
// from Project before transpilation without
// turned on debug mode
export const DEBUG_NODETYPES = ['xod/core/watch', 'xod/core/console-log'];
export const DEBUG_NODETYPES = [
'xod/core/watch',
'xod/core/console-log',
'xod/debug/watch',
'xod/debug/console-log',
];
/**
* Enumeration of possible pin directions

View File

@@ -118,7 +118,7 @@ export const terminalPatchPathRegExp = new RegExp(
export const isTerminalPatchPath = R.test(terminalPatchPathRegExp);
// :: String -> Boolean
export const isWatchPatchPath = R.test(/^xod\/core\/watch$/);
export const isWatchPatchPath = R.test(/^xod\/(core|debug)\/watch$/);
// :: String -> Boolean
export const isBusPatchPath = R.either(

View File

@@ -1,6 +1,15 @@
{
"description": "Outputs a line of text to the board standard debug interface",
"nodes": [
{
"description": "Use `xod/debug/console-log` instead",
"id": "HJH0G0b44",
"position": {
"x": 170,
"y": 102
},
"type": "xod/patch-nodes/deprecated"
},
{
"id": "HJdO9HwJ-",
"label": "LINE",

View File

@@ -16,6 +16,15 @@
"y": 0
},
"type": "xod/patch-nodes/input-string"
},
{
"description": "Use `xod/debug/watch` instead",
"id": "Sy5lXAWNN",
"position": {
"x": 102,
"y": 102
},
"type": "xod/patch-nodes/deprecated"
}
]
}

View File

@@ -0,0 +1,18 @@
struct State { };
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
if (!isInputDirty<input_DUMP>(ctx))
return;
auto line = getValue<input_LINE>(ctx);
for (auto it = line->iterate(); it; ++it)
XOD_DEBUG_SERIAL.write((char)*it);
XOD_DEBUG_SERIAL.write('\r');
XOD_DEBUG_SERIAL.write('\n');
XOD_DEBUG_SERIAL.flush();
}

View File

@@ -0,0 +1,31 @@
{
"description": "Outputs a line of text to the board standard debug interface",
"nodes": [
{
"id": "HJdO9HwJ-",
"label": "LINE",
"position": {
"x": 10,
"y": 16
},
"type": "xod/patch-nodes/input-string"
},
{
"id": "S1n95SDJb",
"label": "DUMP",
"position": {
"x": 138,
"y": 16
},
"type": "xod/patch-nodes/input-pulse"
},
{
"id": "noNativeImpl",
"position": {
"x": 100,
"y": 100
},
"type": "xod/patch-nodes/not-implemented-in-xod"
}
]
}

View File

@@ -0,0 +1,9 @@
{
"authors": [
"XOD"
],
"description": "Debug nodes for XOD",
"license": "AGPL-3.0",
"name": "core",
"version": "0.27.0"
}

View File

@@ -0,0 +1,23 @@
struct State {
};
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
if (!isInputDirty<input_IN>(ctx))
return;
auto line = getValue<input_IN>(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(':');
for (auto it = line.iterate(); it; ++it)
XOD_DEBUG_SERIAL.print((char)*it);
XOD_DEBUG_SERIAL.print('\r');
XOD_DEBUG_SERIAL.print('\n');
XOD_DEBUG_SERIAL.flush();
}

View File

@@ -0,0 +1,21 @@
{
"description": "Shows incoming values in the realtime, when a debug session is active",
"nodes": [
{
"id": "B1iYZOzoZ",
"position": {
"x": 34,
"y": 102
},
"type": "xod/patch-nodes/not-implemented-in-xod"
},
{
"id": "HkXK-dGob",
"position": {
"x": 34,
"y": 0
},
"type": "xod/patch-nodes/input-string"
}
]
}