Bluetooth Sensor: add cycling powermeter.

This commit is contained in:
Dennis Guse
2020-10-01 17:55:33 +02:00
parent e5911a79ab
commit 634a7a4321
16 changed files with 243 additions and 18 deletions
+10
View File
@@ -26,3 +26,13 @@ However, often only one value is provided.
* Wahoo Cadence (Model: WFPODCAD2) * Wahoo Cadence (Model: WFPODCAD2)
This sensor reports cadence data as speed. This sensor reports cadence data as speed.
A workaround is in place. A workaround is in place.
## Cycling Power Measurement
We only support _Instantaneous Power_.
* QUARQ Red DZero Powermeter
* Wahoo Kickr v4.0
WARNING: we only support physically movements with valid GPS coordinates.
Using a device indoors (no GPS available) will only show the current power values, but won't store anything.
Also the distance is not computed.
@@ -75,4 +75,16 @@ public class BluetoothUtilsTest {
assertEquals(200, sensor.getCadence().getCrankRevolutionsCount()); assertEquals(200, sensor.getCadence().getCrankRevolutionsCount());
assertEquals(225, sensor.getSpeed().getWheelRevolutionsCount()); assertEquals(225, sensor.getSpeed().getWheelRevolutionsCount());
} }
@Test
public void parseCyclingPower_power() {
BluetoothGattCharacteristic characteristic = new BluetoothGattCharacteristic(BluetoothUtils.CYCLING_POWER_MEASUREMENT_CHAR_UUID, 0, 0);
characteristic.setValue(new byte[]{0, 0, 40, 0});
// when
int power_w = BluetoothUtils.parseCyclingPower(characteristic);
// then
assertEquals(40, power_w);
}
} }
@@ -0,0 +1,32 @@
package de.dennisguse.opentracks.content.sensor;
import androidx.annotation.NonNull;
public class SensorDataCyclingPower extends SensorData {
private final Float power_w;
public SensorDataCyclingPower(String address) {
super(address);
this.power_w = null;
}
public SensorDataCyclingPower(String name, String address, float power_w) {
super(name, address);
this.power_w = power_w;
}
public boolean hasPower_w() {
return power_w != null;
}
public float getPower_w() {
return power_w;
}
@NonNull
@Override
public String toString() {
return "power=" + power_w;
}
}
@@ -12,6 +12,8 @@ public final class SensorDataSet {
private SensorDataCycling.Speed cyclingSpeed; private SensorDataCycling.Speed cyclingSpeed;
private SensorDataCyclingPower cyclingPower;
public SensorDataSet() { public SensorDataSet() {
} }
@@ -27,6 +29,10 @@ public final class SensorDataSet {
return cyclingSpeed; return cyclingSpeed;
} }
public SensorDataCyclingPower getCyclingPower() {
return cyclingPower;
}
public void set(SensorData data) { public void set(SensorData data) {
set(data, data); set(data, data);
} }
@@ -39,6 +45,7 @@ public final class SensorDataSet {
this.heartRate = null; this.heartRate = null;
this.cyclingCadence = null; this.cyclingCadence = null;
this.cyclingSpeed = null; this.cyclingSpeed = null;
this.cyclingPower = null;
} }
public void fillTrackPoint(TrackPoint trackPoint) { public void fillTrackPoint(TrackPoint trackPoint) {
@@ -53,6 +60,10 @@ public final class SensorDataSet {
if (cyclingSpeed != null && cyclingSpeed.hasSpeed_mps()) { if (cyclingSpeed != null && cyclingSpeed.hasSpeed_mps()) {
trackPoint.setSpeed(cyclingSpeed.getSpeed_mps()); trackPoint.setSpeed(cyclingSpeed.getSpeed_mps());
} }
if (cyclingPower != null && cyclingPower.hasPower_w()) {
trackPoint.setPower(cyclingPower.getPower_w());
}
} }
@NonNull @NonNull
@@ -60,10 +71,11 @@ public final class SensorDataSet {
public String toString() { public String toString() {
return (getHeartRate() != null ? "" + getHeartRate() : "") return (getHeartRate() != null ? "" + getHeartRate() : "")
+ (getCyclingCadence() != null ? " " + getCyclingCadence() : "") + (getCyclingCadence() != null ? " " + getCyclingCadence() : "")
+ (getCyclingSpeed() != null ? " " + getCyclingSpeed() : ""); + (getCyclingSpeed() != null ? " " + getCyclingSpeed() : "")
+ (getCyclingPower() != null ? " " + getCyclingPower() : "");
} }
private void set(SensorData type, SensorData data) { private void set(@NonNull SensorData type, SensorData data) {
if (type instanceof SensorDataHeartRate) { if (type instanceof SensorDataHeartRate) {
this.heartRate = (SensorDataHeartRate) data; this.heartRate = (SensorDataHeartRate) data;
return; return;
@@ -78,6 +90,11 @@ public final class SensorDataSet {
return; return;
} }
throw new UnsupportedOperationException(); if (type instanceof SensorDataCyclingPower) {
this.cyclingPower = (SensorDataCyclingPower) data;
return;
}
throw new UnsupportedOperationException(type.getClass().getCanonicalName());
} }
} }
@@ -22,6 +22,7 @@ import de.dennisguse.opentracks.content.data.Marker;
import de.dennisguse.opentracks.content.data.Track; import de.dennisguse.opentracks.content.data.Track;
import de.dennisguse.opentracks.content.data.TrackPoint; import de.dennisguse.opentracks.content.data.TrackPoint;
import de.dennisguse.opentracks.content.sensor.SensorDataCycling; import de.dennisguse.opentracks.content.sensor.SensorDataCycling;
import de.dennisguse.opentracks.content.sensor.SensorDataCyclingPower;
import de.dennisguse.opentracks.content.sensor.SensorDataHeartRate; import de.dennisguse.opentracks.content.sensor.SensorDataHeartRate;
import de.dennisguse.opentracks.content.sensor.SensorDataSet; import de.dennisguse.opentracks.content.sensor.SensorDataSet;
import de.dennisguse.opentracks.databinding.StatisticsRecordingBinding; import de.dennisguse.opentracks.databinding.StatisticsRecordingBinding;
@@ -273,9 +274,9 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
if (sensorDataSet != null) { if (sensorDataSet != null) {
setHeartRateSensorData(sensorDataSet); setHeartRateSensorData(sensorDataSet);
setCadenceSensorData(sensorDataSet); setCadenceSensorData(sensorDataSet);
setSpeedSensorData(sensorDataSet, isSelectedTrackRecording()); setPowerSensorData(sensorDataSet);
setSpeedSensorData(sensorDataSet);
} }
setTotalElevationGain(trackRecordingService.getElevationGain_m()); setTotalElevationGain(trackRecordingService.getElevationGain_m());
} }
} }
@@ -320,6 +321,29 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
viewBinding.statsSensorCadenceValue.setText(sensorValue); viewBinding.statsSensorCadenceValue.setText(sensorValue);
} }
private void setPowerSensorData(SensorDataSet sensorDataSet) {
int isVisible = View.VISIBLE;
if (PreferencesUtils.isBluetoothCyclingPowerSensorAddressNone(getContext())) {
isVisible = View.GONE;
}
viewBinding.statsSensorPowerGroup.setVisibility(isVisible);
setVisibilitySensorHorizontalLine();
String sensorValue = getContext().getString(R.string.value_unknown);
String sensorName = getContext().getString(R.string.value_unknown);
if (sensorDataSet != null && sensorDataSet.getCyclingPower() != null) {
SensorDataCyclingPower data = sensorDataSet.getCyclingPower();
sensorName = data.getSensorName();
if (data.hasPower_w() && data.isRecent()) {
sensorValue = StringUtils.formatDecimal(data.getPower_w(), 0);
}
}
viewBinding.statsSensorPowerSensorValue.setText(sensorName);
viewBinding.statsSensorPowerValue.setText(sensorValue);
}
// Set elevation gain // Set elevation gain
private void setTotalElevationGain(Float elevationGain_m) { private void setTotalElevationGain(Float elevationGain_m) {
//TODO Check if we can distribute the total elevation gain via trackStatistics instead of doing some computation in the UI layer. //TODO Check if we can distribute the total elevation gain via trackStatistics instead of doing some computation in the UI layer.
@@ -349,14 +373,12 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
} }
} }
private void setSpeedSensorData(SensorDataSet sensorDataSet, boolean isRecording) { private void setSpeedSensorData(SensorDataSet sensorDataSet) {
if (isRecording) { if (sensorDataSet != null && sensorDataSet.getCyclingSpeed() != null) {
if (sensorDataSet != null && sensorDataSet.getCyclingSpeed() != null) { SensorDataCycling.Speed data = sensorDataSet.getCyclingSpeed();
SensorDataCycling.Speed data = sensorDataSet.getCyclingSpeed();
if (data.hasSpeed_mps() && data.isRecent()) { if (data.hasSpeed_mps() && data.isRecent()) {
setSpeed(data.getSpeed_mps()); setSpeed(data.getSpeed_mps());
}
} }
} }
} }
@@ -32,6 +32,7 @@ import java.util.UUID;
import de.dennisguse.opentracks.content.sensor.SensorData; import de.dennisguse.opentracks.content.sensor.SensorData;
import de.dennisguse.opentracks.content.sensor.SensorDataCycling; import de.dennisguse.opentracks.content.sensor.SensorDataCycling;
import de.dennisguse.opentracks.content.sensor.SensorDataCyclingPower;
import de.dennisguse.opentracks.content.sensor.SensorDataHeartRate; import de.dennisguse.opentracks.content.sensor.SensorDataHeartRate;
import de.dennisguse.opentracks.util.BluetoothUtils; import de.dennisguse.opentracks.util.BluetoothUtils;
@@ -88,8 +89,14 @@ public abstract class BluetoothConnectionManager {
// Register for updates. // Register for updates.
BluetoothGattDescriptor descriptor = characteristic.getDescriptor(BluetoothUtils.CLIENT_CHARACTERISTIC_CONFIG_UUID); BluetoothGattDescriptor descriptor = characteristic.getDescriptor(BluetoothUtils.CLIENT_CHARACTERISTIC_CONFIG_UUID);
if (descriptor == null) {
Log.e(TAG, "CLIENT_CHARACTERISTIC_CONFIG_UUID characteristic not available; cannot request notifications for changed data.");
return;
}
descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE); descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
gatt.writeDescriptor(descriptor); gatt.writeDescriptor(descriptor);
} }
@Override @Override
@@ -170,7 +177,7 @@ public abstract class BluetoothConnectionManager {
public static class CyclingCadence extends BluetoothConnectionManager { public static class CyclingCadence extends BluetoothConnectionManager {
CyclingCadence(SensorDataObserver observer) { CyclingCadence(SensorDataObserver observer) {
super(BluetoothUtils.CYCLING_SPEED_CADENCE_SERVICE_UUID, BluetoothUtils.CYCLING_SPPED_CADENCE_MEASUREMENT_CHAR_UUID, observer); super(BluetoothUtils.CYCLING_SPEED_CADENCE_SERVICE_UUID, BluetoothUtils.CYCLING_SPEED_CADENCE_MEASUREMENT_CHAR_UUID, observer);
} }
@Override @Override
@@ -201,7 +208,7 @@ public abstract class BluetoothConnectionManager {
public static class CyclingSpeed extends BluetoothConnectionManager { public static class CyclingSpeed extends BluetoothConnectionManager {
CyclingSpeed(SensorDataObserver observer) { CyclingSpeed(SensorDataObserver observer) {
super(BluetoothUtils.CYCLING_SPEED_CADENCE_SERVICE_UUID, BluetoothUtils.CYCLING_SPPED_CADENCE_MEASUREMENT_CHAR_UUID, observer); super(BluetoothUtils.CYCLING_SPEED_CADENCE_SERVICE_UUID, BluetoothUtils.CYCLING_SPEED_CADENCE_MEASUREMENT_CHAR_UUID, observer);
} }
@Override @Override
@@ -219,6 +226,25 @@ public abstract class BluetoothConnectionManager {
} }
} }
public static class CyclingPower extends BluetoothConnectionManager {
CyclingPower(@NonNull SensorDataObserver observer) {
super(BluetoothUtils.CYCLING_POWER_UUID, BluetoothUtils.CYCLING_POWER_MEASUREMENT_CHAR_UUID, observer);
}
@Override
protected SensorData createEmptySensorData(String address) {
return new SensorDataCyclingPower(address);
}
@Override
protected SensorDataCyclingPower parsePayload(String sensorName, String address, BluetoothGattCharacteristic characteristic) {
Integer cyclingPower = BluetoothUtils.parseCyclingPower(characteristic);
return cyclingPower != null ? new SensorDataCyclingPower(address, sensorName, cyclingPower) : null;
}
}
interface SensorDataObserver { interface SensorDataObserver {
void onChanged(SensorData sensorData); void onChanged(SensorData sensorData);
@@ -59,6 +59,7 @@ public class BluetoothRemoteSensorManager implements BluetoothConnectionManager.
private final BluetoothConnectionManager.HeartRate heartRate = new BluetoothConnectionManager.HeartRate(this); private final BluetoothConnectionManager.HeartRate heartRate = new BluetoothConnectionManager.HeartRate(this);
private final BluetoothConnectionManager.CyclingCadence cyclingCadence = new BluetoothConnectionManager.CyclingCadence(this); private final BluetoothConnectionManager.CyclingCadence cyclingCadence = new BluetoothConnectionManager.CyclingCadence(this);
private final BluetoothConnectionManager.CyclingSpeed cyclingSpeed = new BluetoothConnectionManager.CyclingSpeed(this); private final BluetoothConnectionManager.CyclingSpeed cyclingSpeed = new BluetoothConnectionManager.CyclingSpeed(this);
private final BluetoothConnectionManager.CyclingPower cyclingPower = new BluetoothConnectionManager.CyclingPower(this);
private final SensorDataSet sensorDataSet = new SensorDataSet(); private final SensorDataSet sensorDataSet = new SensorDataSet();
@@ -82,6 +83,12 @@ public class BluetoothRemoteSensorManager implements BluetoothConnectionManager.
connect(cyclingSpeed, address); connect(cyclingSpeed, address);
} }
if (PreferencesUtils.isKey(context, R.string.settings_sensor_bluetooth_cycling_power_key, key)) {
String address = PreferencesUtils.getBluetoothCyclingPowerSensorAddress(context);
connect(cyclingPower, address);
}
} }
}; };
@@ -102,6 +109,8 @@ public class BluetoothRemoteSensorManager implements BluetoothConnectionManager.
public synchronized void stop() { public synchronized void stop() {
heartRate.disconnect(); heartRate.disconnect();
cyclingCadence.disconnect(); cyclingCadence.disconnect();
cyclingSpeed.disconnect();
cyclingPower.disconnect();
sensorDataSet.clear(); sensorDataSet.clear();
@@ -20,6 +20,7 @@ import de.dennisguse.opentracks.R;
import de.dennisguse.opentracks.fragments.ChooseActivityTypeDialogFragment; import de.dennisguse.opentracks.fragments.ChooseActivityTypeDialogFragment;
import de.dennisguse.opentracks.io.file.TrackFileFormat; import de.dennisguse.opentracks.io.file.TrackFileFormat;
import de.dennisguse.opentracks.settings.bluetooth.BluetoothLeCyclingCadenceAndSpeedPreference; import de.dennisguse.opentracks.settings.bluetooth.BluetoothLeCyclingCadenceAndSpeedPreference;
import de.dennisguse.opentracks.settings.bluetooth.BluetoothLeCyclingPowerPreference;
import de.dennisguse.opentracks.settings.bluetooth.BluetoothLeHeartRatePreference; import de.dennisguse.opentracks.settings.bluetooth.BluetoothLeHeartRatePreference;
import de.dennisguse.opentracks.settings.bluetooth.BluetoothLeSensorPreference; import de.dennisguse.opentracks.settings.bluetooth.BluetoothLeSensorPreference;
import de.dennisguse.opentracks.util.ActivityUtils; import de.dennisguse.opentracks.util.ActivityUtils;
@@ -132,6 +133,8 @@ public class SettingsActivity extends AppCompatActivity implements ChooseActivit
dialogFragment = BluetoothLeSensorPreference.BluetoothLeSensorPreferenceDialog.newInstance(preference.getKey(), BluetoothUtils.HEART_RATE_SERVICE_UUID); dialogFragment = BluetoothLeSensorPreference.BluetoothLeSensorPreferenceDialog.newInstance(preference.getKey(), BluetoothUtils.HEART_RATE_SERVICE_UUID);
} else if (preference instanceof BluetoothLeCyclingCadenceAndSpeedPreference) { } else if (preference instanceof BluetoothLeCyclingCadenceAndSpeedPreference) {
dialogFragment = BluetoothLeSensorPreference.BluetoothLeSensorPreferenceDialog.newInstance(preference.getKey(), BluetoothUtils.CYCLING_SPEED_CADENCE_SERVICE_UUID); dialogFragment = BluetoothLeSensorPreference.BluetoothLeSensorPreferenceDialog.newInstance(preference.getKey(), BluetoothUtils.CYCLING_SPEED_CADENCE_SERVICE_UUID);
} else if (preference instanceof BluetoothLeCyclingPowerPreference) {
dialogFragment = BluetoothLeSensorPreference.BluetoothLeSensorPreferenceDialog.newInstance(preference.getKey(), BluetoothUtils.CYCLING_POWER_UUID);
} }
if (dialogFragment != null) { if (dialogFragment != null) {
@@ -0,0 +1,23 @@
package de.dennisguse.opentracks.settings.bluetooth;
import android.content.Context;
import android.util.AttributeSet;
public class BluetoothLeCyclingPowerPreference extends BluetoothLeSensorPreference {
public BluetoothLeCyclingPowerPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
public BluetoothLeCyclingPowerPreference(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public BluetoothLeCyclingPowerPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
public BluetoothLeCyclingPowerPreference(Context context) {
super(context);
}
}
@@ -39,8 +39,11 @@ public class BluetoothUtils {
public static final UUID HEART_RATE_SERVICE_UUID = new UUID(0x180D00001000L, 0x800000805f9b34fbL); public static final UUID HEART_RATE_SERVICE_UUID = new UUID(0x180D00001000L, 0x800000805f9b34fbL);
public static final UUID HEART_RATE_MEASUREMENT_CHAR_UUID = new UUID(0x2A3700001000L, 0x800000805f9b34fbL); public static final UUID HEART_RATE_MEASUREMENT_CHAR_UUID = new UUID(0x2A3700001000L, 0x800000805f9b34fbL);
public static final UUID CYCLING_POWER_UUID = new UUID(0x181800001000L, 0x800000805f9b34fbL);
public static final UUID CYCLING_POWER_MEASUREMENT_CHAR_UUID = new UUID(0x2A6300001000L, 0x800000805f9b34fbL);
public static final UUID CYCLING_SPEED_CADENCE_SERVICE_UUID = new UUID(0x181600001000L, 0x800000805f9b34fbL); public static final UUID CYCLING_SPEED_CADENCE_SERVICE_UUID = new UUID(0x181600001000L, 0x800000805f9b34fbL);
public static final UUID CYCLING_SPPED_CADENCE_MEASUREMENT_CHAR_UUID = new UUID(0x2A5B00001000L, 0x800000805f9b34fbL); public static final UUID CYCLING_SPEED_CADENCE_MEASUREMENT_CHAR_UUID = new UUID(0x2A5B00001000L, 0x800000805f9b34fbL);
private static final String TAG = BluetoothUtils.class.getSimpleName(); private static final String TAG = BluetoothUtils.class.getSimpleName();
@@ -62,7 +65,7 @@ public class BluetoothUtils {
} }
public static Integer parseHeartRate(BluetoothGattCharacteristic characteristic) { public static Integer parseHeartRate(BluetoothGattCharacteristic characteristic) {
//DOCUMENTATION https://www.bluetooth.com/specifications/gatt/characteristics/ //DOCUMENTATION https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Characteristics/org.bluetooth.characteristic.heart_rate_measurement.xml
byte[] raw = characteristic.getValue(); byte[] raw = characteristic.getValue();
if (raw.length == 0) { if (raw.length == 0) {
return null; return null;
@@ -79,10 +82,21 @@ public class BluetoothUtils {
return null; return null;
} }
public static Integer parseCyclingPower(BluetoothGattCharacteristic characteristic) {
// DOCUMENTATION https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Characteristics/org.bluetooth.characteristic.cycling_power_measurement.xml
int valueLength = characteristic.getValue().length;
if (valueLength < 4) {
return null;
}
return characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_SINT16, 2);
}
/** /**
* Documentation: https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=261449 * Documentation: https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=261449
*/ */
public static SensorDataCycling.CadenceAndSpeed parseCyclingCrankAndWheel(String address, String sensorName, @NonNull BluetoothGattCharacteristic characteristic) { public static SensorDataCycling.CadenceAndSpeed parseCyclingCrankAndWheel(String address, String sensorName, @NonNull BluetoothGattCharacteristic characteristic) {
// DOCUMENTATION https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Characteristics/org.bluetooth.characteristic.csc_measurement.xml
int valueLength = characteristic.getValue().length; int valueLength = characteristic.getValue().length;
if (valueLength == 0) { if (valueLength == 0) {
return null; return null;
@@ -262,6 +262,15 @@ public class PreferencesUtils {
return getInt(context, R.string.settings_sensor_bluetooth_cycling_speed_wheel_circumference_key, DEFAULT); return getInt(context, R.string.settings_sensor_bluetooth_cycling_speed_wheel_circumference_key, DEFAULT);
} }
public static boolean isBluetoothCyclingPowerSensorAddressNone(Context context) {
return isBluetoothSensorAddressNone(context, getBluetoothCyclingPowerSensorAddress(context));
}
public static String getBluetoothCyclingPowerSensorAddress(Context context) {
return getString(context, R.string.settings_sensor_bluetooth_cycling_power_key, getBluetoothSensorAddressNone(context));
}
public static boolean shouldShowStatsOnLockscreen(Context context) { public static boolean shouldShowStatsOnLockscreen(Context context) {
final boolean STATS_SHOW_ON_LOCKSCREEN_DEFAULT = context.getResources().getBoolean(R.bool.stats_show_on_lockscreen_while_recording_default); final boolean STATS_SHOW_ON_LOCKSCREEN_DEFAULT = context.getResources().getBoolean(R.bool.stats_show_on_lockscreen_while_recording_default);
return getBoolean(context, R.string.stats_show_on_lockscreen_while_recording_key, STATS_SHOW_ON_LOCKSCREEN_DEFAULT); return getBoolean(context, R.string.stats_show_on_lockscreen_while_recording_key, STATS_SHOW_ON_LOCKSCREEN_DEFAULT);
@@ -487,5 +487,47 @@
app:layout_constraintRight_toLeftOf="@+id/guideline3" app:layout_constraintRight_toLeftOf="@+id/guideline3"
app:layout_constraintTop_toBottomOf="@+id/stats_sensor_cadence_value" /> app:layout_constraintTop_toBottomOf="@+id/stats_sensor_cadence_value" />
<!-- Cycling Power -->
<androidx.constraintlayout.widget.Group
android:id="@+id/stats_sensor_power_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="stats_sensor_power_label,stats_sensor_power_sensor_value,stats_sensor_power_value,stats_sensor_power_unit" />
<TextView
android:id="@+id/stats_sensor_power_label"
style="@style/StatsLargeLabel"
android:text="@string/sensor_state_power"
app:layout_constrainedWidth="true"
app:layout_constraintLeft_toRightOf="@+id/guideline2"
app:layout_constraintRight_toLeftOf="@+id/guideline3"
app:layout_constraintTop_toBottomOf="@id/stats_sensor_horizontal_line" />
<TextView
android:id="@+id/stats_sensor_power_sensor_value"
style="@style/StatsTinyValue"
android:text="@string/value_unknown"
app:layout_constraintLeft_toRightOf="@+id/guideline2"
app:layout_constraintRight_toLeftOf="@+id/guideline3"
app:layout_constraintTop_toBottomOf="@+id/stats_sensor_power_label"
tools:text="90" />
<TextView
android:id="@+id/stats_sensor_power_value"
style="@style/StatsLargeValue"
android:value="@string/value_unknown"
app:layout_constraintLeft_toRightOf="@+id/guideline2"
app:layout_constraintRight_toLeftOf="@+id/guideline3"
app:layout_constraintTop_toBottomOf="@+id/stats_sensor_power_sensor_value"
tools:text="90" />
<TextView
android:id="@+id/stats_sensor_power_unit"
style="@style/StatsUnit"
android:text="@string/sensor_unit_power"
app:layout_constraintLeft_toRightOf="@+id/guideline2"
app:layout_constraintRight_toLeftOf="@+id/guideline3"
app:layout_constraintTop_toBottomOf="@+id/stats_sensor_power_value" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView> </ScrollView>
+2 -2
View File
@@ -22,10 +22,10 @@ limitations under the License.
<color name="chart_heart_rate_fill">#40E88A70</color> <!-- transparent red --> <color name="chart_heart_rate_fill">#40E88A70</color> <!-- transparent red -->
<color name="chart_pace_border">#FF0066FF</color> <!-- blue --> <color name="chart_pace_border">#FF0066FF</color> <!-- blue -->
<color name="chart_pace_fill">#40C8E0FF</color> <!-- transparent blue --> <color name="chart_pace_fill">#40C8E0FF</color> <!-- transparent blue -->
<color name="chart_power_border">#FF401465</color> <!-- purple -->
<color name="chart_power_fill">#40401465</color> <!-- transparent purple -->
<color name="chart_speed_border">#FF0066FF</color> <!-- blue --> <color name="chart_speed_border">#FF0066FF</color> <!-- blue -->
<color name="chart_speed_fill">#40C8E0FF</color> <!-- transparent blue --> <color name="chart_speed_fill">#40C8E0FF</color> <!-- transparent blue -->
<color name="chart_power_border">#FF7A26C0</color> <!-- purple -->
<color name="chart_power_fill">#407A26C0</color> <!-- transparent purple -->
<color name="colorAccent">@android:color/holo_orange_dark</color> <color name="colorAccent">@android:color/holo_orange_dark</color>
<color name="colorAccentTransparent">#55FF8800</color> <color name="colorAccentTransparent">#55FF8800</color>
+1
View File
@@ -26,6 +26,7 @@ limitations under the License.
<string name="sensor_unit_beats_per_minute" translatable="false">BPM</string> <string name="sensor_unit_beats_per_minute" translatable="false">BPM</string>
<string name="sensor_unit_rounds_per_minute" translatable="false">RPM</string> <string name="sensor_unit_rounds_per_minute" translatable="false">RPM</string>
<string name="sensor_unit_power" translatable="false">W</string>
<string name="value_unknown" translatable="false">-</string> <string name="value_unknown" translatable="false">-</string>
+1
View File
@@ -21,6 +21,7 @@
<string name="settings_sensor_bluetooth_heart_rate_key" translatable="false">bluetoothSensor</string> <string name="settings_sensor_bluetooth_heart_rate_key" translatable="false">bluetoothSensor</string>
<string name="settings_sensor_bluetooth_cycling_cadence_key" translatable="false">bluetoothCyclingCadenceSensor</string> <string name="settings_sensor_bluetooth_cycling_cadence_key" translatable="false">bluetoothCyclingCadenceSensor</string>
<string name="settings_sensor_bluetooth_cycling_speed_key" translatable="false">bluetoothCyclingSpeedSensor</string> <string name="settings_sensor_bluetooth_cycling_speed_key" translatable="false">bluetoothCyclingSpeedSensor</string>
<string name="settings_sensor_bluetooth_cycling_power_key" translatable="false">bluetoothCyclingPowerSensor</string>
<string name="sensor_type_value_none" translatable="false">NONE</string> <string name="sensor_type_value_none" translatable="false">NONE</string>
<string name="settings_sensor_bluetooth_cycling_speed_wheel_circumference_key" translatable="false">bluetoothCyclingSpeedWheelCircumference</string> <string name="settings_sensor_bluetooth_cycling_speed_wheel_circumference_key" translatable="false">bluetoothCyclingSpeedWheelCircumference</string>
+4
View File
@@ -131,6 +131,10 @@ limitations under the License.
android:defaultValue="@string/sensor_type_value_none" android:defaultValue="@string/sensor_type_value_none"
android:key="@string/settings_sensor_bluetooth_cycling_cadence_key" android:key="@string/settings_sensor_bluetooth_cycling_cadence_key"
android:title="@string/sensor_state_cadence" /> android:title="@string/sensor_state_cadence" />
<de.dennisguse.opentracks.settings.bluetooth.BluetoothLeCyclingPowerPreference
android:defaultValue="@string/sensor_type_value_none"
android:key="@string/settings_sensor_bluetooth_cycling_power_key"
android:title="@string/sensor_state_power" />
<de.dennisguse.opentracks.settings.bluetooth.BluetoothLeCyclingCadenceAndSpeedPreference <de.dennisguse.opentracks.settings.bluetooth.BluetoothLeCyclingCadenceAndSpeedPreference
android:defaultValue="@string/sensor_type_value_none" android:defaultValue="@string/sensor_type_value_none"
android:key="@string/settings_sensor_bluetooth_cycling_speed_key" android:key="@string/settings_sensor_bluetooth_cycling_speed_key"