1. 更改模式时进行渐变
2. 开灯渐变
3. 提高亮灯的速度,从flashboot中开始亮灯
4. spotlight_main 调整到app_main中来
This commit is contained in:
2025-06-25 23:14:48 +08:00
parent c2ac3319f2
commit a4b68ffadb
12 changed files with 398 additions and 211 deletions

View File

@ -47,7 +47,7 @@ int myhandle_put_brightness(const char* svc_id, const char* payload, unsigned in
// g_device_control.brightness_local = brightness;
g_device_control.elightMode = LIGHT_MODE_CUSTOMER;
ret = set_light(BRIGHTNESS_REMOTE2LOCAL(brightness), -1); // 只更新亮度,色温保持不变
ret = set_light(APP_CHANGE_LIGHT_BRIGHTNESS_CCT, BRIGHTNESS_REMOTE2LOCAL(brightness), -1); // 只更新亮度,色温保持不变
cJSON_Delete(json);
return ret; //异步上报
@ -74,7 +74,7 @@ int myhandle_put_cct(const char* svc_id, const char* payload, unsigned int len)
// g_device_control.cct_local = cct;
g_device_control.elightMode = LIGHT_MODE_CUSTOMER;
ret = set_light(-1, CCT_REMOTE2LOCAL(cct)); // 只更新色温,亮度保持不变
ret = set_light(APP_CHANGE_LIGHT_BRIGHTNESS_CCT, -1, CCT_REMOTE2LOCAL(cct)); // 只更新色温,亮度保持不变
cJSON_Delete(json);
return ret ;//异步上报
@ -100,7 +100,7 @@ int myhandle_put_lightMode(const char* svc_id, const char* payload, unsigned int
g_device_control.elightMode = mode;
// 同时更新亮度和色温
ret = set_light(BRIGHTNESS_REMOTE2LOCAL(scene_presets[mode].brightness), CCT_REMOTE2LOCAL(scene_presets[mode].cct));
ret = set_light(APP_CHANGE_LIGHT_MODE, BRIGHTNESS_REMOTE2LOCAL(scene_presets[mode].brightness), CCT_REMOTE2LOCAL(scene_presets[mode].cct));
}
cJSON_Delete(json);
@ -123,8 +123,11 @@ int myhandle_put_switch(const char* svc_id, const char* payload, unsigned int le
}
bool on = (item->valueint != 0);
ret = set_switch(on);
if (on) {
ret = set_light(APP_OPEN_LIGHT, -1, -1);
} else {
ret = set_light(APP_CLOSE_LIGHT, -1, -1);
}
cJSON_Delete(json);
return ret;
}