diff --git a/OsmAnd-shared/src/commonMain/kotlin/net/osmand/shared/obd/OBDDataComputer.kt b/OsmAnd-shared/src/commonMain/kotlin/net/osmand/shared/obd/OBDDataComputer.kt index e31b356a1b8..02e942f2a09 100644 --- a/OsmAnd-shared/src/commonMain/kotlin/net/osmand/shared/obd/OBDDataComputer.kt +++ b/OsmAnd-shared/src/commonMain/kotlin/net/osmand/shared/obd/OBDDataComputer.kt @@ -101,9 +101,9 @@ object OBDDataComputer { FUEL_LEFT_DISTANCE(true, listOf(OBD_FUEL_LEVEL_COMMAND), { data -> OBDValue(OBD_FUEL_LEVEL_COMMAND, data) }), - FUEL_LEFT_LITERS(false, - listOf(OBD_FUEL_LEVEL_COMMAND), - { data -> OBDValue(OBD_FUEL_LEVEL_COMMAND, data) }), +// FUEL_LEFT_LITERS(false, +// listOf(OBD_FUEL_LEVEL_COMMAND), +// { data -> OBDValue(OBD_FUEL_LEVEL_COMMAND, data) }), FUEL_LEFT_PERCENT(false, listOf(OBD_FUEL_LEVEL_COMMAND), { data -> OBDValue(OBD_FUEL_LEVEL_COMMAND, data) }), @@ -231,7 +231,7 @@ object OBDDataComputer { null } - FUEL_LEFT_LITERS, +// FUEL_LEFT_LITERS, FUEL_LEFT_PERCENT -> { if (locValues.size > 0) { locValues[locValues.size - 1].doubleValue diff --git a/OsmAnd-shared/src/commonMain/kotlin/net/osmand/shared/obd/OBDDispatcher.kt b/OsmAnd-shared/src/commonMain/kotlin/net/osmand/shared/obd/OBDDispatcher.kt index 1db5df88e74..0ec4bb8d2c5 100644 --- a/OsmAnd-shared/src/commonMain/kotlin/net/osmand/shared/obd/OBDDispatcher.kt +++ b/OsmAnd-shared/src/commonMain/kotlin/net/osmand/shared/obd/OBDDispatcher.kt @@ -141,11 +141,17 @@ object OBDDispatcher { readStatusListener = listener } - fun setReadWriteStreams(readStream: Source, writeStream: Sink) { + fun setReadWriteStreams(readStream: Source?, writeStream: Sink?) { scope?.cancel() inputStream = readStream outputStream = writeStream - startReadObdLooper() + if(readStream != null && writeStream != null) { + startReadObdLooper() + } + } + + fun stopReading() { + setReadWriteStreams(null, null) } private fun consumeResponse(command: OBDCommand, result: String) { diff --git a/OsmAnd/res/layout/fragment_obd_main.xml b/OsmAnd/res/layout/fragment_obd_main.xml index becb38e24b8..20e47cbfd34 100644 --- a/OsmAnd/res/layout/fragment_obd_main.xml +++ b/OsmAnd/res/layout/fragment_obd_main.xml @@ -1,286 +1,238 @@ - - - - - - - - + android:layout_height="@dimen/toolbar_height" /> - + android:layout_height="60dp" + android:orientation="horizontal"> + + - + + + + android:layout_height="60dp" + android:orientation="horizontal" + android:visibility="gone"> + -