修改菜品识别逻辑
This commit is contained in:
@@ -210,9 +210,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
Timber.d("registerDataChange weight = $weight")
|
||||
presentation?.updateWeight(weight)
|
||||
|
||||
// if (weight <= 0.005) {//检测到秤上没有东西,重新启动识别菜品
|
||||
// isRecognitionFood = true
|
||||
// }
|
||||
if (weight <= 0.005 && presentation?.mealPickupMode == 1) {//余量取餐,检测到秤上没有东西,重新启动识别菜品
|
||||
isRecognitionFood = true
|
||||
}
|
||||
|
||||
if (weight - lastWeight > 0.05 && isRecognitionFood) { // 大于50g
|
||||
if (presentation?.mealPickupMode == 1) {
|
||||
isRecognitionFood = false
|
||||
|
||||
@@ -797,12 +797,18 @@ class SecondaryScreenPresentation(
|
||||
Timber.d("postUserData userNutritionData = ${userNutritionData == null}, currentFood = ${currentFood == null}")
|
||||
return
|
||||
}
|
||||
var eatWeight = 0.0
|
||||
if (mealPickupMode == 0) {//即放即取
|
||||
eatWeight = recognitionWeight - 0
|
||||
} else {
|
||||
eatWeight = recognitionWeight - lastWeight
|
||||
}
|
||||
val userNutritionParam = UserNutritionParam(
|
||||
userId = userNutritionData?.userId!!,
|
||||
foodId = currentFood?.id!!,
|
||||
faceTime = recognitionTime,
|
||||
faceEndTime = System.currentTimeMillis(),
|
||||
eatWeight = recognitionWeight - lastWeight,
|
||||
eatWeight = eatWeight,//lastWeight
|
||||
foodWeight = lastWeight
|
||||
)
|
||||
viewModel.postUserNutritionData(listOf<UserNutritionParam>(userNutritionParam))
|
||||
|
||||
Reference in New Issue
Block a user