mirror of
https://github.com/xodio/xod.git
synced 2026-03-25 01:56:54 +01:00
Merge pull request #1657 from xodio/refactor-1625-move-debug-nodes
Move debug nodes into new library
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
18
workspace/__lib__/xod/debug/console-log/patch.cpp
Normal file
18
workspace/__lib__/xod/debug/console-log/patch.cpp
Normal 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();
|
||||
}
|
||||
31
workspace/__lib__/xod/debug/console-log/patch.xodp
Normal file
31
workspace/__lib__/xod/debug/console-log/patch.xodp
Normal 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"
|
||||
}
|
||||
]
|
||||
}
|
||||
9
workspace/__lib__/xod/debug/project.xod
Normal file
9
workspace/__lib__/xod/debug/project.xod
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"authors": [
|
||||
"XOD"
|
||||
],
|
||||
"description": "Debug nodes for XOD",
|
||||
"license": "AGPL-3.0",
|
||||
"name": "core",
|
||||
"version": "0.27.0"
|
||||
}
|
||||
23
workspace/__lib__/xod/debug/watch/patch.cpp
Normal file
23
workspace/__lib__/xod/debug/watch/patch.cpp
Normal 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();
|
||||
}
|
||||
21
workspace/__lib__/xod/debug/watch/patch.xodp
Normal file
21
workspace/__lib__/xod/debug/watch/patch.xodp
Normal 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"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user