修改熟重和菜品称重位置,菜品构成删除未生效问题优化
This commit is contained in:
+4
-1
@@ -2,7 +2,10 @@ package com.shuwei.dish.match.utils
|
||||
|
||||
import android.util.SparseIntArray
|
||||
|
||||
object DataUtil {
|
||||
object AddressUtil {
|
||||
|
||||
const val ONE = 1
|
||||
const val TWO = 2
|
||||
|
||||
fun getWeighAddressArray(): SparseIntArray {
|
||||
return SparseIntArray().apply {
|
||||
@@ -12,7 +12,7 @@ import com.wabon.wbintelligenthardwaresdk.api.SensorScale
|
||||
|
||||
object WeightUtil {
|
||||
|
||||
val weightArray = SparseIntArray()
|
||||
// val weightArray = SparseIntArray()
|
||||
|
||||
fun connect(initCallback: (connect: Boolean) -> Unit) {
|
||||
Weigher.setListener(object : WeightListenerImpl() {
|
||||
@@ -34,17 +34,17 @@ object WeightUtil {
|
||||
}
|
||||
|
||||
override fun onGetWeight(address: Int, state: Int, weight: Int) {
|
||||
runOnUiThread {
|
||||
val stateStr = when (state) {
|
||||
SensorScale.STATE_STABLE -> "稳定"
|
||||
SensorScale.STATE_UNSTABLE -> "不稳定"
|
||||
SensorScale.STATE_OVER_WEIGHT -> "量程溢出"
|
||||
else -> ""
|
||||
}
|
||||
val result1 = String.format("$stateStr 重量:%s kg", weight / 1000f)
|
||||
//Log.d("WeightUtil", "ttlReturn, address:$address,$result1")
|
||||
weightArray.put(address, weight)
|
||||
}
|
||||
// runOnUiThread {
|
||||
// val stateStr = when (state) {
|
||||
// SensorScale.STATE_STABLE -> "稳定"
|
||||
// SensorScale.STATE_UNSTABLE -> "不稳定"
|
||||
// SensorScale.STATE_OVER_WEIGHT -> "量程溢出"
|
||||
// else -> ""
|
||||
// }
|
||||
// val result1 = String.format("$stateStr 重量:%s kg", weight / 1000f)
|
||||
// //Log.d("WeightUtil", "ttlReturn, address:$address,$result1")
|
||||
// weightArray.put(address, weight)
|
||||
// }
|
||||
}
|
||||
|
||||
override fun onReadIdentify(rate: Int) {
|
||||
|
||||
Reference in New Issue
Block a user