Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/src/main/java/com/cooper/wheellog/AppConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,10 @@ class AppConfig(var context: Context): KoinComponent {
get() = getSpecific(R.string.profile_name, "")
set(value) = setSpecific(R.string.profile_name, value)

var speedScaling: Float
get() = getSpecific(R.string.speed_scaling, 1f)
set(value) = setSpecific(R.string.speed_scaling, value)

var batteryCapacity: Int
get() = getSpecific(R.string.battery_capacity, 0)
set(value) = setSpecific(R.string.battery_capacity, value)
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/com/cooper/wheellog/WheelData.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public boolean isWheelIsReady() {
}

public int getSpeed() {
return (int) Math.round(mSpeed / 10.0);
return (int) Math.round(mSpeed / 10.0 * appConfig.getSpeedScaling());
}

public void setSpeed(int speed) {
Expand Down Expand Up @@ -765,7 +765,7 @@ String getRidingTimeString() {
}

public double getSpeedDouble() {
return mSpeed / 100.0;
return mSpeed / 100.0 * appConfig.getSpeedScaling();
}

public double getVoltageDouble() {
Expand Down Expand Up @@ -865,11 +865,11 @@ public double getMaxPwm() {
}

public int getTopSpeed() {
return mTopSpeed;
return Math.round(mTopSpeed * appConfig.getSpeedScaling());
}

public double getTopSpeedDouble() {
return mTopSpeed / 100.0;
return mTopSpeed / 100.0 * appConfig.getSpeedScaling();
}

int getDistance() {
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/com/cooper/wheellog/settings/WheelScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,16 @@ private fun veteran(appConfig: AppConfig = koinInject()) {

@Composable
private fun forAllWheel(appConfig: AppConfig = koinInject()) {
sliderPref(
name = stringResource(R.string.speed_scaling_title),
desc = stringResource(R.string.speed_scaling_description),
position = appConfig.speedScaling.toFloat(),
min = 0.8f,
max = 1.20f,
format = "%.3f",
) {
appConfig.speedScaling = it.toFloat()
}
sliderPref(
name = stringResource(R.string.battery_capacity_title),
desc = stringResource(R.string.battery_capacity_description),
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/constants.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
<string name="connection_sound" translatable="false">connection_sound</string>
<string name="no_connection_sound" translatable="false">no_connection_sound</string>
<string name="use_stop_music" translatable="false">use_stop_music</string>
<string name="speed_scaling" translatable="false">speed_scaling</string>
<string name="battery_capacity" translatable="false">battery_capacity</string>
<string name="charging_power" translatable="false">charging_power</string>
<string name="show_unknown_devices" translatable="false">show_unknown_devices</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@
<string name="no_connection_sound_description">Period of beeps when connection lost, 0sec - no beeps</string>
<string name="use_stop_music_title">Auto mute</string>
<string name="use_stop_music_description">Auto mute at speeds below 3.5 km/h</string>
<string name="speed_scaling_title">Speed scaling</string>
<string name="speed_scaling_description">Scale the speed output from the wheel</string>
<string name="battery_capacity_title">Battery capacity</string>
<string name="battery_capacity_description">Battery Capacity in Wh</string>
<string name="charging_power_title">Charging power</string>
Expand Down
Loading