添加渐变时长为0的时候无法进行保存导致升级后灯打开的问题

This commit is contained in:
2025-06-18 07:55:36 +08:00
parent fff5e9cfbe
commit c2ac3319f2
3 changed files with 4 additions and 6 deletions

View File

@ -30,7 +30,7 @@ extern "C" {
#define DEVICE_HIVERSION "1.0.0"
/* 设备固件版本号 */
#define FIRMWARE_VER "1.0.0"
#define FIRMWARE_VER "1.0.1"
/* 设备硬件版本号 */
#define HARDWARE_VER "1.0.0"
/* 设备软件版本号 */

View File

@ -123,7 +123,6 @@ int myhandle_put_switch(const char* svc_id, const char* payload, unsigned int le
}
bool on = (item->valueint != 0);
g_device_control.on = on;
ret = set_switch(on);
cJSON_Delete(json);

View File

@ -506,10 +506,6 @@ void update_pwm_output(bool on_state, uint16_t duty_cw_val, uint16_t duty_ww_val
uapi_pwm_open(channel_id_ww, &cfg_repeat);
// The line 'uint8_t channel_ids[2] = {channel_id_cw, channel_id_ww};' was present in the original code snippet from the checkpoint
// but seems unused before the uapi_pwm_start_group call. Retaining original behavior regarding this line.
// If it was indeed unused, it can be removed. For now, assuming it might have a purpose or was for debugging.
// uint8_t channel_ids[2] = {channel_id_cw, channel_id_ww}; // This line is commented out as it appears unused in the provided snippet.
uapi_pwm_start_group(CONFIG_PWM_GROUP_ID);
if (should_print(&pwm_limiter)) {
@ -897,6 +893,8 @@ int set_light(int32_t brightness_local, int32_t cct_local)
return -111; // 异步上报
#endif
}
g_device_control.cct_local = tmp_fade_ctx.target_cct;
g_device_control.brightness_local = tmp_fade_ctx.target_brightness;
// no break; // 如果渐变时间是0则直接一步完成
default: //情景模式直接切换到对应的色温和亮度
set_switch(true);
@ -916,6 +914,7 @@ int set_switch(bool open)
calculate_pwm_duty();
update_pwm_output(g_device_control.on, g_device_control.duty_cw, g_device_control.duty_ww);
uapi_gpio_set_val(SWITCH_PIN, open ? OPEN_LIGHT : CLOSE_LIGHT);
req_save_device_data();
return 0;
}