Say where the log is in the guides an operator actually reads

This commit is contained in:
pgdalmeida 2026-09-22 18:18:54 +02:00
parent 582047d3a2
commit fd1df9e93a
Signed by: pedro.almeida
GPG Key ID: D4A6C394DF13F1D7
2 changed files with 62 additions and 0 deletions

View File

@ -276,6 +276,50 @@ If `CMakeLists.txt` or options changed, re-run the `cmake -B build ...` configur
[section 2](#2-build-full-with-cameras--mqtt) first. To roll back, keep the previous binary [section 2](#2-build-full-with-cameras--mqtt) first. To roll back, keep the previous binary
(`fire_gimbal_control.prev`) and swap it back. (`fire_gimbal_control.prev`) and swap it back.
## 10. Where the log is
The program writes a persistent log alongside the self-test and diagnostics
reports:
```
~/.local/share/fire_gimbal_control/logs/fgc_<YYYYMMDD-HHMMSS>.<NNN>.log
```
One file per run, rotated by size within a run (`.000`, `.001`, …), oldest pruned
by count. Bounded at `[Logging] file_keep x file_max_mb`, 200 MB by default, at
roughly 5 MB/day in steady state.
This exists because a tower runs detached and, in TUI mode, every line otherwise
goes to a 500-line on-screen ring buffer that dies with the tmux session. The
file is **more verbose than the dashboard** — `info` on screen, `debug` on disk —
so it holds detail the pane never showed.
```bash
ls -t ~/.local/share/fire_gimbal_control/logs/fgc_*.log | head
tail -F "$(ls -t ~/.local/share/fire_gimbal_control/logs/fgc_*.log | head -1)"
```
Use `tail -F`, not `-f`: rotation replaces the file and `-f` would follow the old
inode into a file nothing writes to any more.
Each file opens with a header naming the build, tower, PID, config and hardware
paths and the full command line — repeated after every rotation, so an archive
found on its own still says where it came from. Lines carry a `YYYY-MM-DD` prefix
the console ones do not.
What to grep when a tower will not come up:
```bash
L=$(ls -t ~/.local/share/fire_gimbal_control/logs/fgc_*.log | head -1)
grep -E "hardware:|NEED|firmware config|need config" "$L" # declaration + handshake
grep -E "\[WARN |\[ERROR" "$L" # everything it complained about
head -8 "$L" # which build, which config
```
> Wire traces (`[Logging] trace` / `--trace`) reach this file too. The serial
> trace alone takes it from ~5 MB/day to ~41 MB/day, enough to age out the
> startup record within days — turn it on to chase something, off afterwards.
## Troubleshooting ## Troubleshooting
| Symptom | Check | | Symptom | Check |

View File

@ -867,6 +867,24 @@ Check against the recorded figures: travel ~1,210,778 counts, repeatable to
more than a few percent means the axis homed against something that was not the more than a few percent means the axis homed against something that was not the
endstop. endstop.
### Reading the log afterwards
Everything below is recorded to
`~/.local/share/fire_gimbal_control/logs/fgc_*.log`, not only to the dashboard —
which matters here, because in TUI mode the pane holds 500 lines and dies with
the tmux session. During this bring-up that cost us the handshake record four
separate times before the file existed.
```bash
L=$(ls -t ~/.local/share/fire_gimbal_control/logs/fgc_*.log | head -1)
grep -E "NEED|firmware config|need config" "$L" # step 4: did the handshake complete
grep -E "hardware:" "$L" # presence reconciliation
grep -E "speed:|motor current" "$L" # what was actually sent to the firmware
```
The file is more verbose than the dashboard was, so it holds lines the pane never
showed. `head -8` gives the build, tower and config that produced it.
### If it goes wrong ### If it goes wrong
The board is recoverable over the network as long as USB CDC comes up: The board is recoverable over the network as long as USB CDC comes up: