This commit is contained in:
mazengfei
2026-03-30 18:03:01 +08:00
parent 5c230e38c3
commit ee9f27bb9c
3 changed files with 34 additions and 14 deletions
@@ -295,6 +295,8 @@ class MainScreenPresentation(
}
}
private var isGoRecognize = true
/**
* 显示识别出的菜品信息
*/
@@ -316,6 +318,7 @@ class MainScreenPresentation(
//独立支队
loadUserNutritionData(userId)
}
step3Debouncer.reset()
}
}
@@ -702,7 +705,7 @@ class MainScreenPresentation(
private var lastAddWeight = 0
private fun addFoodToOrder(weight: Int, foodInfo: FoodInfo) {
Log.d(TAG, "addFoodToOrder: ${weight == lastAddWeight}")
if (weight == lastAddWeight) return
// if (weight == lastAddWeight) return
lastAddWeight = weight
if (weight <= 10) {
//0-即放即取,1-余量计量
@@ -922,9 +925,15 @@ class MainScreenPresentation(
Timber.tag(TAG).d("resumeCamera isRecognition = $isRecognition")
isRecognition = true
if (rgbCameraHelper == null) {
Timber.tag(TAG).d("resumeCamera isRecognition ---1")
setupArcCamera()
rgbCameraHelper!!.start()
binding.root.postDelayed({
if (rgbCameraHelper != null) {
rgbCameraHelper!!.start()
}
}, 2000)
} else if (rgbCameraHelper!!.isStopped) {
Timber.tag(TAG).d("resumeCamera isRecognition ---2")
rgbCameraHelper!!.start()
}
}
@@ -1000,9 +1009,12 @@ class MainScreenPresentation(
activity,
Observer { compareResult: CompareResult ->
if (currentStep != 2 || System.currentTimeMillis() - recognizeTime <= 2000) {
//忽略非识别中及秒内的再次识别
//忽略非识别中及5秒内的再次识别
return@Observer
}
// if (isGoRecognize.not()) {
// return@Observer
// }
recognizeTime = System.currentTimeMillis()
activity.runOnUiThread {
activity.showWaitingDialog("加载中,请稍后……")