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