Browse Source

030A 涂鸦修改

zhangshenjie 1 week ago
parent
commit
4adb5f2eb8

+ 80 - 0
BusinessAirFryer/src/main/assets/config_030.json

@@ -73,6 +73,86 @@
       "devMode": "SOUP",
       "listShow": true
     },
+
+
+    {
+      "type": "SMOOTHIE",
+      "name": "smoothie",
+      "bg": "ic_a_smoothie_bg",
+      "icon": "ic_a_smoothie",
+      "devMode": "SOUP",
+      "listShow": false
+    },
+    {
+      "type": "AUTO_CLEAN",
+      "name": "auto_clean",
+      "bg": "ic_a_auto_clean_bg",
+      "icon": "ic_a_auto_clean",
+      "devMode": "SOUP",
+      "listShow": false
+    },
+
+
+
+    {
+      "type": "DICING",
+      "name": "dicing",
+      "bg": "ic_a_dicing_bg",
+      "icon": "ic_a_dicing",
+      "devMode": "SOUP",
+      "listShow": false
+    },
+    {
+      "type": "CITRUS_JUICER",
+      "name": "citrus_juicer_011",
+      "bg": "ic_a_citrus_juicer_bg",
+      "icon": "ic_a_citrus_juicer",
+      "devMode": "SOUP",
+      "listShow": false
+    },
+
+    {
+      "type": "POTATO_PEELER",
+      "name": "potato_peeler",
+      "bg": "ic_a_potato_peeler_bg",
+      "icon": "ic_a_potato_peeler",
+      "devMode": "SOUP",
+      "listShow": false
+    },
+    {
+      "type": "BROWN",
+      "name": "brown",
+      "bg": "cm_icon_roast",
+      "icon": "cm_icon_roast",
+      "devMode": "SOUP",
+      "listShow": false
+    },
+    {
+      "type": "ROAST",
+      "name": "roast",
+      "bg": "cm_icon_roast",
+      "icon": "cm_icon_roast",
+      "devMode": "SOUP",
+      "listShow": false
+    },
+    {
+      "type": "SLOW_COOK",
+      "name": "slow_cook",
+      "bg": "ic_a_slow_cook_bg",
+      "icon": "ic_a_slow_cook",
+      "devMode": "SOUP",
+      "listShow": false
+    },
+    {
+      "type": "COOK_EGGS",
+      "name": "cook_eggs",
+      "bg": "cm_icon_cook_eggs",
+      "icon": "cm_icon_cook_eggs",
+      "devMode": "SOUP",
+      "listShow": false
+    },
+
+
     {
       "type": "AIR_FRYER",
       "name": "air_fryer",

+ 40 - 3
BusinessCommon/src/main/java/com/develop/common/utils/TuyaUtilsSo.java

@@ -24,6 +24,7 @@ import com.tuya.smartai.iot_sdk.DPEvent;
 import org.greenrobot.eventbus.EventBus;
 import org.json.JSONObject;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -138,6 +139,7 @@ public class TuyaUtilsSo {
              * -> 自动程序   dpid = 3 ; type = 3 , dp_enum:   0 DIY,1 和面(Knead) ,2 蒸汽(Steam), 3 低温慢煮(Sous_vide) ,4 煮米饭(Rice) ,
              *       5 搅碎(Chop) , 6 奶昔(Smoothie),7 称重(Weight) ,8 切丁(Dive), 9 去皮(Peeling) ,10 烧水(Boil_water),11 切丝切片 (Food_processor)
              *      12 自动清洁(Auto_clean) ,13 预加热 (Preheating) , 14 间接性搅拌 (Intermittent_Stir) 15 警告 (Warning) ,16 扭橙 (Citrus_Juicer)
+             *      17 食谱运行模式(Recipes_mode) ,18 慢炖 Slow cook
              * -> 工作状态  dpid = 5 (只上报)     {”5“:”Stop“}
              * -> 烹饪温度  dpid = 6 ;type = 1, dp_value :   6   温度度数
              * -> 当前温度 dpid = 7   (只上报)  {”7“:88}
@@ -198,7 +200,7 @@ public class TuyaUtilsSo {
                      * -> 自动程序   dpid = 3 ; type = 3 , dp_enum:   0 DIY,1 和面(Knead) ,2 蒸汽(Steam), 3 低温慢煮(Sous_vide) ,4 煮米饭(Rice) ,
                      *       5 搅碎(Chop) , 6 奶昔(Smoothie),7 称重(Weight) ,8 切丁(Dive), 9 去皮(Peeling) ,10 烧水(Boil_water),11 切丝切片 (Food_processor)
                      *      12 自动清洁(Auto_clean) ,13 预加热 (Preheating) , 14 间接性搅拌 (Intermittent_Stir) 15 警告 (Warning) 16. 扭橙 (Citrus_Juicer)
-                     *       17 食谱运行模式(Recipes_mode)
+                     *       17 食谱运行模式(Recipes_mode) ,18 慢炖 Slow cook
                      * */
 
 //                    setDpCurrentActivityFalse();
@@ -297,6 +299,7 @@ public class TuyaUtilsSo {
                     BaseDevMode modesGear = infoGear.getMode();
                     if (modesGear.isMotorGearChange()) {
                         CofarSDK.cfgMotorGear((byte) intValue);
+                        tuyaEvent("change_speed");
                     }
                     //速度
                     break;
@@ -363,7 +366,7 @@ public class TuyaUtilsSo {
          * 0 DIY,1 和面(Knead) ,2 蒸汽(Steam), 3 低温慢煮(Sous_vide) ,4 煮米饭(Rice) ,
          * 5 搅碎(Chop) , 6 奶昔(Smoothie),7 称重(Weight) ,8 切丁(Dive), 9 去皮(Peeling) ,10 烧水(Boil_water),11 切丝切片 (Food_processor)
          * 12 自动清洁(Auto_clean) ,13 预加热 (Preheating) , 14 间接性搅拌 (Intermittent_Stir) 15 警告 (Warning)  16. 扭橙 (Citrus_Juicer)
-         * 17 食谱运行模式(Recipes_mode)
+         * 17 食谱运行模式(Recipes_mode) ,18 慢炖 Slow cook
          * */
 //        sendDevReady(1);
         String type = "";
@@ -422,6 +425,9 @@ public class TuyaUtilsSo {
             case 17:
                 type = "";
                 break;
+            case 18:
+                type = "SLOW_COOK";
+                break;
             default:
                 type = "ADAPTED_COOKING";
                 break;
@@ -444,9 +450,10 @@ public class TuyaUtilsSo {
     TuyaApi.RestartCallback restartCallback = new TuyaApi.RestartCallback() {
         @Override
         public void invoke() {
+            //解绑前,删除涂鸦初始化文件
+            delteTuyaFile();
             //解绑的时候,把历史记录去掉
             MMkvUtils.INSTANCE.save(HISTORYRECIPES, "");
-
             PowerManager pm = (PowerManager) AppActivityManager.getInstance().getTopActivity().getSystemService(Context.POWER_SERVICE);
             pm.reboot("");
         }
@@ -738,6 +745,10 @@ public class TuyaUtilsSo {
             case "CITRUS_JUICER":
                 type = 16;
                 break;
+
+            case "SLOW_COOK":
+                type = 18 ;
+                break;
             default:
                 //针对食谱运行步骤,如果 runningInstId  没有在上面所有得话,就默认 给菜谱模式 type = 17  Recipes_mode
                 type = 17;
@@ -1031,6 +1042,32 @@ public class TuyaUtilsSo {
     }
 
 
+    public  void  delteTuyaFile(){
+        // 替换为你的SD卡路径和文件夹名称
+        File folder = new File("/sdcard/tuya_db_files");
+        if (folder.exists()) {
+            deleteFolder(folder);
+            System.out.println("文件夹删除成功");
+        } else {
+            System.out.println("文件夹不存在");
+        }
+
+    }
+
+
+    public  void deleteFolder(File folder) {
+        if (folder.isDirectory()) {
+            File[] files = folder.listFiles();
+            if (files != null) {
+                for (File file : files) {
+                    deleteFolder(file); // 递归删除子文件和子文件夹
+                }
+            }
+        }
+        folder.delete(); // 删除文件夹或文件
+    }
+
+
     interface httpCommonPostCallBack {
         void httpCommon(String json);
 

+ 21 - 11
BusinessMain/src/main/java/com/develop/main/ui/ModeEntranceActivity.kt

@@ -18,6 +18,7 @@ import com.develop.base.ext.appGlobalScope
 import com.develop.base.ext.dimenRes
 import com.develop.base.ext.getGoneLogin
 import com.develop.base.ext.getModelNum
+import com.develop.base.ext.getNewTuya
 import com.develop.base.ext.getSN
 import com.develop.base.ext.isBrand036I
 import com.develop.base.ext.isNightTheme
@@ -431,7 +432,7 @@ class ModeEntranceActivity : CommonBindingActivity<ActivityModeEntranceBinding>(
                                 }
 
                                 EntranceType.download_new_recipes -> {
-                                    if (sn.startsWith("011")) {
+                                    if (getNewTuya()) {
                                         if (NetworkUtils.isWifiConnected()) {
                                             if (!AppVersionUtil.dialogRecipeUpdate.isShow) {
                                                 AppVersionUtil.checkAboutRecipeUpdate(true)
@@ -1013,18 +1014,27 @@ class ModeEntranceActivity : CommonBindingActivity<ActivityModeEntranceBinding>(
                             }
 
                             EntranceType.download_new_recipes -> {
-                                if (FoodDataProvider.checkDataExit()) {
-                                    val bundle = Bundle()
-                                    bundle.putInt(MODE_ENTRANCE, Recipes)
-                                    bundle.putInt(RECIPES_TYPE, NetFood)
-                                    bundle.putString(HOME_TITLE, title)
-                                    navigateTo(Screens.Main.HOME) {
-                                        with(bundle)
+                                if (getNewTuya()){
+                                    if (NetworkUtils.isWifiConnected()) {
+                                        if (!AppVersionUtil.dialogRecipeUpdate.isShow) {
+                                            AppVersionUtil.checkAboutRecipeUpdate(true)
+                                        }
+                                    } else {
+                                        GlobalToast.showToast(getString(com.develop.common.R.string.network_error))
+                                    }
+                                }else{
+                                    if (FoodDataProvider.checkDataExit()) {
+                                        val bundle = Bundle()
+                                        bundle.putInt(MODE_ENTRANCE, Recipes)
+                                        bundle.putInt(RECIPES_TYPE, NetFood)
+                                        bundle.putString(HOME_TITLE, title)
+                                        navigateTo(Screens.Main.HOME) {
+                                            with(bundle)
+                                        }
+                                    } else {
+                                        showLoading()
                                     }
-                                } else {
-                                    showLoading()
                                 }
-
                             }
                         }
                     }

+ 15 - 4
BusinessStep/src/main/java/com/develop/step/ui/ModesDetailActivity.kt

@@ -399,7 +399,6 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
         hasShowScreenSaver = false
 
 
-
 //        TuyaUtilsSo.getInstance().sendDevReady(1) // 1表示设备不就绪
 
 
@@ -858,6 +857,17 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
             }, 500)
 
         }
+        if ("change_speed" == event.type) {
+
+            ThreadUtils.runOnMainThread({
+                var tuyaMotoGear = CofarSDK.devInfo().motorGear.toInt()
+                binding.clCookSpeed.updateChangeValue(tuyaMotoGear.toString())
+                binding.speedRingView.updateProgress(tuyaMotoGear)
+                binding.speedRingText.text = tuyaMotoGear.toString()
+            }, 500)
+        }
+
+
         if ("change_direction" == event.type) {
             ThreadUtils.runOnMainThread({
                 binding.clCookDirection.updateChangeValue(
@@ -881,11 +891,12 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
             }
         }
 
-        if ("finish_activity"==event.type){
+        if ("finish_activity" == event.type) {
             onClickBack()
         }
     }
-    private  fun  onClickBack(){
+
+    private fun onClickBack() {
         binding.ivBack.performClick()
     }
 
@@ -952,7 +963,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
 
             if (CommonEventTypes.MOTOR_REVERSE_CAN_NOT_RATHER_THEN_3 == event.type) {
                 ///当用户操作的时候,不需要设置3速 且如果选中方向是反方向的的时候需要设置3速,其他就略过
-                if (userChanging&&MotorDirections.REVERSE == CofarSDK.devInfo().motorDirectionBuffer){
+                if (userChanging && MotorDirections.REVERSE == CofarSDK.devInfo().motorDirectionBuffer) {
                     currentMotorGer = 3
                     CofarSDK.cfgMotorGear(3)
                     currDevInfo.mode.apply {

+ 4 - 1
BusinessStep/src/main/java/com/develop/step/ui/cook_step/CookStepBaseActivity.kt

@@ -792,10 +792,13 @@ abstract class CookStepBaseActivity :
         if (baseSn.startsWith("033G")||baseSn.startsWith("033H")){
             CofarSDK.updateScene("");
         }
-        super.onDestroy()
         if (recordRecipes&& getNewTuya()){
             saveCookRecipes()
         }
+
+        super.onDestroy()
+
+
         isWidget = false
         turboTimer?.cancel()
         CofarSDK.stoptWeight()

+ 1 - 1
app/build.gradle

@@ -20,7 +20,7 @@ ext {
     versionCode = Integer.parseInt(new SimpleDateFormat("yyMMddHH").format(new Date()) + 1)
 //    versionCode=230617180
 //    brandCode="054A"
-    brandCode = "011F"
+    brandCode = "030A"
 //    brandCode="000B"
 //    model = "5037"
     model = "1039"

+ 2 - 1
libBase/src/main/java/com/develop/base/ext/GlobaExt.kt

@@ -251,7 +251,8 @@ fun getSN(): String {
 
 //        return  "011D10390020123010190019"
 //        return  "011D10390020123010190085" // 测试新版本涂鸦
-        return  "030A10590020123010190004"   // 测试1059 030
+//        return  "030A10590020123010190004"   // 测试1059 030  app
+        return  "030A10590020123010190005"   // 测试 1059 030 设备
 
 //        return "011F10590020123010190003" //1059测试
 //        return  "011D10390020123010190003"