Browse Source

自动识别锅类型

wbspool 1 year ago
parent
commit
99cbc4bf1e

+ 58 - 0
BusinessAirFryer/src/main/assets/config.json

@@ -63,6 +63,64 @@
       "icon": "ic_grid_turbo",
       "devMode": "SOUP"
     },
+
+    {
+      "type": "COOK_EGGS",
+      "name": "cook_eggs",
+      "bg": "cm_icon_cook_eggs",
+      "icon": "cm_icon_cook_eggs",
+      "devMode": "SOUP"
+    },
+
+    {
+      "type": "COOK_RICE",
+      "name": "cook_rice",
+      "bg": "cm_icon_cook_rice",
+      "icon": "cm_icon_cook_rice",
+      "devMode": "SOUP"
+    },
+    {
+      "type": "MULSIFY",
+      "name": "mulsify",
+      "bg": "cm_icon_mulsify",
+      "icon": "cm_icon_mulsify",
+      "devMode": "SOUP"
+    }, {
+      "type": "PUREE",
+      "name": "puree",
+      "bg": "cm_icon_puree",
+      "icon": "cm_icon_puree",
+      "devMode": "SOUP"
+    },
+    {
+      "type": "ROAST",
+      "name": "roast",
+      "bg": "cm_icon_roast",
+      "icon": "cm_icon_roast",
+      "devMode": "SOUP"
+    },
+    {
+      "type": "SMOOTHIE",
+      "name": "smoothie",
+      "bg": "cm_icon_smoothie",
+      "icon": "cm_icon_smoothie",
+      "devMode": "SOUP"
+    },
+    {
+      "type": "SOVS_VIDE",
+      "name": "sovs_vide",
+      "bg": "cm_icon_sovs_vide",
+      "icon": "cm_icon_sovs_vide",
+      "devMode": "SOUP"
+    },
+    {
+      "type": "AUTO_CLEAN",
+      "name": "auto_clean",
+      "bg": "cm_icon_auto_clean",
+      "icon": "cm_icon_auto_clean",
+      "devMode": "SOUP"
+    },
+
     {
       "type": "AIR_FRYER",
       "name": "air_fryer",

+ 5 - 1
BusinessAirFryer/src/main/java/com/develop/airfryer/ui/DevModeView.kt

@@ -7,6 +7,7 @@ import android.view.LayoutInflater
 import android.view.View
 import androidx.constraintlayout.widget.ConstraintLayout
 import com.blankj.utilcode.util.ActivityUtils.startActivity
+import com.blankj.utilcode.util.AppUtils
 import com.develop.airfryer.databinding.DevModeViewBinding
 import com.kuyuntech.cofarcooking.device.sdk.constant.core.CommonEventTypes
 import com.kuyuntech.cofarcooking.device.sdk.constant.core.DevModes
@@ -21,10 +22,13 @@ class DevModeView(context: Context, attrs: AttributeSet) : ConstraintLayout(cont
    private val binding: DevModeViewBinding
 
    init {
-      binding = DevModeViewBinding.inflate(LayoutInflater.from(context), this, true)
+       binding = DevModeViewBinding.inflate(LayoutInflater.from(context), this, true)
        setupClickListener()
        CofarSDK.register(this)
        updateUI()
+       if(!AppUtils.getAppVersionName().split(".")[0].startsWith("5")){
+           this.visibility = GONE
+       }
    }
 
     override fun onDetachedFromWindow() {

BIN
BusinessAirFryer/src/main/res/drawable/cm_icon_cook_eggs.png


BIN
BusinessAirFryer/src/main/res/drawable/cm_icon_cook_rice.png


BIN
BusinessAirFryer/src/main/res/drawable/cm_icon_mulsify.png


BIN
BusinessAirFryer/src/main/res/drawable/cm_icon_puree.png


BIN
BusinessAirFryer/src/main/res/drawable/cm_icon_roast.png


BIN
BusinessAirFryer/src/main/res/drawable/cm_icon_smoothie.png


BIN
BusinessAirFryer/src/main/res/drawable/cm_icon_sovs_vide.png


+ 11 - 0
BusinessCommon/src/main/res/values/strings.xml

@@ -250,4 +250,15 @@ Nanfang plus client is an online information platform developed and operated by
     <string name="error_pot_clover_tips">The current cooking mode is not consistent with the type of pot cover. Do you want to switch to the corresponding cooking mode?</string>
 
 
+
+    <string name="cook_eggs">COOK EGGS</string>
+    <string name="cook_rice">COOK RICE</string>
+    <string name="mulsify">MULSIFY</string>
+    <string name="puree">PUREE</string>
+    <string name="roast">ROAST</string>
+    <string name="smoothie">SMOOTHIE</string>
+    <string name="sovs_vide">SOVS VIDE</string>
+    <string name="auto_clean">AUTO CLEAN</string>
+
+
 </resources>

+ 52 - 11
BusinessStep/src/main/java/com/develop/step/ui/ModesDetailActivity.kt

@@ -1,6 +1,7 @@
 package com.develop.step.ui
 
 import android.annotation.SuppressLint
+import android.graphics.BitmapFactory
 import android.os.Bundle
 import android.util.Log
 import android.view.KeyEvent
@@ -9,6 +10,7 @@ import android.view.KeyEvent.ACTION_UP
 import android.view.LayoutInflater
 import android.view.MotionEvent
 import android.view.View
+import android.widget.ImageView
 import com.alibaba.android.arouter.facade.annotation.Route
 import com.develop.base.util.ThreadUtils
 import com.develop.common.data_repo.db.ModesType
@@ -113,7 +115,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
             binding.clCookDirection.visibility = View.VISIBLE;
             binding.clCookSpeed.visibility = View.VISIBLE;
             binding.clCookWater.visibility = View.GONE
-            binding.ivTurbo.visibility = View.VISIBLE
+          //  binding.ivTurbo.visibility = View.VISIBLE
 
         }
 
@@ -370,8 +372,22 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
                 }
             }
 
-            if (CommonEventTypes.MOTOR_GEAR_RATHER_THEN_3_WITH_TEMP == event.type || CommonEventTypes.MOTOR_REVERSE_CAN_NOT_RATHER_THEN_3 == event.type) {
-                CofarSDK.cfgMotorGear(3);
+            if (CommonEventTypes.MAX_MOTOR_GEAR_RATHER_THEN_WITH_TEMP == event.type ) {
+                CofarSDK.cfgMotorGear(CofarSDK.devInfo().mode.maxMotorWithTemp.toByte())
+                currDevInfo.mode.apply {
+                    updateMotorGearUI(
+                        minMotorGear.toFloat(),
+                        maxMotorGear.toFloat(),
+                        CofarSDK.devInfo().mode.maxMotorWithTemp,
+                        isMotorGearChange
+                    )
+                }
+            }
+
+
+
+            if ( CommonEventTypes.MOTOR_REVERSE_CAN_NOT_RATHER_THEN_3 == event.type) {
+                CofarSDK.cfgMotorGear(3)
                 currDevInfo.mode.apply {
                     updateMotorGearUI(
                         minMotorGear.toFloat(),
@@ -435,7 +451,8 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
                     isWaterGearChange
                 )
 
-                updateMotorDirectionUI(currDevInfo.motorDirection.toInt(), isMotorDirectionChange)
+                updateMotorDirectionUI(if(currDevInfo.motorDirectionBuffer.toInt() == -1) currDevInfo.motorDirection.toInt() else currDevInfo.motorDirectionBuffer.toInt(), isMotorDirectionChange)
+
                 updateWeightUI(currDevInfo.weight.toFloat())
             }
         }
@@ -447,7 +464,19 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
     private fun initData() {
         var workMode = ConfigUtils.getMode(modeType)
         binding.tvModeName.text = getString(resources.getIdentifier(workMode?.name,"string",this.packageName))
-        binding.ivBanner.setBackgroundResource(resources.getIdentifier(workMode?.bg,"drawable",this.packageName))
+        binding.ivBanner.setImageResource(resources.getIdentifier(workMode?.bg,"drawable",this.packageName))
+//        // 获取ImageView的宽度和高度
+//        val imageViewWidth = binding.ivBanner.width
+//        val imageViewHeight = binding.ivBanner.height
+//
+//        // 设置ImageView的尺寸和scaleType属性
+//        binding.ivBanner.layoutParams.width = imageViewWidth
+//        binding.ivBanner.layoutParams.height = imageViewHeight
+//        binding.ivBanner.scaleType = ImageView.ScaleType.FIT_CENTER
+//
+//        // 设置ImageView的图片
+//        val bitmap = BitmapFactory.decodeResource(resources, resources.getIdentifier(workMode?.bg,"drawable",this.packageName))
+//        binding.ivBanner.setImageBitmap(bitmap)
         //点击切换的模式来显示对应的UI
         viewModel.currentStep.observe(this) {
             if (it == null) {
@@ -1121,6 +1150,11 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
     private fun updateMotorGearUI(
         minMotorGear: Float, maxMotorGear: Float, currentMotorGer: Int, isMotorGearChange: Boolean,focusUpdate: Boolean = false
     ) {
+
+        if(CofarSDK.devInfo().devMode != DevModes.SOUP){
+            return
+        }
+
         this.minMotorGear = minMotorGear.toInt()
         this.maxMotorGear = maxMotorGear.toInt()
         this.isMotorGearChange = isMotorGearChange
@@ -1128,7 +1162,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
             clCookSpeed.updateChangeValue(currentMotorGer.toString())
             speedRingView.setRange(minMotorGear, maxMotorGear)
             speedRingView.setCanTouch(isMotorGearChange)
-            if (!userChanging) {
+            if (!userChanging || focusUpdate) {
                 speedRingView.updateProgress(currentMotorGer)
                 speedRingText.text = currentMotorGer.toString()
             }
@@ -1147,6 +1181,10 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
         minWaterGear: Float, maxWaterGear: Float, currentMotorGer: Int, isWaterGearChange: Boolean,focusUpdate: Boolean = false
     ) {
 
+        if(CofarSDK.devInfo().devMode != DevModes.AIR_FRYER){
+             return
+        }
+
         this.minWaterGear = minWaterGear.toInt()
         this.maxWaterGear = maxWaterGear.toInt()
         this.isWaterGearChange = isWaterGearChange
@@ -1259,9 +1297,9 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
         if (currDevInfo.status.toByte() != DevStatus.STOP) {
             binding.btnCancel.visibility = View.VISIBLE
             binding.btnConfirm.visibility = View.VISIBLE
-            binding.btnStop.visibility = View.INVISIBLE
-            binding.btnPause.visibility = View.INVISIBLE
-            binding.btnResume.visibility = View.INVISIBLE
+            binding.btnStop.visibility = View.GONE
+            binding.btnPause.visibility = View.GONE
+            binding.btnResume.visibility = View.GONE
         }
     }
 
@@ -1450,7 +1488,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
      * 点击电机方向事件
      */
     private fun motorGearDirectionClick(direction: DirectionView.Direction) {
-        userChanging = false
+        userChanging = true
         binding.clCookDirection.updateChangeValue(
             viewModel.getDirectionStr(
                 direction == DirectionView.Direction.LEFT, resources
@@ -1458,11 +1496,14 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
         )
         if (direction != DirectionView.Direction.RIGHT) {
             CofarSDK.cfgMotorDirection(MotorDirections.REVERSE);
+            updateMotorDirectionUI(MotorDirections.REVERSE.toInt(), true);
+
 
         } else {
             CofarSDK.cfgMotorDirection(MotorDirections.FORWARD);
+            updateMotorDirectionUI(MotorDirections.FORWARD.toInt(), true);
+
         }
-        updateMotorDirectionUI(currDevInfo.motorDirection.toInt(), true);
 
         showConfirmAndCancelBtn()
     }

+ 1 - 0
BusinessStep/src/main/res/layout/activity_mode_detail.xml

@@ -7,6 +7,7 @@
 
 
     <ImageView
+       android:scaleType="centerCrop"
         android:id="@+id/iv_banner"
         android:layout_width="match_parent"
         android:layout_height="match_parent" />

+ 2 - 2
app/build.gradle

@@ -7,10 +7,10 @@ plugins {
 
 
 ext{
-    versionCode=230407200
+    versionCode=230424180
     brandCode="010A"
     brandVersionCode=versionCode
-    model="5037"
+    model="1037"
 }
 
 

BIN
libThirdPart/libs/cofar-cooking-device-sdk-0.0.1-SNAPSHOT.jar