-
Notifications
You must be signed in to change notification settings - Fork 52
15. Logging and Debugging
Language: English. Chinese version: 15. Logging and Debugging (中文)
Many Trail Mate problems are hard to diagnose without logs. In a system that combines multiple hardware targets, multiple protocol roles, offline maps, and Team behavior, a single screenshot usually shows only what the failure looks like, not where it actually occurs.
This page focuses on the practical logging and debugging entry points that already matter today, rather than trying to copy every print statement in the repository.
Logs are more important than screenshots when:
- the device boots but wireless behavior is wrong
- a target reboots abnormally after flashing
- GPS initialization fails or GPS behavior is inconsistent
- SD initialization fails
- one feature disappears only on a specific hardware target
- Team, HostLink, or protocol-switch behavior does not make sense
The PlatformIO path already includes several _debug environments, for example:
platformio run -e tlora_pager_sx1262_debug
platformio run -e tlora_pager_sx1280_debug
platformio run -e tdeck_debug
platformio run -e lilygo_twatch_s3_debugThese currently enable additional macros such as:
MESHCORE_LOG_ENABLELORA_LOG_ENABLEAPP_EVENT_LOG_ENABLE
That makes them especially useful for protocol, radio, and event-flow diagnosis.
GPS_LOG_ENABLE is not enabled by default in the current setup. In other words, the standard _debug environments mainly help with protocol and radio paths. They do not automatically guarantee the deepest GPS loop logs.
If you need detailed GPS parsing or time-sync traces, you may need to add or adjust the relevant logging macros for the target rather than assuming they are already present.
The most direct route is:
platformio device monitorYou can also use any serial monitor you normally prefer after uploading.
The standard route looks like:
idf.py -B build.tab5 -DTRAIL_MATE_IDF_TARGET=tab5 monitorFor Tab5, the repository already notes that flash and monitor are better run separately.
These lines usually come from the startup shell and indicate broad startup progress such as system init, board init, AppContext binding, and shell assembly.
Different boards produce their own prefixes, for example:
[TDeckBoard][TLoRaPagerBoard::begin][TWatchS3Board]
These are good for confirming whether:
- display init succeeded
- radio init succeeded
- SD, GPS, keyboard, or touch setup completed
These lines usually relate to Team service assembly, Team key restoration, or Team routing behavior. When Team functionality is missing or wrong, these logs often reveal whether the issue is in the runtime assembly layer rather than in the visible UI.
The GAT562 route uses more detailed prefixes, including:
[gat562][cfg][gat562][settings][gat562][gps][gat562][mt]
These help separate configuration normalization, settings persistence, GPS runtime, and Meshtastic send or receive behavior.
This tag is used for current IDF screen-sleep logging. It is useful on large-screen targets where the symptom may be “touch seems dead” when the real behavior is simply “the screen was waking first”.
If the device is wrong from boot, look for the earliest abnormal line rather than only copying the last few lines. Current code already produces strong hints such as:
radio init failedGPS init: FAILSD init faileddisplay init failed
These are much closer to root cause than “the page never appeared”.
For protocol changes, region changes, or MeshCore preset application, configuration-normalization and apply-stage logs are especially valuable. The GAT562 [cfg] prefix is a good example of where those clues appear.
If the symptom is “can receive but cannot send” or “packet arrives but does not appear on screen”, preserve:
- protocol logs around transmit attempts
- decode-failure or de-duplication logs
- errors associated with Team-related app-data handling
Debugging should not be reduced to serial output alone. Inside the wider system, Trail Mate Center can also help you:
- inspect HostLink output
- inspect raw frames
- inspect event streams
- export messages and events
If the problem involves more than one node, the desktop tool can be more informative than a single handheld log.
A high-quality issue should include at least:
- device model and radio variant
- build target, such as
tdeckortlora_pager_sx1262 - active protocol: Meshtastic, MeshCore, or Reticulum; for Reticulum, include whether the configuration source is SD, Cached, or Defaults
- whether settings such as region, preset, channel, PSK, or
BW / SF / CR / TX Power / Override Freqwere changed - Reticulum configuration source, status message, and a redacted
/trailmate/reticulum/config.json - whether SD and offline maps were involved
- the key log fragment, especially the earliest abnormal part
- whether the issue reproduces reliably and how
Something like this is helpful:
[TDeckBoard] radio init failed: ...
[Setup] AppContext initialized handles=...
[gat562][cfg] applyMesh start proto=...
A fragment like this is not:
it stopped working
Trail Mate issues often cross board, configuration, protocol, and UI boundaries. The log needs enough context to show where in the stack things started to diverge.
The current logging system is already good enough for most mainline troubleshooting, but it is not perfectly uniform:
- some
_debugenvironments cover protocol logging more heavily than others - deep GPS logging is not always enabled by default
- different boards and platforms still expose different log granularity
That is not ideal, but it is already enough to support the current troubleshooting workflow documented here.
Good future additions include:
- a fuller prefix index
- differences in log collection between PlatformIO, ESP-IDF, and nRF52 paths
- dedicated Team, HostLink, map, and GPS logging notes
For now, the goal is to keep the practical parts clear: how to enable logs, how to recognize prefixes, and what maintainers need to see in an issue.
English
- Home
- 0. Why This Exists
- 1. Quick Start
- 2. Supported Hardware
- 3. Installation & Flashing
- 3.5 Configuration Guide
- 4. Protocols & Data
- 4.1 Reticulum, LXMF and RNode Bridge
- 5. Offline Maps
- 6. Trail Mate Center
- 7. Team Features
- 8. UI Overview
- 9. Build from Source
- 10. Codebase Overview
- 11. Architecture
- 12. Design Decisions
- 13. FAQ
- 14. Troubleshooting
- 15. Logging and Debugging
- 16. Roadmap
- 17. Contributing
- 18. License and Third-Party
- 19. GPS Setting Guide
中文
- Home (中文)
- 0. Why This Exists (中文)
- 1. Quick Start (中文)
- 2. Supported Hardware (中文)
- 3. Installation & Flashing (中文)
- 3.5 Configuration Guide (中文)
- 4. Protocols & Data (中文)
- 4.1 Reticulum, LXMF and RNode Bridge (中文)
- 5. Offline Maps (中文)
- 6. Trail Mate Center (中文)
- 7. Team Features (中文)
- 8. UI Overview (中文)
- 9. Build from Source (中文)
- 10. Codebase Overview (中文)
- 11. Architecture (中文)
- 12. Design Decisions (中文)
- 13. FAQ (中文)
- 14. Troubleshooting (中文)
- 15. Logging and Debugging (中文)
- 16. Roadmap (中文)
- 17. Contributing (中文)
- 18. License and Third-Party (中文)