-
Notifications
You must be signed in to change notification settings - Fork 768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LED Indicator组件的led_indicator_start和led_indicator_set_brightness亮度值过渡不连续 (AEGHB-697) #376
Comments
这不是 bug,我试了一下,这个并不是闪灭一下,而是亮度突然掉了一下,原因是 breathe 这个调光默认开了 gamma 调光。128 的亮度会被校准成 52,而 led_indicator_set_brightness(led_handle, LED_STATE_50_PERCENT); 不会进行 gamma 调光。所以亮度会从 128 瞬间到 52,再回到 255。 你可以直接关掉宏: CONFIG_USE_GAMMA_CORRECTION。但是不加 gamma 调光,亮度的明暗变化不明显。 至于加一个 set_breath_with_time 的这种 API,会有比较大的结构改动,可能暂时还不是很方便加入进去。目前 led_indicator 意在预设好很多指示灯的情况,然后方便进行指示灯的切换。 如果你有对 led_indicator 的一些建议性意见,欢迎提出。 |
非常感谢!我验证了一下,它确实是gamma导致的问题,当我禁用掉CONFIG_USE_GAMMA_CORRECTION之后,确实不会再有亮度掉一下的问题,但是这种情况下的 breathe 调光确实也不太理想。 然后,我看到你之前提到的led_indicator_get_gamma_value这个函数,我把它加入了测试用例,同时继续启用了 CONFIG_USE_GAMMA_CORRECTION 并进行了测试,但还是会出现亮度掉一下的问题。 问题:
测试用例代码:
|
这个是因为你经过一次 gamma 调光后传入的 128 变成了 52,这时候的亮度其实保存的是 52,然后渐变再用这个 52 去做 gamma 就变成了亮度 2,导致又会变暗一下。如果要解决需要再添加一个 API :led_indicator_set_brightness_with_gamma. 我觉得这是一个 bug,在灯效数组中设置 {LED_BLINK_BRIGHTNESS, LED_STATE_50_PERCENT, 0} 应该存储设定值 128,而不是 gamma 后的值,我会尽快 fix 这个。 你目前可以手动实现一下 led_indicator_set_brightness_with_gamma 在 led_indicator.c 中。
|
非常感谢!经过验证,使用 led_indicator_set_brightness_with_gamma 函数, 已经解决了亮度掉一下的问题。 另外之前提到的 u_led_indicator_set_brightness_with_time 这种函数,我想了一个方案,并经过了测试和验证,是可以正常工作的,但违反了组件部分数据结构的要求(组件要求: const blink_step_t **::blink_lists 而我使用了 blink_step_t **::blink_lists )。 问题请问这种操作后期组件更新会有什么隐患吗?或者是否有更好的修改建议。 建议官方是否可以考虑按这种思路,为此组件增加这种类型的API接口,以实现组件更大的灵活度。(它的实际应用场景是:带有光照度传感器和人体感应器的指示灯,感应到有人时可以渐亮到某个不固定的亮度(根据当前的光照度确定亮度),无人时渐灭到另一个亮度)。 实现代码如下
|
动态修改数组的值达到更灵活的方式是被允许的(传入的 led_mode 是 const * 即可,不对下层的数组里的内容要求 const),我觉得你这个调光的 API 写的很好。我觉得后续可以在示例中体现这种用法,进行一些引导。 此外新的组件已经 Fix 你之前提的亮度不统一的问题了,请试一下:https://github.com/lijunru-hub/esp-iot-solution/tree/fix/led_indicator_set_brightness_with_gamma 如何使用: 修复内容:
如果有任何新问题,欢迎留言。如果没有问题,请关闭这个 issue,再次感谢你的测试。 |
点个赞👍🏻经过测试,led_indicator:0.9.3 组件,已经解决了亮度不统一的问题。 另外
|
|
非常感谢! |
Answers checklist.
General issue report
环境版本
ESP-IDF v5.1.3
LED Indicator : 0.9.2
芯片:ESP32
问题步骤:
问题:
复现代码如下:
现象和尝试
现象:
我尝试把呼吸模式改成如下:
但对实际结果,并没有什么影响。
请求指教,万分感激!
The text was updated successfully, but these errors were encountered: