fiatlux/firmware/fiatlux.c
2023-02-12 12:18:01 +01:00

40 lines
895 B
C

#include "system.h"
#include "wifi.h"
#include "web.h"
#include "mqtt.h"
#include "lux.h"
#include <stdio.h>
#include <FreeRTOS.h>
#include <task.h>
#include <espressif/esp_common.h>
#include <esp/uart.h>
#define PUB_MSG_LEN 16
void user_init(void) {
uart_set_baud(0, 115200);
printf("SDK version: %s\n", sdk_system_get_sdk_version());
sdk_wifi_set_sleep_type(WIFI_SLEEP_MODEM);
system_init_config();
wifi_available_semaphore = xSemaphoreCreateBinary();
xTaskCreate(mqtt_task, "mqtt_task", 1024, NULL, 1, NULL);
xTaskCreate(wifi_task, "wifi_task", 1024, NULL, 1, NULL);
xTaskCreate(&httpd_task, "httpd_task", 1024, NULL, 2, NULL);
xTaskCreate(&lux_task, "lux_task", 512, NULL, 1, NULL);
wifi_alive = xSemaphoreCreateBinary();
publish_queue = xQueueCreate(3, PUB_MSG_LEN);
xTaskCreate(&beat_task, "beat_task", 256, NULL, 3, NULL);
}