mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
Add number of GPS satellites in view to DB for later display (#883)
* Add a couple more fields to position Use auto migration over manula migration
This commit is contained in:
parent
52d4c70d7c
commit
4f9011fe57
3 changed files with 443 additions and 7 deletions
|
|
@ -67,8 +67,13 @@ data class Position(
|
|||
val latitude: Double,
|
||||
val longitude: Double,
|
||||
val altitude: Int,
|
||||
val time: Int = currentTime() // default to current time in secs (NOT MILLISECONDS!)
|
||||
val time: Int = currentTime(), // default to current time in secs (NOT MILLISECONDS!)
|
||||
val satellitesInView: Int = 0,
|
||||
val groundSpeed: Int = 0,
|
||||
val groundTrack: Int = 0, // "heading"
|
||||
val precisionBits: Int = 0,
|
||||
) : Parcelable {
|
||||
|
||||
companion object {
|
||||
/// Convert to a double representation of degrees
|
||||
fun degD(i: Int) = i * 1e-7
|
||||
|
|
@ -79,12 +84,16 @@ data class Position(
|
|||
|
||||
/** Create our model object from a protobuf. If time is unspecified in the protobuf, the provided default time will be used.
|
||||
*/
|
||||
constructor(p: MeshProtos.Position, defaultTime: Int = currentTime()) : this(
|
||||
constructor(position: MeshProtos.Position, defaultTime: Int = currentTime()) : this(
|
||||
// We prefer the int version of lat/lon but if not available use the depreciated legacy version
|
||||
degD(p.latitudeI),
|
||||
degD(p.longitudeI),
|
||||
p.altitude,
|
||||
if (p.time != 0) p.time else defaultTime
|
||||
degD(position.latitudeI),
|
||||
degD(position.longitudeI),
|
||||
position.altitude,
|
||||
if (position.time != 0) position.time else defaultTime,
|
||||
position.satsInView,
|
||||
position.groundSpeed,
|
||||
position.groundTrack,
|
||||
position.precisionBits
|
||||
)
|
||||
|
||||
/// @return distance in meters to some other node (or null if unknown)
|
||||
|
|
|
|||
|
|
@ -26,8 +26,9 @@ import com.geeksville.mesh.database.entity.QuickChatAction
|
|||
],
|
||||
autoMigrations = [
|
||||
AutoMigration (from = 3, to = 4),
|
||||
AutoMigration (from = 4, to = 5),
|
||||
],
|
||||
version = 4,
|
||||
version = 5,
|
||||
exportSchema = true,
|
||||
)
|
||||
@TypeConverters(Converters::class)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue