diff --git a/app/src/main/java/com/rtbishop/look4sat/MainApplication.kt b/app/src/main/java/com/rtbishop/look4sat/MainApplication.kt index 8984ecb2..90273fa7 100644 --- a/app/src/main/java/com/rtbishop/look4sat/MainApplication.kt +++ b/app/src/main/java/com/rtbishop/look4sat/MainApplication.kt @@ -51,6 +51,9 @@ class MainApplication : Application(), IContainerProvider { container.appScope.launch { checkAutoUpdate() } // automatic LoTW grid sync on every app start (gated, see checkLoTWAutoSync) container.appScope.launch { checkLoTWAutoSync() } + // repair logbooks split by the old name/band identity mismatch, independent of + // whether a sync is due (cheap read + in-memory match on every start) + container.appScope.launch { runCatching { container.qsoRepository.consolidateConfirmations() } } // load satellite data on every app start container.appScope.launch { container.satelliteRepo.initRepository() } } diff --git a/core/data/src/main/java/com/rtbishop/look4sat/core/data/framework/IcomCivProtocol.kt b/core/data/src/main/java/com/rtbishop/look4sat/core/data/framework/IcomCivProtocol.kt index cc281ed5..8126ba48 100644 --- a/core/data/src/main/java/com/rtbishop/look4sat/core/data/framework/IcomCivProtocol.kt +++ b/core/data/src/main/java/com/rtbishop/look4sat/core/data/framework/IcomCivProtocol.kt @@ -330,12 +330,13 @@ object IcomCivProtocol { /** * Parse frequency + mode from a CMD_READ_FREQ reply payload. - * Payload layout after stripping command byte: [5 freq bytes] [mode byte] [filter byte] + * Payload layout after stripping command byte: [5 freq bytes] + * The IC-705 does not include a mode byte; if one is present it is parsed, otherwise mode is empty. */ fun parseFreqModePayload(payload: ByteArray): Pair? { - if (payload.size < 6) return null + if (payload.size < 5) return null val freqHz = decodeFrequencyBcd(payload.copyOfRange(0, 5)) - val mode = BYTE_TO_MODE[payload[5]] ?: return null + val mode = if (payload.size > 5) BYTE_TO_MODE[payload[5]] ?: return null else "" return freqHz to mode } diff --git a/core/data/src/main/java/com/rtbishop/look4sat/core/data/repository/AmSatRepository.kt b/core/data/src/main/java/com/rtbishop/look4sat/core/data/repository/AmSatRepository.kt index 598a2595..7aa00b36 100644 --- a/core/data/src/main/java/com/rtbishop/look4sat/core/data/repository/AmSatRepository.kt +++ b/core/data/src/main/java/com/rtbishop/look4sat/core/data/repository/AmSatRepository.kt @@ -1,3 +1,21 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.rtbishop.look4sat.core.data.repository import com.rtbishop.look4sat.core.domain.model.AmSatReportSubmission diff --git a/core/data/src/test/java/com/rtbishop/look4sat/core/data/framework/Ft817CatProtocolTest.kt b/core/data/src/test/java/com/rtbishop/look4sat/core/data/framework/Ft817CatProtocolTest.kt index 841954eb..4a632781 100644 --- a/core/data/src/test/java/com/rtbishop/look4sat/core/data/framework/Ft817CatProtocolTest.kt +++ b/core/data/src/test/java/com/rtbishop/look4sat/core/data/framework/Ft817CatProtocolTest.kt @@ -1,3 +1,21 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.rtbishop.look4sat.core.data.framework import org.junit.Assert.assertArrayEquals diff --git a/core/data/src/test/java/com/rtbishop/look4sat/core/data/framework/IcomCivProtocolTest.kt b/core/data/src/test/java/com/rtbishop/look4sat/core/data/framework/IcomCivProtocolTest.kt new file mode 100644 index 00000000..a1a77ada --- /dev/null +++ b/core/data/src/test/java/com/rtbishop/look4sat/core/data/framework/IcomCivProtocolTest.kt @@ -0,0 +1,51 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.rtbishop.look4sat.core.data.framework + +import org.junit.Assert.assertEquals +import org.junit.Assert.assertNotNull +import org.junit.Assert.assertNull +import org.junit.Test + +class IcomCivProtocolTest { + + private fun bytes(vararg values: Int) = ByteArray(values.size) { values[it].toByte() } + + @Test + fun parseFreqModePayload_ic705ReadFreqReply() { + // Reply captured from an IC-705 to CMD 0x03: frequency only, no mode byte + val reply = bytes(0xFE, 0xFE, 0xE0, 0xA4, 0x03, 0x60, 0x74, 0x95, 0x45, 0x01, 0xFD) + val response = IcomCivProtocol.parseResponse(reply, IcomCivProtocol.CMD_READ_FREQ) + assertNotNull(response) + assertEquals(145957460L to "", IcomCivProtocol.parseFreqModePayload(response!!.payload)) + } + + @Test + fun parseFreqModePayload_withModeByte() { + assertEquals( + 435611000L to "USB", + IcomCivProtocol.parseFreqModePayload(bytes(0x00, 0x10, 0x61, 0x35, 0x04, 0x01, 0x01)) + ) + } + + @Test + fun parseFreqModePayload_tooShort() { + assertNull(IcomCivProtocol.parseFreqModePayload(bytes(0x60, 0x74, 0x95, 0x45))) + } +} diff --git a/core/data/src/test/java/com/rtbishop/look4sat/core/data/repository/AmSatRepositoryTest.kt b/core/data/src/test/java/com/rtbishop/look4sat/core/data/repository/AmSatRepositoryTest.kt index 579f94a5..9d1aab34 100644 --- a/core/data/src/test/java/com/rtbishop/look4sat/core/data/repository/AmSatRepositoryTest.kt +++ b/core/data/src/test/java/com/rtbishop/look4sat/core/data/repository/AmSatRepositoryTest.kt @@ -1,3 +1,21 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.rtbishop.look4sat.core.data.repository import com.rtbishop.look4sat.core.domain.model.SatStatus diff --git a/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/model/AmSatReportSubmission.kt b/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/model/AmSatReportSubmission.kt index ca7edce5..303fcec9 100644 --- a/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/model/AmSatReportSubmission.kt +++ b/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/model/AmSatReportSubmission.kt @@ -1,3 +1,21 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.rtbishop.look4sat.core.domain.model /** One public AMSAT satellite status report submission. */ diff --git a/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/model/GridQso.kt b/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/model/GridQso.kt index fcc348d9..4ccc56a0 100644 --- a/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/model/GridQso.kt +++ b/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/model/GridQso.kt @@ -26,9 +26,12 @@ package com.rtbishop.look4sat.core.domain.model * @param epochMs QSO date+time in UTC milliseconds * @param satName satellite name (e.g. "FO-29") * @param mode ADIF mode (FM / CW / SSB ...) - * @param bandUp uplink band as reported by LoTW (BAND_RX: "70CM", "2M", "10M"...) - * @param bandDown downlink band (BAND: "2M", "70CM"...) — may be empty when - * LoTW did not include it + * @param bandUp uplink band, the band of the transmitted frequency (ADIF BAND: + * "2M", "70CM", "10M"...). Measured against the live report of the + * user's own uploads: SO-50 arrives as BAND=2M/FREQ=145.85 with + * BAND_RX=70CM/FREQ_RX=436.8, i.e. BAND carries the uplink. + * @param bandDown downlink band (ADIF BAND_RX) — may be empty when LoTW did not + * include it * @param dxcc ARRL DXCC entity code of the opposite station (from ADIF * ), or null when LoTW omitted it * @param country DXCC entity name (ADIF ), or null diff --git a/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/model/LatestRelease.kt b/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/model/LatestRelease.kt index 57e85afb..33dfc617 100644 --- a/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/model/LatestRelease.kt +++ b/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/model/LatestRelease.kt @@ -1,3 +1,21 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.rtbishop.look4sat.core.domain.model /** Latest release info fetched from the fork's GitHub releases API. */ diff --git a/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/model/SatStatus.kt b/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/model/SatStatus.kt index 08610bf4..33bf239f 100644 --- a/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/model/SatStatus.kt +++ b/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/model/SatStatus.kt @@ -1,3 +1,21 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.rtbishop.look4sat.core.domain.model /** One satellite status report (AMSAT site tooltip data) */ diff --git a/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/repository/IAmSatRepository.kt b/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/repository/IAmSatRepository.kt index a4c8c9be..3a68bb0f 100644 --- a/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/repository/IAmSatRepository.kt +++ b/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/repository/IAmSatRepository.kt @@ -1,3 +1,21 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.rtbishop.look4sat.core.domain.repository import com.rtbishop.look4sat.core.domain.model.AmSatReportSubmission diff --git a/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/repository/IUpdateRepository.kt b/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/repository/IUpdateRepository.kt index de2fddb2..a63a0976 100644 --- a/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/repository/IUpdateRepository.kt +++ b/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/repository/IUpdateRepository.kt @@ -1,3 +1,21 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.rtbishop.look4sat.core.domain.repository import com.rtbishop.look4sat.core.domain.model.LatestRelease diff --git a/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/utility/VersionComparator.kt b/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/utility/VersionComparator.kt index de33d668..038514d7 100644 --- a/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/utility/VersionComparator.kt +++ b/core/domain/src/main/java/com/rtbishop/look4sat/core/domain/utility/VersionComparator.kt @@ -1,3 +1,21 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.rtbishop.look4sat.core.domain.utility /** diff --git a/core/domain/src/test/java/com/rtbishop/look4sat/core/domain/DopplerFrequencyCalculatorTest.kt b/core/domain/src/test/java/com/rtbishop/look4sat/core/domain/DopplerFrequencyCalculatorTest.kt index e5f143de..9d51883b 100644 --- a/core/domain/src/test/java/com/rtbishop/look4sat/core/domain/DopplerFrequencyCalculatorTest.kt +++ b/core/domain/src/test/java/com/rtbishop/look4sat/core/domain/DopplerFrequencyCalculatorTest.kt @@ -1,3 +1,21 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.rtbishop.look4sat.core.domain import com.rtbishop.look4sat.core.domain.model.SatRadio diff --git a/core/domain/src/test/java/com/rtbishop/look4sat/core/domain/QthConverterTest.kt b/core/domain/src/test/java/com/rtbishop/look4sat/core/domain/QthConverterTest.kt index c25ea44d..7e081f74 100644 --- a/core/domain/src/test/java/com/rtbishop/look4sat/core/domain/QthConverterTest.kt +++ b/core/domain/src/test/java/com/rtbishop/look4sat/core/domain/QthConverterTest.kt @@ -1,3 +1,21 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.rtbishop.look4sat.core.domain import com.rtbishop.look4sat.core.domain.utility.positionToQth diff --git a/core/domain/src/test/java/com/rtbishop/look4sat/core/domain/TransponderMapperTest.kt b/core/domain/src/test/java/com/rtbishop/look4sat/core/domain/TransponderMapperTest.kt index b1aa5e58..250baba1 100644 --- a/core/domain/src/test/java/com/rtbishop/look4sat/core/domain/TransponderMapperTest.kt +++ b/core/domain/src/test/java/com/rtbishop/look4sat/core/domain/TransponderMapperTest.kt @@ -1,3 +1,21 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.rtbishop.look4sat.core.domain import com.rtbishop.look4sat.core.domain.model.SatRadio diff --git a/core/domain/src/test/java/com/rtbishop/look4sat/core/domain/VersionComparatorTest.kt b/core/domain/src/test/java/com/rtbishop/look4sat/core/domain/VersionComparatorTest.kt index 48e7aa55..9784969d 100644 --- a/core/domain/src/test/java/com/rtbishop/look4sat/core/domain/VersionComparatorTest.kt +++ b/core/domain/src/test/java/com/rtbishop/look4sat/core/domain/VersionComparatorTest.kt @@ -1,3 +1,21 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.rtbishop.look4sat.core.domain import com.rtbishop.look4sat.core.domain.utility.VersionComparator diff --git a/feature/map/src/main/java/com/rtbishop/look4sat/feature/map/MapNightOverlay.kt b/feature/map/src/main/java/com/rtbishop/look4sat/feature/map/MapNightOverlay.kt index 33e17381..49c86e9a 100644 --- a/feature/map/src/main/java/com/rtbishop/look4sat/feature/map/MapNightOverlay.kt +++ b/feature/map/src/main/java/com/rtbishop/look4sat/feature/map/MapNightOverlay.kt @@ -116,8 +116,9 @@ class MapNightOverlay : Overlay() { else -> { // Terminator crosses this column — find the crossing pixel by binary search - val crossY = findCrossingY(proj, x, 0, h - 1, sinSunLat, cosSunLat, cosLonDiff) - if (dotTop < 0) { + val isNightAtTop = dotTop < 0 + val crossY = findCrossingY(proj, x, 0, h - 1, sinSunLat, cosSunLat, cosLonDiff, isNightAtTop) + if (isNightAtTop) { // Night at top, day at bottom rect.set(x.toFloat(), 0f, (x + stepPx).toFloat(), crossY.toFloat()) canvas.drawRect(rect, nightPaint) @@ -134,7 +135,11 @@ class MapNightOverlay : Overlay() { /** * Binary-search for the pixel row where the day/night boundary crosses column [x]. - * [yTop] is in day, [yBot] is in night (or vice versa). + * + * [isNightAtTop] states which side [yTop] is on. Both polarities occur: the pole nearest + * the sub-solar point is lit, so the terminator runs day-over-night while the sub-solar + * latitude is positive and night-over-day once it turns negative after the September + * equinox. Anchoring lo to the top pixel's side keeps the search valid either way. */ private fun findCrossingY( proj: org.osmdroid.views.Projection, @@ -143,7 +148,8 @@ class MapNightOverlay : Overlay() { yBot: Int, sinSunLat: Double, cosSunLat: Double, - cosLonDiff: Double + cosLonDiff: Double, + isNightAtTop: Boolean ): Int { var lo = yTop var hi = yBot @@ -152,7 +158,8 @@ class MapNightOverlay : Overlay() { val geo = proj.fromPixels(x, mid, reusableGeoPoint) ?: return mid val latRad = Math.toRadians(geo.latitude) val dot = sin(latRad) * sinSunLat + cos(latRad) * cosSunLat * cosLonDiff - if (dot < 0) hi = mid else lo = mid + // Keep lo on the top pixel's side of the terminator and hi on the opposite side + if ((dot < 0) == isNightAtTop) lo = mid else hi = mid } return (lo + hi) / 2 } diff --git a/feature/mutual/src/test/java/com/rtbishop/look4sat/feature/mutual/Fakes.kt b/feature/mutual/src/test/java/com/rtbishop/look4sat/feature/mutual/Fakes.kt index 7319d43e..857e5bcb 100644 --- a/feature/mutual/src/test/java/com/rtbishop/look4sat/feature/mutual/Fakes.kt +++ b/feature/mutual/src/test/java/com/rtbishop/look4sat/feature/mutual/Fakes.kt @@ -1,3 +1,21 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.rtbishop.look4sat.feature.mutual import com.rtbishop.look4sat.core.domain.model.DataSourcesSettings @@ -111,6 +129,8 @@ class FakeSettingsRepo( override fun updateRadioControlSettings(settings: RadioControlSettings) = TODO() override fun getSatelliteOffset(catnum: Int): String = "" override fun setSatelliteOffset(catnum: Int, offset: String) = TODO() + override fun getSatelliteMode(catnum: Int): String = "" + override fun setSatelliteMode(catnum: Int, mode: String) = TODO() override fun getAmSatCallsign(): String = "" override fun setAmSatCallsign(callsign: String) = TODO() override fun updateWavelogSettings(settings: WavelogSettings) = TODO() diff --git a/feature/mutual/src/test/java/com/rtbishop/look4sat/feature/mutual/MainDispatcherRule.kt b/feature/mutual/src/test/java/com/rtbishop/look4sat/feature/mutual/MainDispatcherRule.kt index 5776b71e..af2620e4 100644 --- a/feature/mutual/src/test/java/com/rtbishop/look4sat/feature/mutual/MainDispatcherRule.kt +++ b/feature/mutual/src/test/java/com/rtbishop/look4sat/feature/mutual/MainDispatcherRule.kt @@ -1,3 +1,21 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.rtbishop.look4sat.feature.mutual import kotlinx.coroutines.Dispatchers diff --git a/feature/mutual/src/test/java/com/rtbishop/look4sat/feature/mutual/MutualMatchPrefillScrollTest.kt b/feature/mutual/src/test/java/com/rtbishop/look4sat/feature/mutual/MutualMatchPrefillScrollTest.kt index c82c66b9..2c549bf4 100644 --- a/feature/mutual/src/test/java/com/rtbishop/look4sat/feature/mutual/MutualMatchPrefillScrollTest.kt +++ b/feature/mutual/src/test/java/com/rtbishop/look4sat/feature/mutual/MutualMatchPrefillScrollTest.kt @@ -1,3 +1,21 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.rtbishop.look4sat.feature.mutual import androidx.compose.foundation.layout.Spacer diff --git a/feature/mutual/src/test/java/com/rtbishop/look4sat/feature/mutual/MutualViewModelTest.kt b/feature/mutual/src/test/java/com/rtbishop/look4sat/feature/mutual/MutualViewModelTest.kt index e9546247..8077b90c 100644 --- a/feature/mutual/src/test/java/com/rtbishop/look4sat/feature/mutual/MutualViewModelTest.kt +++ b/feature/mutual/src/test/java/com/rtbishop/look4sat/feature/mutual/MutualViewModelTest.kt @@ -1,3 +1,21 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.rtbishop.look4sat.feature.mutual import com.rtbishop.look4sat.core.domain.predict.GeoPos diff --git a/feature/mutual/src/test/java/com/rtbishop/look4sat/feature/mutual/TestOrbits.kt b/feature/mutual/src/test/java/com/rtbishop/look4sat/feature/mutual/TestOrbits.kt index 34ba3d09..8acce29a 100644 --- a/feature/mutual/src/test/java/com/rtbishop/look4sat/feature/mutual/TestOrbits.kt +++ b/feature/mutual/src/test/java/com/rtbishop/look4sat/feature/mutual/TestOrbits.kt @@ -1,3 +1,21 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.rtbishop.look4sat.feature.mutual import com.rtbishop.look4sat.core.domain.predict.GeoPos diff --git a/feature/status/src/main/java/com/rtbishop/look4sat/feature/status/SatStatusScreen.kt b/feature/status/src/main/java/com/rtbishop/look4sat/feature/status/SatStatusScreen.kt index cd599a3b..98bbcf15 100644 --- a/feature/status/src/main/java/com/rtbishop/look4sat/feature/status/SatStatusScreen.kt +++ b/feature/status/src/main/java/com/rtbishop/look4sat/feature/status/SatStatusScreen.kt @@ -1,3 +1,21 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.rtbishop.look4sat.feature.status import androidx.compose.animation.AnimatedVisibility diff --git a/feature/status/src/main/java/com/rtbishop/look4sat/feature/status/SatStatusViewModel.kt b/feature/status/src/main/java/com/rtbishop/look4sat/feature/status/SatStatusViewModel.kt index 6f6ceb61..7db4278c 100644 --- a/feature/status/src/main/java/com/rtbishop/look4sat/feature/status/SatStatusViewModel.kt +++ b/feature/status/src/main/java/com/rtbishop/look4sat/feature/status/SatStatusViewModel.kt @@ -1,3 +1,21 @@ +/* + * Look4Sat-BA7OPF. Amateur radio satellite tracker and pass predictor. + * Copyright (C) 2026 BA7OPF. + * Based on Look4Sat by Arty Bishop and contributors. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.rtbishop.look4sat.feature.status import androidx.lifecycle.ViewModel