修复亮度不能到最大的问题,解决app删除不能配网的问题
This commit is contained in:
@@ -478,13 +478,13 @@ static void stop_breath_timer(void)
|
||||
// 计算PWM占空比
|
||||
void calculate_pwm_duty(device_control_t* pdevice_control)
|
||||
{ // 如果开关关闭,则占空比为0
|
||||
uint32_t total_brightness_pwm = pdevice_control->brightness_local;
|
||||
uint32_t total_brightness_pwm = BRINGHTNING2PWMDUTY(pdevice_control->brightness_local);
|
||||
// 计算色温比例 (0-10000)
|
||||
float cct_ratio = ((pdevice_control->cct_local - CCT_LOCAL_MIN) * 1.0) / CCT_RANGE;
|
||||
|
||||
// 根据色温比例计算CW和WW的占空比
|
||||
// 总亮度保持不变,只调整CW和WW的比例
|
||||
pdevice_control->duty_cw = (total_brightness_pwm * cct_ratio);
|
||||
pdevice_control->duty_cw = total_brightness_pwm * cct_ratio + 0.5;
|
||||
pdevice_control->duty_ww = total_brightness_pwm - pdevice_control->duty_cw;
|
||||
}
|
||||
|
||||
@@ -1278,11 +1278,11 @@ void handle_device_unbind(void)
|
||||
if (g_device_control.is_bound) {
|
||||
g_device_control.is_bound = false;
|
||||
g_device_control.power_on_cnt = 0; // 重置上电计数
|
||||
stop_spotlight_main_task();
|
||||
// stop_spotlight_main_task();
|
||||
device_control_t tmp = DEFAULT_DEVICE_DATA;//恢复默认
|
||||
if (!g_reset_factory_flag) {
|
||||
tmp.is_net_configured = g_device_control.is_net_configured;
|
||||
}
|
||||
// if (!g_reset_factory_flag) {
|
||||
// tmp.is_net_configured = g_device_control.is_net_configured;
|
||||
// }
|
||||
g_device_control = tmp;
|
||||
save_device_data();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user