From e5609ce2e21357491942dd3f4bd260f53290570d Mon Sep 17 00:00:00 2001 From: Steve Gilberd Date: Sun, 26 Oct 2025 19:12:10 +1300 Subject: [PATCH] Add routing stats module --- meshtastic/config.proto | 5 +++ meshtastic/mesh.proto | 88 +++++++++++++++++++++++++++++++++++++++ meshtastic/portnums.proto | 5 +++ 3 files changed, 98 insertions(+) diff --git a/meshtastic/config.proto b/meshtastic/config.proto index 4d352c1d..295af0b9 100644 --- a/meshtastic/config.proto +++ b/meshtastic/config.proto @@ -262,6 +262,11 @@ message Config { * Defaults to ENABLED */ BuzzerMode buzzer_mode = 13; + + /* + * How often to broadcast routing stats packets (0 to disable) + */ + uint32 routing_stats_broadcast_secs = 14; } /* diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index 2660ae56..ea863727 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -2412,3 +2412,91 @@ message ChunkedPayloadResponse { resend_chunks resend_chunks = 4; } } + +message RoutingStats { + /* + * Number of seconds these stats cover + */ + uint32 window_secs = 1; + + /* + * Current channel util (0-100) + */ + uint32 channel_util_pct = 2; + + /* + * Current TX duty (0-100) + */ + uint32 tx_duty_pct = 3; + + /* + * Total number of packets transmitted + */ + uint32 tx_total = 4; + + /* + * Total transmission time in milliseconds + */ + uint32 tx_total_ms = 5; + + /* + * Number of packets we originated + */ + uint32 tx_mine = 6; + + /* + * Number of zero-hop packets we originated + */ + uint32 tx_zero = 7; + + /* + * Number of transmitted packets that we didn't originate + */ + uint32 tx_relayed = 8; + + /* + * Number of packets dropped from the TX queue without being sent + */ + uint32 tx_dropped = 9; + + /* + * Number of packets deferred to the late contention window + */ + uint32 tx_deferred = 10; + + /* + * Maximum number of packets in the TX queue + */ + uint32 tx_hwm = 11; + + /* + * Total number of packets received + */ + uint32 rx_total = 12; + + /* + * Total receive time in milliseconds + */ + uint32 rx_total_ms = 13; + + /* + * Number of packets we failed to successfully receive + */ + uint32 rx_bad = 14; + + /* + * Number of packets we received directly from the original sender (excludes zero-hop) + */ + uint32 rx_direct = 15; + + /* + * Number of packets we received that were sent zero-hop + */ + uint32 rx_zero = 16; + + /* + * Number of packets we received with hop_limit=0 (excludes zero-hop) + */ + uint32 rx_eol = 17; + +} \ No newline at end of file diff --git a/meshtastic/portnums.proto b/meshtastic/portnums.proto index 24f0b16d..a6b63945 100644 --- a/meshtastic/portnums.proto +++ b/meshtastic/portnums.proto @@ -134,6 +134,11 @@ enum PortNum { */ PAXCOUNTER_APP = 34; + /* + * Routing statistics + */ + ROUTING_STATS_APP = 35; + /* * Provides a hardware serial interface to send and receive from the Meshtastic network. * Connect to the RX/TX pins of a device with 38400 8N1. Packets received from the Meshtastic