mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-17 08:12:32 +00:00
remove newline from logging statements. (#5022)
remove newline from logging statements in code. The LOG_* functions will now magically add it at the end. --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "TraceRouteModule.h"
|
||||
#include "MeshService.h"
|
||||
#include "meshUtils.h"
|
||||
|
||||
TraceRouteModule *traceRouteModule;
|
||||
|
||||
@@ -101,45 +102,47 @@ void TraceRouteModule::appendMyIDandSNR(meshtastic_RouteDiscovery *updated, floa
|
||||
route[*route_count] = myNodeInfo.my_node_num;
|
||||
*route_count += 1;
|
||||
} else {
|
||||
LOG_WARN("Route exceeded maximum hop limit!\n"); // Are you bridging networks?
|
||||
LOG_WARN("Route exceeded maximum hop limit!"); // Are you bridging networks?
|
||||
}
|
||||
}
|
||||
|
||||
void TraceRouteModule::printRoute(meshtastic_RouteDiscovery *r, uint32_t origin, uint32_t dest, bool isTowardsDestination)
|
||||
{
|
||||
#ifdef DEBUG_PORT
|
||||
LOG_INFO("Route traced:\n");
|
||||
LOG_INFO("0x%x --> ", origin);
|
||||
std::string route = "Route traced:";
|
||||
route += vformat("0x%x --> ", origin);
|
||||
for (uint8_t i = 0; i < r->route_count; i++) {
|
||||
if (i < r->snr_towards_count && r->snr_towards[i] != INT8_MIN)
|
||||
LOG_INFO("0x%x (%.2fdB) --> ", r->route[i], (float)r->snr_towards[i] / 4);
|
||||
route += vformat("0x%x (%.2fdB) --> ", r->route[i], (float)r->snr_towards[i] / 4);
|
||||
else
|
||||
LOG_INFO("0x%x (?dB) --> ", r->route[i]);
|
||||
route += vformat("0x%x (?dB) --> ", r->route[i]);
|
||||
}
|
||||
// If we are the destination, or it has already reached the destination, print it
|
||||
if (dest == nodeDB->getNodeNum() || !isTowardsDestination) {
|
||||
if (r->snr_towards_count > 0 && r->snr_towards[r->snr_towards_count - 1] != INT8_MIN)
|
||||
LOG_INFO("0x%x (%.2fdB)\n", dest, (float)r->snr_towards[r->snr_towards_count - 1] / 4);
|
||||
route += vformat("0x%x (%.2fdB)", dest, (float)r->snr_towards[r->snr_towards_count - 1] / 4);
|
||||
|
||||
else
|
||||
LOG_INFO("0x%x (?dB)\n", dest);
|
||||
route += vformat("0x%x (?dB)", dest);
|
||||
} else
|
||||
LOG_INFO("...\n");
|
||||
route += "...";
|
||||
|
||||
// If there's a route back (or we are the destination as then the route is complete), print it
|
||||
if (r->route_back_count > 0 || origin == nodeDB->getNodeNum()) {
|
||||
if (r->snr_towards_count > 0 && origin == nodeDB->getNodeNum())
|
||||
LOG_INFO("(%.2fdB) 0x%x <-- ", (float)r->snr_back[r->snr_back_count - 1] / 4, origin);
|
||||
route += vformat("(%.2fdB) 0x%x <-- ", (float)r->snr_back[r->snr_back_count - 1] / 4, origin);
|
||||
else
|
||||
LOG_INFO("...");
|
||||
route += "...";
|
||||
|
||||
for (int8_t i = r->route_back_count - 1; i >= 0; i--) {
|
||||
if (i < r->snr_back_count && r->snr_back[i] != INT8_MIN)
|
||||
LOG_INFO("(%.2fdB) 0x%x <-- ", (float)r->snr_back[i] / 4, r->route_back[i]);
|
||||
route += vformat("(%.2fdB) 0x%x <-- ", (float)r->snr_back[i] / 4, r->route_back[i]);
|
||||
else
|
||||
LOG_INFO("(?dB) 0x%x <-- ", r->route_back[i]);
|
||||
route += vformat("(?dB) 0x%x <-- ", r->route_back[i]);
|
||||
}
|
||||
LOG_INFO("0x%x\n", dest);
|
||||
route += vformat("0x%x", dest);
|
||||
}
|
||||
LOG_INFO(route.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user