Skip to content

Commit

Permalink
fix: Fix issue with progress bar rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
tzebrowski committed Aug 21, 2023
1 parent 6025424 commit 1d11f7c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import org.obd.metrics.pid.ValueType

data class CarMetric(
var source: ObdMetric,
var value: Number,
var value: Number?,
var min: Double,
var max: Double,
var mean: Double,
var enabled: Boolean = true
) {
companion object {
fun newInstance(source: ObdMetric, value: Number = 0, min: Double = 0.0, max: Double = 0.0, mean: Double = 0.0)
fun newInstance(source: ObdMetric, value: Number, min: Double = 0.0, max: Double = 0.0, mean: Double = 0.0)
= CarMetric(source, value = value, min = min, max = max, mean = mean, enabled = true)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ internal class DrawingManager(context: Context, private val settings: ScreenSet
paint.color = color

val progress = valueScaler.scaleToNewRange(
it.value.toFloat(),
it.source.value?.toFloat()?:it.source.command.pid.min.toFloat(),
it.source.command.pid.min.toFloat(), it.source.command.pid.max.toFloat(), start, start + width - MARGIN_END
)

Expand Down

0 comments on commit 1d11f7c

Please sign in to comment.