diff --git a/datalogger/src/main/java/org/obd/graphs/bl/collector/CarMetric.kt b/datalogger/src/main/java/org/obd/graphs/bl/collector/CarMetric.kt index ed3b0eb7..abb1aa79 100644 --- a/datalogger/src/main/java/org/obd/graphs/bl/collector/CarMetric.kt +++ b/datalogger/src/main/java/org/obd/graphs/bl/collector/CarMetric.kt @@ -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) } diff --git a/giulia_renderer/src/main/java/org/obd/graphs/renderer/DrawingManager.kt b/giulia_renderer/src/main/java/org/obd/graphs/renderer/DrawingManager.kt index ab28da9b..3934c2a5 100644 --- a/giulia_renderer/src/main/java/org/obd/graphs/renderer/DrawingManager.kt +++ b/giulia_renderer/src/main/java/org/obd/graphs/renderer/DrawingManager.kt @@ -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 )