|
@@ -11,6 +11,7 @@ import androidx.core.view.isInvisible
|
|
|
import com.alibaba.android.arouter.facade.annotation.Autowired
|
|
|
import com.develop.base.ext.load
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route
|
|
|
+import com.blankj.utilcode.util.LogUtils
|
|
|
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
|
|
|
import com.develop.base.ext.background_drawable
|
|
|
import com.develop.base.ext.isNightTheme
|
|
@@ -18,6 +19,7 @@ import com.develop.base.ext.navigateTo
|
|
|
import com.develop.base.ext.setGone
|
|
|
import com.develop.base.ext.setVisible
|
|
|
import com.develop.base.ext.src
|
|
|
+import com.develop.base.ext.toJson
|
|
|
import com.develop.base.ext.updateText
|
|
|
import com.develop.base.util.MusicBackPlayerUtil
|
|
|
import com.develop.base.util.ThreadUtils
|
|
@@ -48,6 +50,8 @@ import com.kuyuntech.cofarcooking.device.sdk.constant.core.*
|
|
|
import com.kuyuntech.cofarcooking.device.sdk.eventbus.core.DevInfo
|
|
|
import com.kuyuntech.cofarcooking.device.sdk.eventbus.event.DevCommonEvent
|
|
|
import com.kuyuntech.cofarcooking.device.sdk.util.core.CofarSDK
|
|
|
+import kotlinx.serialization.encodeToString
|
|
|
+import kotlinx.serialization.json.Json
|
|
|
import org.greenrobot.eventbus.EventBus
|
|
|
import org.greenrobot.eventbus.Subscribe
|
|
|
import java.io.File
|
|
@@ -633,6 +637,7 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
override fun onUserChangeTemp(value: Int) {
|
|
|
val v = FoodSdkUtils.parseTemp(value.toShort())
|
|
|
viewModel.displayStep()?.uiData?.targetTemp = v.toInt()
|
|
|
+ LogUtils.d("保存的目标温度:${v.toInt()}")
|
|
|
binding.controller.tvCookingTempTarget.updateText("--${v}°C--")
|
|
|
binding.controller.tvRingTempText.updateText("${v}°C")
|
|
|
CofarSDK.cfgHeat(value.toShort(), HeatModes.PU_TONG)
|
|
@@ -686,9 +691,13 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
it.uiData.currentTemp = FoodSdkUtils.parseTemp(devInfo.temp).toInt()
|
|
|
it.uiData.remainTime = devInfo.remainTime
|
|
|
it.uiData.targetTimeBuffer = devInfo.targetTimeBuffer
|
|
|
+ it.uiData.targetTempBuffer = devInfo.targetTempBuffer.toInt()
|
|
|
it.uiData.isTimeChange = devInfo.mode.isTimeChange
|
|
|
it.uiData.isTempChange = devInfo.mode.isTempChange
|
|
|
it.uiData.isMotorDirectionChange = devInfo.mode.isMotorDirectionChange
|
|
|
+ it.uiData.motorGearBuffer = devInfo.motorGearBuffer.toInt()
|
|
|
+ it.uiData.motorDirectionBuffer = devInfo.motorDirectionBuffer.toInt()
|
|
|
+ it.uiData.waterGearBuffer = devInfo.waterGearBuffer.toInt()
|
|
|
it.uiData.isMotorGearChange = devInfo.mode.isMotorGearChange
|
|
|
it.uiData.limitMaxSpeed = devInfo.mode.maxMotorGear
|
|
|
it.uiData.limitMinSpeed = devInfo.mode.minMotorGear
|
|
@@ -821,67 +830,84 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
if (tabType == CookSettingType.TEMP_SETTING) {
|
|
|
cookStep?.uiData?.let {
|
|
|
if (!it.isTempChange) {
|
|
|
+ LogUtils.d("========")
|
|
|
return
|
|
|
}
|
|
|
+ var temp = it.targetTemp
|
|
|
+ if (it.targetTempBuffer != -1) {
|
|
|
+ temp = it.targetTempBuffer
|
|
|
+ }
|
|
|
+ LogUtils.d("调节前温度:${temp}")
|
|
|
if (increase) {
|
|
|
- it.targetTemp += CofarSDK.getTempInterval()
|
|
|
- if (it.targetTemp > it.limitMaxTemp) {
|
|
|
- it.targetTemp = it.limitMaxTemp
|
|
|
+ temp += CofarSDK.getTempInterval()
|
|
|
+ if (temp > it.limitMaxTemp) {
|
|
|
+ temp = it.limitMaxTemp
|
|
|
}
|
|
|
} else {
|
|
|
- it.targetTemp -= CofarSDK.getTempInterval()
|
|
|
- if (it.targetTemp < it.limitMinTemp) {
|
|
|
- it.targetTemp = it.limitMinTemp
|
|
|
+ temp -= CofarSDK.getTempInterval()
|
|
|
+ if (temp < it.limitMinTemp) {
|
|
|
+ temp = it.limitMinTemp
|
|
|
}
|
|
|
|
|
|
- if (it.targetTemp < 35) {
|
|
|
- it.targetTemp = 0
|
|
|
+ if (temp < 35) {
|
|
|
+ temp = 0
|
|
|
}
|
|
|
|
|
|
}
|
|
|
viewModel.stepUiData.doingModify = true
|
|
|
- binding.controller.tempRingView.updateProgress(it.targetTemp)
|
|
|
- onUserChangeTemp(it.targetTemp)
|
|
|
+ binding.controller.tempRingView.updateProgress(temp)
|
|
|
+ LogUtils.d("调节后温度:${temp}")
|
|
|
+ onUserChangeTemp(temp)
|
|
|
}
|
|
|
} else if (tabType == CookSettingType.SPEED_SETTING) {
|
|
|
cookStep?.uiData?.let {
|
|
|
if (!it.isMotorGearChange) {
|
|
|
return
|
|
|
}
|
|
|
+ var speed = it.currentSpeed
|
|
|
+ if (it.motorGearBuffer != -1) {
|
|
|
+ speed = it.motorGearBuffer
|
|
|
+ }
|
|
|
+ LogUtils.d("调节前转速:${speed}")
|
|
|
if (increase) {
|
|
|
- it.currentSpeed++
|
|
|
- if (it.currentSpeed > it.limitMaxSpeed) {
|
|
|
- it.currentSpeed = it.limitMaxSpeed
|
|
|
+ speed++
|
|
|
+ if (speed > it.limitMaxSpeed) {
|
|
|
+ speed = it.limitMaxSpeed
|
|
|
}
|
|
|
} else {
|
|
|
- it.currentSpeed--
|
|
|
- if (it.currentSpeed < it.limitMinSpeed) {
|
|
|
- it.currentSpeed = it.limitMinSpeed
|
|
|
+ speed--
|
|
|
+ if (speed < it.limitMinSpeed) {
|
|
|
+ speed = it.limitMinSpeed
|
|
|
}
|
|
|
}
|
|
|
viewModel.stepUiData.doingModify = true
|
|
|
- binding.controller.speedRingView.updateProgress(it.currentSpeed)
|
|
|
- onUserChangeSpeed(it.currentSpeed)
|
|
|
+ binding.controller.speedRingView.updateProgress(speed)
|
|
|
+ LogUtils.d("调节后转速:${speed}")
|
|
|
+ onUserChangeSpeed(speed)
|
|
|
}
|
|
|
} else if (tabType == CookSettingType.WATER_SPRY) {
|
|
|
cookStep?.uiData?.let {
|
|
|
if (!it.isWaterGearChange) {
|
|
|
return
|
|
|
}
|
|
|
+ var waterGear = it.currentWaterGear
|
|
|
+ if (it.waterGearBuffer != -1) {
|
|
|
+ waterGear = it.waterGearBuffer
|
|
|
+ }
|
|
|
if (increase) {
|
|
|
- it.currentWaterGear++
|
|
|
- if (it.currentWaterGear > it.limitMaxWaterGear) {
|
|
|
- it.currentWaterGear = it.limitMaxWaterGear
|
|
|
+ waterGear++
|
|
|
+ if (waterGear > it.limitMaxWaterGear) {
|
|
|
+ waterGear = it.limitMaxWaterGear
|
|
|
}
|
|
|
} else {
|
|
|
- it.currentWaterGear--
|
|
|
- if (it.currentWaterGear < it.limitMinWaterGear) {
|
|
|
- it.currentWaterGear = it.limitMinWaterGear
|
|
|
+ waterGear--
|
|
|
+ if (waterGear < it.limitMinWaterGear) {
|
|
|
+ waterGear = it.limitMinWaterGear
|
|
|
}
|
|
|
}
|
|
|
viewModel.stepUiData.doingModify = true
|
|
|
- binding.controller.waterRingView.updateProgress(it.currentWaterGear)
|
|
|
- onUserWaterGear(it.currentWaterGear)
|
|
|
+ binding.controller.waterRingView.updateProgress(waterGear)
|
|
|
+ onUserWaterGear(waterGear)
|
|
|
}
|
|
|
} else if (tabType == CookSettingType.TIME_SETTING) {
|
|
|
cookStep?.uiData?.let {
|
|
@@ -903,12 +929,12 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
|
|
|
private fun dealWithTimeByOperation(uiData: CookStepUiData, increase: Boolean) {
|
|
|
//当前调节时间
|
|
|
- var targetTime = if (uiData.runningStatus != DevStatus.RUNNING.toInt()) {
|
|
|
- uiData.targetTime
|
|
|
- } else if (uiData.targetTimeBuffer > 0) {
|
|
|
- uiData.targetTimeBuffer
|
|
|
- } else {
|
|
|
- uiData.targetTime
|
|
|
+ var targetTime = uiData.targetTime
|
|
|
+ if (uiData.remainTime != 0) {
|
|
|
+ targetTime = uiData.remainTime
|
|
|
+ }
|
|
|
+ if (uiData.targetTimeBuffer != -1) {
|
|
|
+ targetTime = uiData.targetTimeBuffer
|
|
|
}
|
|
|
var step = 0
|
|
|
if (whereIndex == 1) {
|
|
@@ -959,6 +985,7 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
uiData.isTimeChange = true
|
|
|
Log.d("eeeeeee", "${uiData.targetTime} == ${targetTime} === $step")
|
|
|
uiData.targetTime = targetTime
|
|
|
+ LogUtils.d("调节时间:${targetTime}")
|
|
|
binding.controller.clSetTime.isTimeCanChange(true)
|
|
|
// 回调到上面那个地方来设置时间
|
|
|
TimeUtil.getTimes(targetTime, timeArray)
|
|
@@ -1193,21 +1220,28 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
binding.controller.tvSetTime.updateText(TimeUtil.formatTime(timeArray)) // 下面的TAB-当前剩余时间
|
|
|
|
|
|
// 温度
|
|
|
- val showTemp =
|
|
|
- if (runningState == DevStatus.STOP.toInt()) uiData.targetTemp else uiData.currentTemp;
|
|
|
+ val showTemp = if (uiData.targetTempBuffer != -1) {
|
|
|
+ uiData.targetTempBuffer
|
|
|
+ } else {
|
|
|
+ uiData.targetTemp
|
|
|
+ }
|
|
|
if (!viewModel.stepUiData.doingModify || focusUpdate) {
|
|
|
- binding.controller.tvCookingTempTarget.updateText("--${uiData.targetTemp}°C--") // 下面的TAB-目标运行温度
|
|
|
+ binding.controller.tvCookingTempTarget.updateText("--${showTemp}°C--") // 下面的TAB-目标运行温度
|
|
|
binding.controller.tempRingView.updateProgress(showTemp) // 圆环设置-当前运行温度
|
|
|
binding.controller.tvRingTempText.updateText("${showTemp}°C") // 圆环内的数字-当前运行温度
|
|
|
}
|
|
|
binding.controller.tvTempValue.updateText("${uiData.currentTemp}°C") // 下面的TAB-当前运行温度
|
|
|
|
|
|
// 速度设置
|
|
|
+ val speed = if (uiData.motorGearBuffer != -1) {
|
|
|
+ uiData.motorGearBuffer
|
|
|
+ } else {
|
|
|
+ uiData.currentSpeed
|
|
|
+ }
|
|
|
if (!viewModel.stepUiData.doingModify || focusUpdate) {
|
|
|
-
|
|
|
- binding.controller.speedRingView.updateProgress(uiData.currentSpeed) // 圆环设置-当前运行速度
|
|
|
- binding.controller.tvSpeedText.updateText(uiData.currentSpeed.toString()) // 圆环内的数字-当前运行速度
|
|
|
- binding.controller.tvSetSpeed.updateText(uiData.currentSpeed.toString()) // 下面的TAB-当前运行速度
|
|
|
+ binding.controller.speedRingView.updateProgress(speed) // 圆环设置-当前运行速度
|
|
|
+ binding.controller.tvSpeedText.updateText(speed.toString()) // 圆环内的数字-当前运行速度
|
|
|
+ binding.controller.tvSetSpeed.updateText(speed.toString()) // 下面的TAB-当前运行速度
|
|
|
}
|
|
|
|
|
|
// 喷水设置
|
|
@@ -1224,8 +1258,13 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
}
|
|
|
|
|
|
// 方向设置
|
|
|
+ val direction = if (uiData.motorDirectionBuffer != -1) {
|
|
|
+ uiData.motorDirectionBuffer
|
|
|
+ } else {
|
|
|
+ uiData.direction
|
|
|
+ }
|
|
|
if (!viewModel.stepUiData.doingModify || focusUpdate) {
|
|
|
- updateDirection(uiData.direction)
|
|
|
+ updateDirection(direction)
|
|
|
}
|
|
|
}
|
|
|
|