Modernize PiBall: universal Flutter app (iOS/Android/web) + wind-math fixes - #1
Merged
Conversation
Ground-up port of the 2014 Android/Java pibal theodolite to Flutter with a Material 3 UI. The original Java app is preserved under legacy-android/. Orientation (azimuth/elevation) is computed in Dart, mirroring Android's getRotationMatrix/getOrientation, so it behaves the same on iOS. Fixes the wind-math bugs from the original: - ascent rate is now configurable (was hard-coded 300 ft/min) - heading uses atan2 instead of atan (all four quadrants) - reports meteorological "wind from" (+180, previously commented out) - magnetic declination correction (true north) - the dead Settings menu item is now a real, persisted settings screen Verified: flutter analyze clean, 7/7 unit tests pass (wind + orientation math), web and iOS (no-codesign) targets build. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Keep the screen awake while recording (wakelock_plus), released on stop and dispose. - "Use my location" in Settings fetches a GPS fix (geolocator) and computes magnetic declination from the bundled World Magnetic Model (geomag, WMM-2025). Pure Dart, so it works on iOS/Android/web; manual entry still available. - iOS NSLocationWhenInUseUsageDescription + Android ACCESS_*_LOCATION perms. Note: the magnetic_declination plugin was evaluated first but ships a broken iOS Swift source that fails the Apple build, so geomag (pure Dart) is used. Verified: analyze clean, 9/9 tests pass, web + iOS (no-codesign) build. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Correctness: - Circular (sin/cos) azimuth smoothing — fixes wrong averaging across the 0/360 deg wrap near magnetic north. - Flag low-elevation (<6 deg) layers as unreliable instead of emitting bogus speeds; clamp tan() so shallow sightings can't yield infinite range. - Compass interference/calibration warning from magnetic field magnitude. Field workflow: - Manual "Capture" during a run; delete/re-take a sighting (recomputes). - Optional spoken "3-2-1-mark" countdown (flutter_tts), haptics retained. - Keep-screen-awake error-safe; re-asserts on app resume. Output: - Save every profile to History (with GPS + timestamp); review + share as CSV (share_plus). Wind-profile chart (speed vs altitude with wind-from arrows), toggleable against the table. - Units toggle: knots/feet or m/s/metres, applied across UI + export. Other: - Optional camera Aim screen with crosshair + live AZ/EL overlay. - App icon + proper "PiBall" display name on iOS/Android/web. - Widget test for the Start/Stop/Calculate state machine; units tests. - GitHub Actions CI (analyze + test). Verified: flutter analyze clean, 18 tests pass, web + iOS (no-codesign) build. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Ground-up rewrite of the 2014 Android/Java pibal theodolite as a Flutter app that runs on iOS, Android, and web from one codebase, with a Material 3 UI. The original Java app is preserved under
legacy-android/.What's new
getRotationMatrix/getOrientation, so iOS behaves the same.wakelock_plus).geolocator) + the bundled World Magnetic Model (geomag, WMM-2025, pure Dart).Wind-math fixes (vs. the original)
atan(two quadrants)atan2(all four)+180°conventionNotes
magnetic_declinationnative plugin was tried first but ships a broken iOS Swift source that fails the Apple build; replaced with the pure-Dartgeomag.Verification
flutter analyze— cleanflutter test— 9/9 pass (wind + orientation + declination math)flutter build web— builtflutter build ios --no-codesign— builtRunner.app🤖 Generated with Claude Code