@@ -46,7 +46,8 @@ void led_indicator_init()
4646 .blink_list_num = 0 ,
4747 };
4848
49- led_handle_0 = led_indicator_new_gpio_device (& config , & led_indicator_gpio_config );
49+ esp_err_t ret = led_indicator_new_gpio_device (& config , & led_indicator_gpio_config , & led_handle_0 );
50+ TEST_ASSERT (ret == ESP_OK );
5051 TEST_ASSERT_NOT_NULL (led_handle_0 );
5152}
5253
@@ -168,13 +169,16 @@ void led_indicator_all_init()
168169 .blink_list_num = 0 ,
169170 };
170171
171- led_handle_0 = led_indicator_new_gpio_device (& config , & led_indicator_gpio_config );
172+ esp_err_t ret = led_indicator_new_gpio_device (& config , & led_indicator_gpio_config , & led_handle_0 );
173+ TEST_ASSERT (ret == ESP_OK );
172174 TEST_ASSERT_NOT_NULL (led_handle_0 );
173175 led_indicator_gpio_config .gpio_num = LED_IO_NUM_1 ;
174- led_handle_1 = led_indicator_new_gpio_device (& config , & led_indicator_gpio_config );
176+ ret = led_indicator_new_gpio_device (& config , & led_indicator_gpio_config , & led_handle_1 );
177+ TEST_ASSERT (ret == ESP_OK );
175178 TEST_ASSERT_NOT_NULL (led_handle_1 );
176179 led_indicator_gpio_config .gpio_num = LED_IO_NUM_2 ;
177- led_handle_2 = led_indicator_new_gpio_device (& config , & led_indicator_gpio_config );
180+ ret = led_indicator_new_gpio_device (& config , & led_indicator_gpio_config , & led_handle_2 );
181+ TEST_ASSERT (ret == ESP_OK );
178182 TEST_ASSERT_NOT_NULL (led_handle_2 );
179183}
180184
@@ -340,11 +344,12 @@ TEST_CASE("User defined blink", "[LED][indicator]")
340344 .blink_list_num = BLINK_NUM ,
341345 };
342346
343- led_handle_0 = led_indicator_new_gpio_device (& config , & led_indicator_gpio_config );
347+ esp_err_t ret = led_indicator_new_gpio_device (& config , & led_indicator_gpio_config , & led_handle_0 );
348+ TEST_ASSERT (ret == ESP_OK );
344349 TEST_ASSERT_NOT_NULL (led_handle_0 );
345350
346351 ESP_LOGI (TAG , "double blink....." );
347- esp_err_t ret = led_indicator_start (led_handle_0 , BLINK_DOUBLE );
352+ ret = led_indicator_start (led_handle_0 , BLINK_DOUBLE );
348353 TEST_ASSERT (ret == ESP_OK );
349354 vTaskDelay (2000 / portTICK_PERIOD_MS );
350355 ret = led_indicator_stop (led_handle_0 , BLINK_DOUBLE );
@@ -374,11 +379,12 @@ TEST_CASE("Preempt blink lists test", "[LED][indicator]")
374379 .blink_list_num = BLINK_NUM ,
375380 };
376381
377- led_handle_0 = led_indicator_new_gpio_device (& config , & led_indicator_gpio_config );
382+ esp_err_t ret = led_indicator_new_gpio_device (& config , & led_indicator_gpio_config , & led_handle_0 );
383+ TEST_ASSERT (ret == ESP_OK );
378384 TEST_ASSERT_NOT_NULL (led_handle_0 );
379385
380386 ESP_LOGI (TAG , "double blink....." );
381- esp_err_t ret = led_indicator_start (led_handle_0 , BLINK_DOUBLE );
387+ ret = led_indicator_start (led_handle_0 , BLINK_DOUBLE );
382388 vTaskDelay (1000 / portTICK_PERIOD_MS );
383389 TEST_ASSERT (ret == ESP_OK );
384390
@@ -415,11 +421,12 @@ TEST_CASE("breathe test", "[LED][indicator]")
415421 .blink_list_num = BLINK_NUM ,
416422 };
417423
418- led_handle_0 = led_indicator_new_ledc_device (& config , & led_indicator_ledc_config );
424+ esp_err_t ret = led_indicator_new_ledc_device (& config , & led_indicator_ledc_config , & led_handle_0 );
425+ TEST_ASSERT (ret == ESP_OK );
419426 TEST_ASSERT_NOT_NULL (led_handle_0 );
420427
421428 ESP_LOGI (TAG , "breathe 25/100 blink....." );
422- esp_err_t ret = led_indicator_start (led_handle_0 , BLINK_25_BRIGHTNESS );
429+ ret = led_indicator_start (led_handle_0 , BLINK_25_BRIGHTNESS );
423430 vTaskDelay (2000 / portTICK_PERIOD_MS );
424431 TEST_ASSERT (ret == ESP_OK );
425432
@@ -462,11 +469,12 @@ TEST_CASE("test led preempt func with breath", "[LED][preempt][breath]")
462469 };
463470 int cnt0 = 3 ;
464471 while (cnt0 -- ) {
465- led_handle_0 = led_indicator_new_ledc_device (& config , & led_indicator_ledc_config );
472+ esp_err_t ret = led_indicator_new_ledc_device (& config , & led_indicator_ledc_config , & led_handle_0 );
473+ TEST_ASSERT (ret == ESP_OK );
466474 TEST_ASSERT_NOT_NULL (led_handle_0 );
467475
468476 ESP_LOGI (TAG , "breathe blink ....." );
469- esp_err_t ret = led_indicator_start (led_handle_0 , BLINK_BREATHE );
477+ ret = led_indicator_start (led_handle_0 , BLINK_BREATHE );
470478 TEST_ASSERT (ret == ESP_OK );
471479 bool preempted = false;
472480 int cnt = 3 ;
@@ -641,9 +649,8 @@ TEST_CASE("TEST LED RGB", "[LED RGB][RGB]")
641649 .blink_list_num = BLINK_RGB_NUM ,
642650 };
643651
644- led_handle_0 = led_indicator_new_rgb_device (& config , & led_grb_cfg );
645- esp_err_t ret = ESP_OK ;
646-
652+ esp_err_t ret = led_indicator_new_rgb_device (& config , & led_grb_cfg , & led_handle_0 );
653+ TEST_ASSERT (ret == ESP_OK );
647654 TEST_ASSERT_NOT_NULL (led_handle_0 );
648655
649656 ESP_LOGI (TAG , "breathe 25/100 blink....." );
@@ -763,8 +770,8 @@ TEST_CASE("TEST LED Strips by RGB", "[LED Strips][RGB]")
763770 .blink_list_num = BLINK_RGB_NUM ,
764771 };
765772 esp_err_t ret = ESP_OK ;
766- led_handle_0 = led_indicator_new_strips_device (& config , & led_indicator_strips_config );
767-
773+ ret = led_indicator_new_strips_device (& config , & led_indicator_strips_config , & led_handle_0 );
774+ TEST_ASSERT ( ret == ESP_OK );
768775 TEST_ASSERT_NOT_NULL (led_handle_0 );
769776
770777 ESP_LOGI (TAG , "breathe 25/100 blink....." );
@@ -881,7 +888,9 @@ TEST_CASE("TEST LED RGB control Real time ", "[LED RGB][Real time]")
881888 .blink_list_num = BLINK_RGB_NUM ,
882889 };
883890 esp_err_t ret = ESP_OK ;
884- led_handle_0 = led_indicator_new_strips_device (& config , & led_indicator_strips_config );
891+ ret = led_indicator_new_strips_device (& config , & led_indicator_strips_config , & led_handle_0 );
892+ TEST_ASSERT (ret == ESP_OK );
893+ TEST_ASSERT_NOT_NULL (led_handle_0 );
885894
886895 ESP_LOGI (TAG , "set red by rgb_value one by one ....." );
887896
0 commit comments