Skip to content

Refactor: drop ENABLE_NEW_UI legacy + sketch reorg + module headers - #32

Merged
TheAngryRaven merged 5 commits into
masterfrom
refactor/drop-legacy-module-headers
May 21, 2026
Merged

Refactor: drop ENABLE_NEW_UI legacy + sketch reorg + module headers#32
TheAngryRaven merged 5 commits into
masterfrom
refactor/drop-legacy-module-headers

Conversation

@TheAngryRaven

Copy link
Copy Markdown
Owner

First step on the path to 8/10. Structural refactor only — zero new tests, zero new features.

What changes

1. Sketch moves into BirdsEye/ subfolder

Folder name now matches the .ino filename, which is what Arduino IDE and arduino-cli expect. The CI staging hack we added last week (mkdir sketch/BirdsEye; cp ...) goes away — both workflows point straight at BirdsEye/.

2. ENABLE_NEW_UI is deleted, along with everything it gated

The auto-detect "Just Drive" flow has been the default for a while; the manual location → track → direction menu lived in #else branches as fallback. Every change to either side cost double review attention. Gone:

  • All #ifdef ENABLE_NEW_UI / #else / #endif blocks across the codebase
  • Manual track/location/direction selection pages + handlers + display functions
  • The legacy DovesLapTimer global (CourseManager owns its own timer)
  • Legacy streaming replay (parseDoveLine, parseNmeaSentence, processReplayFile, extractGpsPointFromReplayFile, extractGpsPointFromTrackFile, detectTrackForReplayFile)
  • selectedLocation / selectedTrack / selectedDirection, RACE_DIRECTION_FORWARD/REVERSE, crossingPointA/B, trackSelected, replayModeActive, ReplaySample struct
  • use_legacy_csv setting + the .dove filename branch in gps_functions.ino (the legacy menu was the only way to set the prerequisites for .dove to fire — without it the setting was dead weight)
  • Page constants for the deleted screens

Renamed: newUiRaceActiveraceActive (no more "new" to disambiguate).

Net: -1,277 lines. Behaviorally identical for the actual code path that's been reaching the device.

3. Per-module .h headers

Each .ino module gets a matching .h declaring its public interface. Headers use #pragma once and pull in any library types the signatures reference (<LSM6DS3.h> for accelerometer, SdFat.h for replay, <SparkFun_u-blox_GNSS_v3.h> for gps_functions). Each .ino includes its own header as the first include so any drift between declaration and definition is caught at compile time.

Also moved the SD_FAT_TYPE define + SdFat.h include to the top of BirdsEye.ino (before module headers), so replay.h sees the right File typedef. PARSE_STATUS_* constants now use explicit extern matching their header declarations.

4. README + CLAUDE.md

Both purged of ENABLE_NEW_UI / use_legacy_csv mentions, updated file maps for the BirdsEye/ subfolder and the new .h files, fixed the DOVEX header size bug (README claimed "8 KB / byte 8192" — code has always been 1 KB / byte 1024).

Commit-by-commit (each compiles)

  1. move sketch sources into BirdsEye/ subfolder — pure git mv
  2. drop CI staging hack now that sketch lives in BirdsEye/ — workflow tweaks
  3. drop ENABLE_NEW_UI legacy code path — the big one (-1,277 lines)
  4. add per-module .h headers documenting public interfaces
  5. update README and CLAUDE.md for new structure

What's NOT in this PR

Verification

CI's compile-sketch job on XIAO nRF52840 Sense is the regression net — if the legacy removal broke anything reachable from the new-UI path, it'll fail there. Hardware-level verification (race session → DOVEX file → instant replay → BLE download → settings round-trip) is on you when convenient.

🤖 Generated with Claude Code


Generated by Claude Code

claude added 5 commits May 21, 2026 04:10
Arduino requires the sketch folder name to match the .ino filename.
The repo is DovesDataLogger but the sketch is BirdsEye.ino, so the
sketch now lives in BirdsEye/ — Arduino IDE will stop nagging about
the mismatch and CI no longer needs the staging hack.

Pure git mv, no content changes.
Both workflows can point straight at the BirdsEye/ subfolder for
compile and lint — no more mkdir + cp dance to fake the sketch
folder name.
Removes the compile-time toggle ENABLE_NEW_UI and deletes the legacy
menu-driven flow that lived behind it. The repo committed to the new
auto-detect UI a while ago — keeping both forms made every change
double-cost.

Gone:
- All #ifdef ENABLE_NEW_UI / #else / #endif blocks across every file
- Manual track/location/direction selection pages and their handlers
- The legacy DovesLapTimer global (CourseManager owns its own)
- Legacy streaming replay through parseDoveLine / parseNmeaSentence /
  processReplayFile (DOVEX instant replay is the only path now)
- selectedLocation/Track/Direction, RACE_DIRECTION_FORWARD/REVERSE,
  crossingPointA/B globals, trackSelected, replayModeActive
- use_legacy_csv setting and the .dove filename branch in
  gps_functions.ino (only the legacy menu could set the prerequisites)
- ReplaySample struct (only used by removed parsers)
- Page constants for the deleted screens

Renamed: newUiRaceActive -> raceActive (no more 'new' to disambiguate)

Net: -1,277 lines, no functional change for the active code path —
the new-UI flow is exactly what was reaching the device already.
Each .ino module gets a corresponding .h declaring its public
surface. Headers use #pragma once and pull in any library types
referenced in signatures (LSM6DS3.h for accelerometer, SdFat.h for
replay, SparkFun GNSS for gps_functions, ButtonState from project.h
for display_ui).

The .ino files include their own headers as the first include so
any drift between declaration and definition is caught at compile
time.

In BirdsEye.ino, the SdFat configuration (SD_FAT_TYPE / PIN_SPI_CS /
SPI_SPEED + SdFat.h include) moves to the top of the file so the
type is defined before any module header that references the File
type. PARSE_STATUS_* constants get explicit extern matching their
header declarations.

These headers don't strictly change what Arduino's .ino-concat build
sees, but they make the module boundaries explicit and unblock the
host-side unit-test harness in the next PR.
- Sketch lives in BirdsEye/ subfolder; file tree updated to match
- ENABLE_NEW_UI and use_legacy_csv references removed everywhere
- DOVEX header size corrected from '8 KB / byte 8192' to '1 KB /
  byte 1024' (the code has always been 1024; the README was wrong)
- File map updated for per-module .h headers
- 'Legacy mode' Startup Sequence section removed
- Development Conventions in CLAUDE.md documents the new
  .ino + .h pairing
@TheAngryRaven
TheAngryRaven merged commit 9bc4208 into master May 21, 2026
2 checks passed
@TheAngryRaven
TheAngryRaven deleted the refactor/drop-legacy-module-headers branch May 21, 2026 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants