mirror of
https://github.com/HendrikRauh/dmx-interface.git
synced 2026-03-09 13:30:20 +00:00
add(web_server): init basic webserver
This commit is contained in:
parent
4d8be45e48
commit
7ea7944e91
10 changed files with 447 additions and 1 deletions
|
|
@ -1,6 +1,39 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "web_server.h"
|
||||
#include "wifi.h"
|
||||
|
||||
static const char *TAG = "MAIN";
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
ESP_LOGI(TAG, "DMX Interface starting...");
|
||||
|
||||
esp_err_t wifi_err = wifi_start_ap("DMX", "mbgmbgmbg", 1, 4);
|
||||
if (wifi_err != ESP_OK)
|
||||
{
|
||||
ESP_LOGE(TAG, "Failed to start WiFi AP: %s", esp_err_to_name(wifi_err));
|
||||
return;
|
||||
}
|
||||
|
||||
// Start HTTP web server
|
||||
httpd_handle_t server = webserver_start(NULL);
|
||||
if (server == NULL)
|
||||
{
|
||||
ESP_LOGE(TAG, "Failed to start web server!");
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "Web server started successfully");
|
||||
ESP_LOGI(TAG, "Open http://192.168.4.1 in your browser");
|
||||
|
||||
// Keep the app running
|
||||
while (1)
|
||||
{
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue