Hide YAML traces behind DEBUG_YAML
This commit is contained in:
@@ -44,6 +44,7 @@ option(TEMPLATES "Model templates menu" OFF)
|
||||
option(TRACE_SIMPGMSPACE "Turn on traces in simpgmspace.cpp" ON)
|
||||
option(TRACE_LUA_INTERNALS "Turn on traces for Lua internals" OFF)
|
||||
option(DEBUG_WINDOWS "Turn on windows traces" OFF)
|
||||
option(DEBUG_YAML "Turn on YAML traces" OFF)
|
||||
option(FRSKY_STICKS "Reverse sticks for FrSky sticks" OFF)
|
||||
option(NANO "Use nano newlib and binalloc")
|
||||
option(TEST_BUILD_WARNING "Warn this is a test build" OFF)
|
||||
@@ -377,6 +378,10 @@ if(DEBUG_WINDOWS)
|
||||
add_definitions(-DDEBUG_WINDOWS)
|
||||
endif()
|
||||
|
||||
if(DEBUG_YAML)
|
||||
add_definitions(-DDEBUG_YAML)
|
||||
endif()
|
||||
|
||||
if(FRSKY_STICKS)
|
||||
add_definitions(-DFRSKY_STICKS)
|
||||
endif()
|
||||
|
||||
@@ -93,6 +93,12 @@ uint8_t aux2SerialTracesEnabled();
|
||||
#define TRACE_LUA_INTERNALS_WITH_LINEINFO(L, f_, ...)
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG_YAML)
|
||||
#define TRACE_YAML(f_, ...) TRACE(f_, ##__VA_ARGS__)
|
||||
#else
|
||||
#define TRACE_YAML(f_, ...)
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG) && !defined(SIMU)
|
||||
#define TIME_MEASURE_START(id) uint16_t t0 ## id = getTmr2MHz()
|
||||
#define TIME_MEASURE_STOP(id) TRACE("Measure(" # id ") = %.1fus", float((uint16_t)(getTmr2MHz() - t0 ## id))/2)
|
||||
|
||||
@@ -80,7 +80,7 @@ YamlParser::parse(const char* buffer, unsigned int size)
|
||||
if(s_len < MAX_STR) \
|
||||
s[s_len++] = c; \
|
||||
else { \
|
||||
TRACE("STRING_OVERFLOW"); \
|
||||
TRACE_YAML("STRING_OVERFLOW"); \
|
||||
return STRING_OVERFLOW; \
|
||||
} \
|
||||
}
|
||||
@@ -109,7 +109,7 @@ YamlParser::parse(const char* buffer, unsigned int size)
|
||||
// go up as many levels as necessary
|
||||
do {
|
||||
if (!toParent()) {
|
||||
TRACE("STOP (no parent)!\n");
|
||||
TRACE_YAML("STOP (no parent)!\n");
|
||||
return DONE_PARSING;
|
||||
}
|
||||
} while (indent < getLastIndent());
|
||||
@@ -123,7 +123,7 @@ YamlParser::parse(const char* buffer, unsigned int size)
|
||||
// go down one level
|
||||
else if (indent > getLastIndent()) {
|
||||
if (!toChild()) {
|
||||
TRACE("STOP (stack full)!\n");
|
||||
TRACE_YAML("STOP (stack full)!\n");
|
||||
return DONE_PARSING; // ERROR
|
||||
}
|
||||
}
|
||||
@@ -142,7 +142,7 @@ YamlParser::parse(const char* buffer, unsigned int size)
|
||||
if (*c == ' ') {// assumes nothing else comes after spaces start
|
||||
node_found = calls->find_node(ctx, scratch_buf, scratch_len);
|
||||
if (!node_found) {
|
||||
TRACE("YAML_PARSER: Could not find node '%.*s' (1)\n",
|
||||
TRACE_YAML("YAML_PARSER: Could not find node '%.*s' (1)\n",
|
||||
scratch_len, scratch_buf);
|
||||
}
|
||||
state = ps_AttrSP;
|
||||
@@ -156,7 +156,7 @@ YamlParser::parse(const char* buffer, unsigned int size)
|
||||
if (state == ps_Attr) {
|
||||
node_found = calls->find_node(ctx, scratch_buf, scratch_len);
|
||||
if (!node_found) {
|
||||
TRACE("YAML_PARSER: Could not find node '%.*s' (2)\n",
|
||||
TRACE_YAML("YAML_PARSER: Could not find node '%.*s' (2)\n",
|
||||
scratch_len, scratch_buf);
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,7 @@ YamlParser::parse(const char* buffer, unsigned int size)
|
||||
if (state == ps_Attr) {
|
||||
node_found = calls->find_node(ctx, scratch_buf, scratch_len);
|
||||
if (!node_found) {
|
||||
TRACE("YAML_PARSER: Could not find node '%.*s' (3)\n",
|
||||
TRACE_YAML("YAML_PARSER: Could not find node '%.*s' (3)\n",
|
||||
scratch_len, scratch_buf);
|
||||
}
|
||||
}
|
||||
@@ -210,12 +210,12 @@ YamlParser::parse(const char* buffer, unsigned int size)
|
||||
break;
|
||||
}
|
||||
//TODO: more escapes needed???
|
||||
TRACE("unknown escape char '%c'",*c);
|
||||
TRACE_YAML("unknown escape char '%c'",*c);
|
||||
return DONE_PARSING;
|
||||
|
||||
case ps_ValEsc2:
|
||||
if(scratch_len >= MAX_STR) {
|
||||
TRACE("STRING_OVERFLOW");
|
||||
TRACE_YAML("STRING_OVERFLOW");
|
||||
return STRING_OVERFLOW;
|
||||
}
|
||||
else if (*c >= '0' && *c <= '9') {
|
||||
@@ -228,7 +228,7 @@ YamlParser::parse(const char* buffer, unsigned int size)
|
||||
state = ps_ValEsc3;
|
||||
break;
|
||||
}
|
||||
TRACE("wrong hex digit '%c'",*c);
|
||||
TRACE_YAML("wrong hex digit '%c'",*c);
|
||||
return DONE_PARSING;
|
||||
|
||||
case ps_ValEsc3:
|
||||
@@ -242,7 +242,7 @@ YamlParser::parse(const char* buffer, unsigned int size)
|
||||
state = ps_ValQuo;
|
||||
break;
|
||||
}
|
||||
TRACE("wrong hex digit '%c'",*c);
|
||||
TRACE_YAML("wrong hex digit '%c'",*c);
|
||||
return DONE_PARSING;
|
||||
|
||||
case ps_Val:
|
||||
|
||||
@@ -358,7 +358,7 @@ bool YamlTreeWalker::isElmtEmpty(uint8_t* data)
|
||||
|
||||
bit_ofs = getLevelOfs();
|
||||
|
||||
TRACE("<not empty>");
|
||||
TRACE_YAML("<not empty>");
|
||||
return false;//node->u._array.u.select_member; //TODO!
|
||||
// // assume structs aligned on 8bit boundaries
|
||||
// && !node->_array.is_active(data + (bit_ofs >> 3));
|
||||
|
||||
Reference in New Issue
Block a user