Skip to content

Commit 9011c85

Browse files
Merge branch 'improve/lightbulb_add_get_power_limit_api' into 'master'
improve: lightbulb add get power limit api See merge request ae_group/esp-iot-solution!1346
2 parents 8587ea5 + a267e72 commit 9011c85

File tree

4 files changed

+27
-1
lines changed

4 files changed

+27
-1
lines changed

components/led/lightbulb_driver/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# ChangeLog
22

3+
## v1.9.0 - 2025-08-11
4+
5+
### Improve:
6+
7+
- Add API for get power limit
8+
39
## v1.8.3 - 2025-06-19
410

511
### Bug Fix:

components/led/lightbulb_driver/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "1.8.3"
1+
version: "1.9.0"
22
description: Provide multiple dimming driver solutions to easily build lightbulb applications
33
url: https://github.com/espressif/esp-iot-solution/tree/master/components/led/lightbulb_driver
44
dependencies:

components/led/lightbulb_driver/include/lightbulb.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,14 @@ bool lightbulb_get_switch(void);
680680
*/
681681
lightbulb_works_mode_t lightbulb_get_mode(void);
682682

683+
/**
684+
* @brief Get the power limit of the lightbulb.
685+
*
686+
* @param power_limit A pointer to a `lightbulb_power_limit_t` structure where the power limit details will be stored.
687+
* @return esp_err_t An error code indicating the success or failure of the operation.
688+
*/
689+
esp_err_t lightbulb_get_power_limit(lightbulb_power_limit_t *power_limit);
690+
683691
/**
684692
* @brief Get all the status details of the lightbulb.
685693
*

components/led/lightbulb_driver/src/lightbulb.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,6 +1939,18 @@ lightbulb_works_mode_t lightbulb_get_mode(void)
19391939
return result;
19401940
}
19411941

1942+
esp_err_t lightbulb_get_power_limit(lightbulb_power_limit_t *power_limit)
1943+
{
1944+
LIGHTBULB_CHECK(power_limit, "power_limit is null", return ESP_FAIL);
1945+
LIGHTBULB_CHECK(s_lb_obj, "not init", return ESP_ERR_INVALID_ARG);
1946+
1947+
LB_MUTEX_TAKE(portMAX_DELAY);
1948+
memcpy(power_limit, &s_lb_obj->power, sizeof(lightbulb_power_limit_t));
1949+
LB_MUTEX_GIVE();
1950+
1951+
return ESP_OK;
1952+
}
1953+
19421954
esp_err_t lightbulb_update_status(lightbulb_status_t *new_status, bool trigger)
19431955
{
19441956
LIGHTBULB_CHECK(new_status, "new_status is null", return ESP_FAIL);

0 commit comments

Comments
 (0)