修改熟重和菜品称重位置,菜品构成删除未生效问题优化

This commit is contained in:
2025-09-05 09:54:38 +08:00
parent 03d3785e2b
commit 8c6d1bae99
11 changed files with 271 additions and 246 deletions
@@ -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) {