finish project

This commit is contained in:
2024-05-15 18:57:11 +03:00
parent ccbffe76cc
commit df1536fd6f
62 changed files with 17547 additions and 73841 deletions

View File

@@ -253,6 +253,18 @@ void isr_init()
}
void welcome_strip()
{
for (int i = 0; i < LED_STRIP_LED_NUMBERS; i++) {
ESP_ERROR_CHECK(led_strip_set_pixel(led_strip1, i, 0, 255, 0));
ESP_ERROR_CHECK(led_strip_set_pixel(led_strip2, i, 0, 255, 0));
ESP_ERROR_CHECK(led_strip_refresh(led_strip1));
ESP_ERROR_CHECK(led_strip_refresh(led_strip2));
vTaskDelay(pdMS_TO_TICKS(100));
}
}
void blink_strip(uint32_t nled, uint32_t count, uint32_t period)
{
@@ -262,7 +274,7 @@ void blink_strip(uint32_t nled, uint32_t count, uint32_t period)
for (int i = 0; i < LED_STRIP_LED_NUMBERS; i++) { // R G B
if(nled == 1) ESP_ERROR_CHECK(led_strip_set_pixel(led_strip1, i, 0, 0, 255));
if(nled == 2) ESP_ERROR_CHECK(led_strip_set_pixel(led_strip2, i, 240, 252, 3));
}
}
if(nled == 1)ESP_ERROR_CHECK(led_strip_refresh(led_strip1));
if(nled == 2)ESP_ERROR_CHECK(led_strip_refresh(led_strip2));
} else {
@@ -285,34 +297,35 @@ void app_main(void)
Turn of warnings from HTTP server as redirecting traffic will yield
lots of invalid requests
*/
esp_log_level_set("httpd_uri", ESP_LOG_ERROR);
esp_log_level_set("httpd_txrx", ESP_LOG_ERROR);
esp_log_level_set("httpd_parse", ESP_LOG_ERROR);
//esp_log_level_set("httpd_uri", ESP_LOG_ERROR);
//esp_log_level_set("httpd_txrx", ESP_LOG_ERROR);
//esp_log_level_set("httpd_parse", ESP_LOG_ERROR);
strip_init();
isr_init();
// Initialize networking stack
ESP_ERROR_CHECK(esp_netif_init());
//ESP_ERROR_CHECK(esp_netif_init());
// Create default event loop needed by the main app
ESP_ERROR_CHECK(esp_event_loop_create_default());
//ESP_ERROR_CHECK(esp_event_loop_create_default());
// Initialize NVS needed by Wi-Fi
ESP_ERROR_CHECK(nvs_flash_init());
// ESP_ERROR_CHECK(nvs_flash_init());
// Initialize Wi-Fi including netif with default config
esp_netif_create_default_wifi_ap();
//esp_netif_create_default_wifi_ap();
// Initialise ESP32 in SoftAP mode
wifi_init_softap();
//wifi_init_softap();
// Start the server for the first time
start_webserver();
//start_webserver();
// Start the DNS server that will redirect all queries to the softAP IP
dns_server_config_t config = DNS_SERVER_CONFIG_SINGLE("*" /* all A queries */, "WIFI_AP_DEF" /* softAP netif ID */);
start_dns_server(&config);
//dns_server_config_t config = DNS_SERVER_CONFIG_SINGLE("*" /* all A queries */, "WIFI_AP_DEF" /* softAP netif ID */);
//start_dns_server(&config);
welcome_strip();
ESP_LOGI(TAG, "Information messages which describe normal flow of events");
while (1) {