Refactor: drop ENABLE_NEW_UI legacy + sketch reorg + module headers - #32
Merged
Merged
Conversation
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
This was referenced May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First step on the path to 8/10. Structural refactor only — zero new tests, zero new features.
What changes
1. Sketch moves into
BirdsEye/subfolderFolder name now matches the
.inofilename, which is what Arduino IDE andarduino-cliexpect. The CI staging hack we added last week (mkdir sketch/BirdsEye; cp ...) goes away — both workflows point straight atBirdsEye/.2.
ENABLE_NEW_UIis deleted, along with everything it gatedThe auto-detect "Just Drive" flow has been the default for a while; the manual location → track → direction menu lived in
#elsebranches as fallback. Every change to either side cost double review attention. Gone:#ifdef ENABLE_NEW_UI/#else/#endifblocks across the codebaseDovesLapTimerglobal (CourseManagerowns its own timer)parseDoveLine,parseNmeaSentence,processReplayFile,extractGpsPointFromReplayFile,extractGpsPointFromTrackFile,detectTrackForReplayFile)selectedLocation/selectedTrack/selectedDirection,RACE_DIRECTION_FORWARD/REVERSE,crossingPointA/B,trackSelected,replayModeActive,ReplaySamplestructuse_legacy_csvsetting + the.dovefilename branch ingps_functions.ino(the legacy menu was the only way to set the prerequisites for.doveto fire — without it the setting was dead weight)Renamed:
newUiRaceActive→raceActive(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
.hheadersEach
.inomodule gets a matching.hdeclaring its public interface. Headers use#pragma onceand pull in any library types the signatures reference (<LSM6DS3.h>for accelerometer,SdFat.hfor replay,<SparkFun_u-blox_GNSS_v3.h>for gps_functions). Each.inoincludes its own header as the first include so any drift between declaration and definition is caught at compile time.Also moved the
SD_FAT_TYPEdefine +SdFat.hinclude to the top ofBirdsEye.ino(before module headers), soreplay.hsees the rightFiletypedef.PARSE_STATUS_*constants now use explicitexternmatching their header declarations.4. README + CLAUDE.md
Both purged of
ENABLE_NEW_UI/use_legacy_csvmentions, updated file maps for theBirdsEye/subfolder and the new.hfiles, 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)
move sketch sources into BirdsEye/ subfolder— puregit mvdrop CI staging hack now that sketch lives in BirdsEye/— workflow tweaksdrop ENABLE_NEW_UI legacy code path— the big one (-1,277 lines)add per-module .h headers documenting public interfacesupdate README and CLAUDE.md for new structureWhat's NOT in this PR
tests/host-doctest-harness). Kept separate so refactor can be reverted independently of test infrastructure..gitignore(PR Write comprehensive README documentation #5, [claude] Migrate SD library and add boot screen #6)SD_ACCESS_*are still#define-as-int rather thanenum class— deferred. Doable in a follow-up since none of the call sites change shape with the conversion.Verification
CI's
compile-sketchjob 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