修改菜品识别逻辑

This commit is contained in:
mazengfei
2025-11-04 15:46:40 +08:00
parent 9c60049843
commit cd883af92f
4 changed files with 34 additions and 15 deletions
@@ -74,8 +74,9 @@ class SecondaryScreenPresentation(
private lateinit var itemUserNutritionBinding: ItemUserNutritionBinding
private lateinit var stepChangeCallback: (Int) -> Unit
// 上一次的计算热量结果
private var lastWeight = 0.0
private var detectWeight = 0.0 //识别菜品时的重量
private var lastWeight = 0.0 // 上一次的计算热量结果
private val debouncer = Debouncer(500)
private var recognitionTime: Long = 0L // 人脸识别时的时间
private var recognitionWeight: Double = 0.0 // 人脸识别时的重量
@@ -288,6 +289,10 @@ class SecondaryScreenPresentation(
calculateNutrition(recognitionWeight - lastWeight)
}
fun updateDetectWeight(weight: Double) {
detectWeight = weight * 1000 // 将千克转成克
}
/**
* 余量取餐
*/