Wifi_Onboarding_v1/main/main.c
2025-02-21 15:00:04 +05:30

49 lines
1.0 KiB
C

#include <stdio.h>
#include <stdbool.h>
#include <unistd.h>
#include "esp_log.h"
#include "nvm.h"
#include "port.h"
#include "uart_ifx.h"
#include "wifi_webServer.h"
#include "comms.h"
#include "main.h"
static const char* TAG = "MAIN";
uint8_t comms_mode = DEFAULT_COMMS_MODE;
void app_main(void)
{
ESP_LOGI(TAG,"*** Starting app_main ***");
/* Initialize the dedicated NVS partition */
nvm_init();
port_init();
uart_ifx_init();
/* Create the UART tasks for both UART0 and UART1 */
uart_create_rx_tasks();
/* read the comms-mode from the NVS (if any) */
comms_mode = nvm_read_comms_mode();
if((COMMS_OVER_CELL != comms_mode))
{
/* Start On-Boarding process */
webserver_start();
/* Wait till the onboarding process is completed */
while(!webserver_get_status())
{
//ESP_LOGI(TAG," -------------> PASSWORD is: %s",wifi_get_pswd());
vTaskDelay(750/portTICK_PERIOD_MS);
}
}
ESP_LOGI(TAG," -------------> Wifi Connected ... :)");
while(1);
vTaskDelete(NULL);
}