Compare commits

...
Author SHA1 Message Date
atsunatsu 935b526d8b Merge pull request #4 from wty2019wty/patch-1
fix: i18n 补充翻译
2026-08-06 16:18:35 +08:00
wty2019wty 87fb8f2fbb Add compass offset strings for radar settings 2026-08-06 16:11:30 +08:00
atsunatsu 008bc7483d fix(i18n): update Chinese station position text from '站位' to '站点位置'
Replaced all occurrences of '站位' with '站点位置' in the
Chinese (zh) strings file for better readability and accuracy.
2026-08-06 10:00:07 +08:00
atsunatsu 6e95f111fe fix: recalculate radar track when station position changes
The station position (stationPos) was captured once at ViewModel construction
and never updated when the user clicked on the map or changed the QTH grid.
This caused the radar track line to simply translate instead of being
recalculated from the new position.

Fix:
- Change stationPos and magDeclination from val to var
- Add collectStationPositionChanges() that observes settingsRepo.stationPosition
- On position change: update stationPos, magDeclination, force celestial
  recompute, and recalculate the satellite track
2026-08-06 09:41:46 +08:00
3 changed files with 28 additions and 7 deletions

No files matched your search

+1
View File
@@ -64,3 +64,4 @@ fastlane/readme.md
/app/release/output-metadata.json
/app/release/
/.kotlin/sessions/
.hermes/
@@ -87,7 +87,7 @@
<string name="prefs_updated_title">更新:%s</string>
<string name="prefs_updated_time">yyyy MMM d - HH:mm:ss</string>
<string name="prefs_loc_title">站位</string>
<string name="prefs_loc_title">站点位置</string>
<string name="prefs_loc_gps_title">GPS 定位</string>
<string name="prefs_loc_gps_error">检查您的位置权限</string>
<string name="prefs_loc_input_title">输入位置</string>
@@ -95,11 +95,11 @@
<string name="prefs_loc_qth_title">QTH 网格</string>
<string name="prefs_loc_qth_error">无效的 QTH 网格</string>
<string name="prefs_loc_success">位置更新成功</string>
<string name="prefs_station_title">站位</string>
<string name="prefs_station_lat_text">站位纬度</string>
<string name="prefs_station_lon_text">站位经度</string>
<string name="prefs_station_title">站点位置</string>
<string name="prefs_station_lat_text">站点纬度</string>
<string name="prefs_station_lon_text">站点经度</string>
<string name="prefs_locator_title">QTH 定位</string>
<string name="prefs_locator_text">通过 QTH 设置站位</string>
<string name="prefs_locator_text">通过 QTH 设置站点位置</string>
<string name="prefs_data_title">卫星数据更新</string>
<string name="prefs_data_entries">卫星:%s</string>
@@ -155,6 +155,8 @@
<string name="prefs_other_switch_sweep">雷达扫描动画</string>
<string name="prefs_other_switch_sensors">传感器控制雷达</string>
<string name="prefs_other_switch_night_mode">红色夜间模式</string>
<string name="prefs_other_compass_offset">雷达罗盘水平偏移量</string>
<string name="prefs_other_compass_offset_elev">雷达罗盘俯仰偏移量</string>
<string name="prefs_highlight_title">仰角高亮</string>
<string name="prefs_highlight_low">低 &lt; %1$d°</string>
@@ -65,8 +65,8 @@ class RadarViewModel(
private val showToast: IShowToast
) : ViewModel() {
private val stationPos = settingsRepo.stationPosition.value
private val magDeclination = sensorsRepo.getMagDeclination(stationPos)
private var stationPos = settingsRepo.stationPosition.value
private var magDeclination = sensorsRepo.getMagDeclination(stationPos)
private var compassOffset = settingsRepo.otherSettings.value.radarCompassOffset
private var compassOffsetElev = settingsRepo.otherSettings.value.radarCompassOffsetElev
private var transponders: List<SatRadio> = emptyList()
@@ -92,6 +92,7 @@ class RadarViewModel(
init {
collectSettingsChanges() // also handles initial sensor subscription
collectStationPositionChanges()
collectPassAndStartTickLoop()
collectRadioTrackingState()
}
@@ -138,6 +139,23 @@ class RadarViewModel(
}
}
private fun collectStationPositionChanges() {
viewModelScope.launch {
settingsRepo.stationPosition.collect { newPos ->
if (stationPos != newPos) {
stationPos = newPos
magDeclination = sensorsRepo.getMagDeclination(stationPos)
lastCelestialUpdateMs = 0L // force celestial recompute on next tick
val pass = _uiState.value.currentPass ?: return@collect
if (!pass.isDeepSpace) {
val track = satelliteRepo.getTrack(pass.orbitalObject, stationPos, pass.aosTime, pass.losTime)
_uiState.update { it.copy(satTrack = track) }
}
}
}
}
}
// --- Pass loading split into focused functions ---
private fun collectPassAndStartTickLoop() {