diff --git a/docs/deployment.md b/docs/deployment.md index b98c69f..e1b69aa 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -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 (`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_..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 | Symptom | Check | diff --git a/docs/tower-installation.md b/docs/tower-installation.md index bbc5400..56d3d7e 100644 --- a/docs/tower-installation.md +++ b/docs/tower-installation.md @@ -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 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 The board is recoverable over the network as long as USB CDC comes up: