2021-07-09 19:35:41 +00:00
|
|
|
#include "system.h"
|
2021-07-02 16:45:29 +00:00
|
|
|
#include "wifi.h"
|
|
|
|
#include "web.h"
|
|
|
|
#include "mqtt.h"
|
|
|
|
#include "lux.h"
|
2023-02-12 05:53:41 +00:00
|
|
|
#include "esplibs/libmain.h"
|
2021-06-19 14:42:38 +00:00
|
|
|
|
2021-07-09 19:42:44 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <FreeRTOS.h>
|
|
|
|
#include <task.h>
|
|
|
|
|
|
|
|
#include <espressif/esp_common.h>
|
|
|
|
#include <esp/uart.h>
|
2021-06-19 14:42:38 +00:00
|
|
|
|
2022-06-27 18:00:48 +00:00
|
|
|
#define PUB_MSG_LEN 16
|
|
|
|
|
|
|
|
void user_init(void) {
|
2021-06-19 14:42:38 +00:00
|
|
|
uart_set_baud(0, 115200);
|
|
|
|
printf("SDK version: %s\n", sdk_system_get_sdk_version());
|
|
|
|
|
|
|
|
sdk_wifi_set_sleep_type(WIFI_SLEEP_MODEM);
|
|
|
|
|
2021-07-09 19:35:41 +00:00
|
|
|
system_init_config();
|
2021-07-09 19:42:44 +00:00
|
|
|
|
2023-02-12 05:53:41 +00:00
|
|
|
sdk_system_overclock();
|
|
|
|
|
|
|
|
printf("CPU freq: %d\n", sdk_system_get_cpu_freq());
|
|
|
|
|
2021-07-18 22:18:16 +00:00
|
|
|
wifi_available_semaphore = xSemaphoreCreateBinary();
|
|
|
|
|
2023-01-19 06:07:24 +00:00
|
|
|
//xTaskCreate(mqtt_task, "mqtt_task", 1024, NULL, 1, NULL);
|
2021-09-12 19:42:55 +00:00
|
|
|
|
2021-08-28 21:44:01 +00:00
|
|
|
xTaskCreate(wifi_task, "wifi_task", 1024, NULL, 1, NULL);
|
2021-07-09 19:42:44 +00:00
|
|
|
|
2021-08-28 21:44:01 +00:00
|
|
|
xTaskCreate(&httpd_task, "httpd_task", 1024, NULL, 2, NULL);
|
2021-07-19 20:31:30 +00:00
|
|
|
|
|
|
|
xTaskCreate(&lux_task, "lux_task", 512, NULL, 1, NULL);
|
2022-06-27 18:00:48 +00:00
|
|
|
|
|
|
|
wifi_alive = xSemaphoreCreateBinary();
|
|
|
|
publish_queue = xQueueCreate(3, PUB_MSG_LEN);
|
|
|
|
|
2023-01-19 06:07:24 +00:00
|
|
|
//xTaskCreate(&beat_task, "beat_task", 256, NULL, 3, NULL);
|
2022-06-27 18:00:48 +00:00
|
|
|
|
|
|
|
|
2021-06-19 14:42:38 +00:00
|
|
|
}
|