Skip to content

Commit

Permalink
Update andromeda
Browse files Browse the repository at this point in the history
  • Loading branch information
kylecorry31 committed Oct 14, 2023
1 parent 6f5d935 commit c297458
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ dependencies {
implementation("com.google.android.flexbox:flexbox:3.0.0")

// Andromeda
val andromedaVersion = "8b6af451fa"
val andromedaVersion = "8157ced68e"
implementation("com.github.kylecorry31.andromeda:core:$andromedaVersion")
implementation("com.github.kylecorry31.andromeda:fragments:$andromedaVersion")
implementation("com.github.kylecorry31.andromeda:forms:$andromedaVersion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.kylecorry.andromeda.location.IGPS
import com.kylecorry.sol.math.RingBuffer
import com.kylecorry.sol.math.SolMath.real
import com.kylecorry.sol.time.Time.isInPast
import com.kylecorry.sol.units.Bearing
import com.kylecorry.sol.units.Coordinate
import com.kylecorry.sol.units.Distance
import com.kylecorry.sol.units.DistanceUnits
Expand Down Expand Up @@ -38,6 +39,8 @@ class CustomGPS(

override val quality: Quality
get() = _quality
override val rawBearing: Float?
get() = _rawBearing

override val horizontalAccuracy: Float?
get() = _horizontalAccuracy
Expand All @@ -55,12 +58,18 @@ class CustomGPS(

override val speed: Speed
get() = _speed
override val speedAccuracy: Float?
get() = _speedAccuracy

override val time: Instant
get() = _time

override val altitude: Float
get() = _altitude
override val bearing: Bearing?
get() = _bearing
override val bearingAccuracy: Float?
get() = _bearingAccuracy

override val mslAltitude: Float?
get() = _mslAltitude
Expand Down Expand Up @@ -92,6 +101,10 @@ class CustomGPS(
private var _isTimedOut = false
private var mslOffset = 0f
private var geoidOffset = 0f
private var _rawBearing: Float? = null
private var _bearing: Bearing? = null
private var _bearingAccuracy: Float? = null
private var _speedAccuracy: Float? = null

private val locationHistory = RingBuffer<Pair<ApproximateCoordinate, Instant>>(10)

Expand Down Expand Up @@ -119,6 +132,11 @@ class CustomGPS(

_altitude = baseGPS.altitude - getGeoidOffset(_location)

_rawBearing = baseGPS.rawBearing
_bearing = baseGPS.bearing
_bearingAccuracy = baseGPS.bearingAccuracy
_speedAccuracy = baseGPS.speedAccuracy


updateSpeed()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Context
import com.kylecorry.andromeda.core.sensors.AbstractSensor
import com.kylecorry.andromeda.core.time.Timer
import com.kylecorry.andromeda.location.IGPS
import com.kylecorry.sol.units.Bearing
import com.kylecorry.sol.units.Coordinate
import com.kylecorry.sol.units.DistanceUnits
import com.kylecorry.sol.units.Speed
Expand All @@ -23,6 +24,8 @@ class CachedGPS(context: Context, private val updateFrequency: Long = 20L) : Abs
}
override val speed: Speed
get() = Speed(cache.getFloat(CustomGPS.LAST_SPEED) ?: 0.0f, DistanceUnits.Meters, TimeUnits.Seconds)
override val speedAccuracy: Float?
get() = null
override val time: Instant
get() = Instant.now()
override val verticalAccuracy: Float?
Expand All @@ -35,8 +38,14 @@ class CachedGPS(context: Context, private val updateFrequency: Long = 20L) : Abs
get() = true
override val altitude: Float
get() = cache.getFloat(CustomGPS.LAST_ALTITUDE) ?: userPrefs.altitudeOverride
override val bearing: Bearing?
get() = null
override val bearingAccuracy: Float?
get() = null
override val mslAltitude: Float
get() = altitude
override val rawBearing: Float?
get() = null

private val cache by lazy { PreferencesSubsystem.getInstance(context).preferences }
private val userPrefs by lazy { UserPreferences(context) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.kylecorry.trail_sense.shared.sensors.overrides

import android.content.Context
import com.kylecorry.andromeda.location.IGPS
import com.kylecorry.sol.units.Bearing
import com.kylecorry.sol.units.Coordinate
import com.kylecorry.sol.units.DistanceUnits
import com.kylecorry.sol.units.Speed
Expand All @@ -21,6 +22,8 @@ class OverrideGPS(context: Context, updateFrequency: Long = 20L) :
get() = userPrefs.locationOverride
override val speed: Speed
get() = Speed(0f, DistanceUnits.Meters, TimeUnits.Seconds)
override val speedAccuracy: Float?
get() = null
override val time: Instant
get() = Instant.now()
override val verticalAccuracy: Float?
Expand All @@ -33,6 +36,12 @@ class OverrideGPS(context: Context, updateFrequency: Long = 20L) :
get() = true
override val altitude: Float
get() = userPrefs.altitudeOverride
override val bearing: Bearing?
get() = null
override val bearingAccuracy: Float?
get() = null
override val mslAltitude: Float
get() = altitude
override val rawBearing: Float?
get() = null
}

0 comments on commit c297458

Please sign in to comment.