feat(train): a ride's distance from the wheel where GPS falls short (ADR 0030, D49)
The speed sensor's wheel gives a ride's distance, splits, progress and live speed where GPS made less than 90 % of its way (a turbo trainer, a tunnel); its circumference starts at 2105 mm, is learnt from rides with 2 km of GPS or typed on the Record sheet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
5c13e6f3c5
commit
a848b71bd4
2 changed files with 527 additions and 27 deletions
|
|
@ -88,6 +88,7 @@ class MainActivity : FlutterActivity() {
|
|||
announce = call.argument<String>("announce"),
|
||||
speedSensor = call.argument<String>("speedSensor"),
|
||||
powerMeter = call.argument<String>("powerMeter"),
|
||||
wheelMm = call.argument<Int>("wheelMm"),
|
||||
)
|
||||
result.success(null)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ class RecorderService : Service(), LocationListener, SensorEventListener {
|
|||
private const val EXTRA_ANNOUNCE = "announce"
|
||||
private const val EXTRA_SPEED_SENSOR = "speedSensor"
|
||||
private const val EXTRA_POWER_METER = "powerMeter"
|
||||
private const val EXTRA_WHEEL_MM = "wheelMm"
|
||||
private const val CHANNEL = "recording"
|
||||
private const val NOTIFICATION_ID = 5301
|
||||
private const val FLUSH_EVERY_MS = 5_000L
|
||||
|
|
@ -88,7 +89,7 @@ class RecorderService : Service(), LocationListener, SensorEventListener {
|
|||
* file at [music] says (D47, D48; null: none), announcing each distance
|
||||
* passed in the words of [announce] (JSON, D49; null: never), with the
|
||||
* bike's speed and cadence sensor at [speedSensor] and its power meter at
|
||||
* [powerMeter] (D49; null: none).
|
||||
* [powerMeter] (D49; null: none), its wheel [wheelMm] round.
|
||||
*/
|
||||
fun start(
|
||||
context: Context,
|
||||
|
|
@ -105,6 +106,7 @@ class RecorderService : Service(), LocationListener, SensorEventListener {
|
|||
announce: String?,
|
||||
speedSensor: String?,
|
||||
powerMeter: String?,
|
||||
wheelMm: Int?,
|
||||
) {
|
||||
ContextCompat.startForegroundService(
|
||||
context,
|
||||
|
|
@ -122,7 +124,8 @@ class RecorderService : Service(), LocationListener, SensorEventListener {
|
|||
.putExtra(EXTRA_MUSIC, music)
|
||||
.putExtra(EXTRA_ANNOUNCE, announce)
|
||||
.putExtra(EXTRA_SPEED_SENSOR, speedSensor)
|
||||
.putExtra(EXTRA_POWER_METER, powerMeter),
|
||||
.putExtra(EXTRA_POWER_METER, powerMeter)
|
||||
.putExtra(EXTRA_WHEEL_MM, wheelMm ?: 0),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -349,6 +352,8 @@ class RecorderService : Service(), LocationListener, SensorEventListener {
|
|||
).also { it.open() }
|
||||
}
|
||||
speedSensorAt?.let { address ->
|
||||
// What the app works the wheel's distance out by (D49).
|
||||
intent.getIntExtra(EXTRA_WHEEL_MM, 0).takeIf { it > 0 }?.let { write("wheelsize $now $it") }
|
||||
speedSensor =
|
||||
NotifyLink(
|
||||
this,
|
||||
|
|
|
|||
Loading…
Reference in a new issue