Satellite tracker and pass predictor for Android, inspired by Gpredict
Kotlin amsatcelestrakgpsham-radiohamlibhamradiokotlinnasaradiosatellitesatellite-datasatellite-positionsatellite-predictionsatellitessatnogssdrspacespacexstarlink
Fixed NPE in PassPredictor happening during satPass calculation
Arty Bishop499febefcbe2
diff --git a/app/src/main/java/com/rtbishop/look4sat/utility/PassPredictor.kt b/app/src/main/java/com/rtbishop/look4sat/utility/PassPredictor.ktindex fde89fe5..e41f2c1e 100644--- a/app/src/main/java/com/rtbishop/look4sat/utility/PassPredictor.kt+++ b/app/src/main/java/com/rtbishop/look4sat/utility/PassPredictor.kt@@ -155,7 +155,6 @@ class PassPredictor(private val tle: TLE, private val qth: GroundStationPositionvar maxElevation = 0.0var elevation: Doublevar prevPos: SatPos- var tca: Date? = nullvar polePassed = deadSpotNone// get the current position@@ -184,11 +183,9 @@ class PassPredictor(private val tle: TLE, private val qth: GroundStationPosition// now find the next time it comes above the horizondo {satPos = getPosition(cal, 60)- val now = cal.timeelevation = satPos.elevationif (elevation > maxElevation) {maxElevation = elevation- tca = now}} while (satPos.elevation < 0.0)@@ -196,11 +193,9 @@ class PassPredictor(private val tle: TLE, private val qth: GroundStationPositioncal.add(Calendar.SECOND, -60)do {satPos = getPosition(cal, 5)- val now = cal.timeelevation = satPos.elevationif (elevation > maxElevation) {maxElevation = elevation- tca = now}prevPos = satPos} while (satPos.elevation < 0.0)@@ -210,7 +205,6 @@ class PassPredictor(private val tle: TLE, private val qth: GroundStationPosition// now find when it goes belowdo {satPos = getPosition(cal, 30)- val now = cal.timeval currPolePassed = getPolePassed(prevPos, satPos)if (currPolePassed != deadSpotNone) {polePassed = currPolePassed@@ -218,7 +212,6 @@ class PassPredictor(private val tle: TLE, private val qth: GroundStationPositionelevation = satPos.elevationif (elevation > maxElevation) {maxElevation = elevation- tca = now}prevPos = satPos} while (satPos.elevation > 0.0)@@ -227,16 +220,15 @@ class PassPredictor(private val tle: TLE, private val qth: GroundStationPositioncal.add(Calendar.SECOND, -30)do {satPos = getPosition(cal, 5)- val now = cal.timeelevation = satPos.elevationif (elevation > maxElevation) {maxElevation = elevation- tca = now}} while (satPos.elevation > 0.0)val endDate = satPos.timelosAzimuth = (satPos.azimuth / (2.0 * Math.PI) * 360.0).toInt()+ val tca = Date(startDate.time + (endDate.time - startDate.time) / 2)return SatPassTime(startDate, endDate, tca, polePassed, aosAzimuth,