feat: ping pong.

This commit is contained in:
Ivan Li 2023-04-30 23:23:25 +08:00
parent 05660afc54
commit 0f5e2a9664
3 changed files with 16 additions and 9 deletions

View File

@ -85,6 +85,8 @@ void led_strip_set_color_calibration(float red, float green, float blue) {
led_strip_green_calibration = green;
led_strip_blue_calibration = blue;
ESP_LOGI(LIGHT_TAG, "Calibration: %f %f %f", red, green, blue);
nvs_handle_t local_nvs_handle;
esp_err_t err = nvs_open("storage", NVS_READWRITE, &local_nvs_handle);

View File

@ -29,15 +29,15 @@ void app_main(void) {
init_display();
display_print8_str(0, 0, "Ambient Light");
// ci_03t_init();
// apds_9960_init();
// apds_9960_auto_fetch();
// auto_fetch_temperature();
// pca9555_init();
// ui_input_init();
// xTaskCreate(mqtt_publish_ui_input, "mqtt_publish_ui_input", 2048, NULL, 10,
// NULL);
// vTaskDelay(pdMS_TO_TICKS(10));
ci_03t_init();
apds_9960_init();
apds_9960_auto_fetch();
auto_fetch_temperature();
pca9555_init();
ui_input_init();
xTaskCreate(mqtt_publish_ui_input, "mqtt_publish_ui_input", 2048, NULL, 10,
NULL);
vTaskDelay(pdMS_TO_TICKS(10));
light_play(light_mode_connection_wifi);
if (connect_wifi()) {
light_play(light_mode_idle);

View File

@ -83,6 +83,11 @@ static void udp_server_task(void *pvParameters) {
// like a string...
switch (rx_buffer[0]) {
case 1:
sendto(sock, rx_buffer, 1, 0, (struct sockaddr *)&source_addr,
sizeof(source_addr));
break;
case 2:
set_display_ambient_light_colors(
((uint16_t)rx_buffer[1] << 8 | (uint16_t)rx_buffer[2]),