chore(light): 调整氛围灯最暗阈值。

This commit is contained in:
Ivan Li 2023-04-23 22:30:43 +08:00
parent e947dc3ac1
commit 58d1039c78
2 changed files with 7 additions and 7 deletions

View File

@ -401,25 +401,25 @@ void light_play_colors(uint16_t len, uint8_t *buffer) {
b = (uint8_t)((float)buffer[buffer_cursor + 2] * b = (uint8_t)((float)buffer[buffer_cursor + 2] *
display_ambient_light_brightness * display_ambient_light_brightness *
led_strip_blue_calibration); led_strip_blue_calibration);
if (r <= 10 && g <= 10 && b <= 10) { if (r <= 7 && g <= 7 && b <= 7) {
black_count++; black_count++;
} }
ESP_ERROR_CHECK( ESP_ERROR_CHECK(
light_led_strip->set_pixel(light_led_strip, led_index, r, g, b)); light_led_strip->set_pixel(light_led_strip, led_index, r, g, b));
} }
if (black_count > STRIP_LED_NUMBER / 4 * 3) { if (black_count > STRIP_LED_NUMBER / 5 * 4) {
ESP_ERROR_CHECK(light_led_strip->clear(light_led_strip, 100)); uint8_t r = (uint8_t)((float)50 * display_ambient_light_brightness *
uint8_t r = (uint8_t)((float)100 * display_ambient_light_brightness *
led_strip_red_calibration), led_strip_red_calibration),
g = (uint8_t)((float)100 * display_ambient_light_brightness * g = (uint8_t)((float)40 * display_ambient_light_brightness *
led_strip_green_calibration), led_strip_green_calibration),
b = (uint8_t)((float)100 * display_ambient_light_brightness * b = (uint8_t)((float)20 * display_ambient_light_brightness *
led_strip_blue_calibration); led_strip_blue_calibration);
for (uint16_t led_index = 0; led_index < STRIP_LED_NUMBER; led_index++) { for (uint16_t led_index = 0; led_index < STRIP_LED_NUMBER; led_index++) {
ESP_ERROR_CHECK( ESP_ERROR_CHECK(
light_led_strip->set_pixel(light_led_strip, led_index, r, g, b)); light_led_strip->set_pixel(light_led_strip, led_index, r, g, b));
} }
} else {
} }
ESP_ERROR_CHECK(light_led_strip->refresh(light_led_strip, 100)); ESP_ERROR_CHECK(light_led_strip->refresh(light_led_strip, 100));
vTaskDelay(pdMS_TO_TICKS(10)); vTaskDelay(pdMS_TO_TICKS(10));

View File

@ -28,7 +28,7 @@ void app_main(void) {
init_display(); init_display();
display_print8_str(0, 0, "Ambient Light"); display_print8_str(0, 0, "Ambient Light");
// hw_ms03_init(); // hw_ms03_init();
// ci_03t_init(); ci_03t_init();
apds_9960_init(); apds_9960_init();
apds_9960_auto_fetch(); apds_9960_auto_fetch();
auto_fetch_temperature(); auto_fetch_temperature();