mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-12 15:41:24 +00:00
Merge pull request #4669 from GUVWAF/trFix
This commit is contained in:
commit
f1602ee3f6
@ -53,7 +53,7 @@ void TraceRouteModule::insertUnknownHops(meshtastic_MeshPacket &p, meshtastic_Ro
|
|||||||
uint8_t hopsTaken = p.hop_start - p.hop_limit;
|
uint8_t hopsTaken = p.hop_start - p.hop_limit;
|
||||||
int8_t diff = hopsTaken - *route_count;
|
int8_t diff = hopsTaken - *route_count;
|
||||||
for (uint8_t i = 0; i < diff; i++) {
|
for (uint8_t i = 0; i < diff; i++) {
|
||||||
if (*route_count < sizeof(*route) / sizeof(route[0])) {
|
if (*route_count < ROUTE_SIZE) {
|
||||||
route[*route_count] = NODENUM_BROADCAST; // This will represent an unknown hop
|
route[*route_count] = NODENUM_BROADCAST; // This will represent an unknown hop
|
||||||
*route_count += 1;
|
*route_count += 1;
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ void TraceRouteModule::insertUnknownHops(meshtastic_MeshPacket &p, meshtastic_Ro
|
|||||||
// Add unknown SNR values if necessary
|
// Add unknown SNR values if necessary
|
||||||
diff = *route_count - *snr_count;
|
diff = *route_count - *snr_count;
|
||||||
for (uint8_t i = 0; i < diff; i++) {
|
for (uint8_t i = 0; i < diff; i++) {
|
||||||
if (*snr_count < sizeof(*snr_list) / sizeof(snr_list[0])) {
|
if (*snr_count < ROUTE_SIZE) {
|
||||||
snr_list[*snr_count] = INT8_MIN; // This will represent an unknown SNR
|
snr_list[*snr_count] = INT8_MIN; // This will represent an unknown SNR
|
||||||
*snr_count += 1;
|
*snr_count += 1;
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ void TraceRouteModule::appendMyIDandSNR(meshtastic_RouteDiscovery *updated, floa
|
|||||||
snr_list = updated->snr_back;
|
snr_list = updated->snr_back;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*snr_count < sizeof(*snr_list) / sizeof(snr_list[0])) {
|
if (*snr_count < ROUTE_SIZE) {
|
||||||
snr_list[*snr_count] = (int8_t)(snr * 4); // Convert SNR to 1 byte
|
snr_list[*snr_count] = (int8_t)(snr * 4); // Convert SNR to 1 byte
|
||||||
*snr_count += 1;
|
*snr_count += 1;
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ void TraceRouteModule::appendMyIDandSNR(meshtastic_RouteDiscovery *updated, floa
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Length of route array can normally not be exceeded due to the max. hop_limit of 7
|
// Length of route array can normally not be exceeded due to the max. hop_limit of 7
|
||||||
if (*route_count < sizeof(*route) / sizeof(route[0])) {
|
if (*route_count < ROUTE_SIZE) {
|
||||||
route[*route_count] = myNodeInfo.my_node_num;
|
route[*route_count] = myNodeInfo.my_node_num;
|
||||||
*route_count += 1;
|
*route_count += 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "ProtobufModule.h"
|
#include "ProtobufModule.h"
|
||||||
|
|
||||||
|
#define ROUTE_SIZE sizeof(((meshtastic_RouteDiscovery *)0)->route) / sizeof(((meshtastic_RouteDiscovery *)0)->route[0])
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A module that traces the route to a certain destination node
|
* A module that traces the route to a certain destination node
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user