Commit 219d0177 authored by tongzifang's avatar tongzifang

负数 优化

parent fdd59633
...@@ -30,7 +30,7 @@ android { ...@@ -30,7 +30,7 @@ android {
} }
} }
group 'com.qmai.android.zqtoolkit' group 'com.qmai.android.zqtoolkit'
version '1.2.8' version '1.2.8.1'
gradlePublish { gradlePublish {
......
...@@ -13,6 +13,7 @@ import kotlinx.coroutines.GlobalScope ...@@ -13,6 +13,7 @@ import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import java.math.BigDecimal
/** /**
* tongzi * tongzi
...@@ -77,6 +78,9 @@ abstract class ScaleBaseKit : ScaleBaseAction, ScaleUpdateAction { ...@@ -77,6 +78,9 @@ abstract class ScaleBaseKit : ScaleBaseAction, ScaleUpdateAction {
//稳定状态且读数正常 //稳定状态且读数正常
if (weight.isStable && !weight.isReadErr) { if (weight.isStable && !weight.isReadErr) {
readErrCache.clear() readErrCache.clear()
if (BigDecimal(weight.weight) < BigDecimal.ZERO) {
_livingWeight.emit(weight)
} else {
when { when {
stableWeight.size == STABLE_COUNT -> { stableWeight.size == STABLE_COUNT -> {
var single = stableWeight.distinctBy { it.weight } var single = stableWeight.distinctBy { it.weight }
...@@ -95,6 +99,7 @@ abstract class ScaleBaseKit : ScaleBaseAction, ScaleUpdateAction { ...@@ -95,6 +99,7 @@ abstract class ScaleBaseKit : ScaleBaseAction, ScaleUpdateAction {
} }
else -> stableWeight.add(weight) else -> stableWeight.add(weight)
} }
}
} else { } else {
_livingWeight.emit(weight) _livingWeight.emit(weight)
if (weight.isReadErr) if (weight.isReadErr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment