1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
name: "Display forecast wind direction (TWD) in instrument sheet"
description: "MarineConditions.windDirDeg is fetched from Open-Meteo and stored in the model but never displayed anywhere. Show it as a sub-label under the TWS cell."
agent:
model: "sonnet"
working_dir: "/workspace/nav"
instructions: |
Context
-------
fetchCurrentConditions() in WeatherRepository populates MarineConditions.windDirDeg
from the Open-Meteo hourly winddirection_10m field (in degrees true).
(android-app/app/src/main/kotlin/org/terst/nav/data/repository/WeatherRepository.kt, line ~63)
(android-app/app/src/main/kotlin/org/terst/nav/data/model/MarineConditions.kt, line 9)
In MainActivity.observeDataSources(), the marineConditions collector reads windSpeedKt
(displays as TWS) but never reads windDirDeg:
(android-app/app/src/main/kotlin/org/terst/nav/MainActivity.kt, marineConditions collector)
The instrument sheet layout has a TWS cell:
(android-app/app/src/main/res/layout/layout_instruments_sheet.xml)
<TextView android:id="@+id/value_tws" style="@style/InstrumentPrimaryValue" />
Goal
----
Show wind direction as a secondary line below the TWS value (e.g. "045°") using the
same pattern used for curr_dir below curr_spd in the conditions section.
Step 1 — Add value_twd TextView to layout
------------------------------------------
In android-app/app/src/main/res/layout/layout_instruments_sheet.xml,
find the TWS LinearLayout:
<LinearLayout ... android:gravity="center" android:padding="8dp">
<TextView style="@style/InstrumentLabel" android:text="TWS" />
<TextView android:id="@+id/value_tws" style="@style/InstrumentPrimaryValue" tools:text="—" />
</LinearLayout>
Add a third child TextView for the direction:
<LinearLayout ... android:gravity="center" android:padding="8dp">
<TextView style="@style/InstrumentLabel" android:text="TWS" />
<TextView android:id="@+id/value_tws" style="@style/InstrumentPrimaryValue" tools:text="—" />
<TextView android:id="@+id/value_twd" style="@style/InstrumentLabel" tools:text="—" />
</LinearLayout>
Step 2 — Add valueTwd field to InstrumentHandler
-------------------------------------------------
In android-app/app/src/main/kotlin/org/terst/nav/ui/InstrumentHandler.kt:
Add constructor parameter:
private val valueTwd: TextView
Add twd parameter to updateDisplay():
twd: String? = null
Add in the updateDisplay body:
twd?.let { valueTwd.text = it }
Step 3 — Wire in MainActivity
------------------------------
In android-app/app/src/main/kotlin/org/terst/nav/MainActivity.kt,
in setupHandlers(), add to InstrumentHandler constructor:
valueTwd = findViewById(R.id.value_twd)
In setupHandlers(), add "—" initial value:
instrumentHandler?.updateDisplay(..., twd = "—")
In observeDataSources(), in the marineConditions collector, add:
instrumentHandler?.updateDisplay(
tws = c.windSpeedKt?.let { "%.1f".format(Locale.getDefault(), it) } ?: "—",
twd = c.windDirDeg?.let { "%.0f°".format(Locale.getDefault(), it) } ?: "—"
)
Step 4 — Build
--------------
cd android-app && ANDROID_HOME=/opt/android-sdk ./gradlew assembleDebug 2>&1 | tail -5
Confirm BUILD SUCCESSFUL.
Step 5 — Commit and push
------------------------
git add android-app/app/src/main/res/layout/layout_instruments_sheet.xml \
android-app/app/src/main/kotlin/org/terst/nav/ui/InstrumentHandler.kt \
android-app/app/src/main/kotlin/org/terst/nav/MainActivity.kt
git commit -m "feat(instruments): display forecast wind direction (TWD) under TWS cell
windDirDeg was fetched from Open-Meteo and stored in MarineConditions
but never shown. Adds value_twd sub-label below the TWS primary value."
git push github main && git push local main
timeout: "15m"
tags:
- "instruments"
- "wind"
- "forecast"
|