WIP: System Events

This commit is contained in:
Joe Kearney 2025-11-22 14:18:35 -06:00
parent 1c2f281579
commit c979c38fd7
46 changed files with 647 additions and 470 deletions

View file

@ -3,8 +3,8 @@ dependencies:
chmorgan/esp-libhelix-mp3: "^1.0.3"
chmorgan/esp-audio-player: "^1.0.7"
espressif/button: "^3.5.0"
espressif/mdns: "^1.8.2"
espressif/usb_host_msc: "^1.1.3"
espressif/mdns: "^1.9.1"
espressif/usb_host_msc: "^1.1.4"
## Required IDF version (>=5.1 is required for the SPI backend of the led-strip component.)
## We tested with 5.5.1.

View file

@ -41,6 +41,7 @@
#include <string.h>
#include <SystemK.h>
#include <System_Events.h>
#include <SPIFFS.h>
#include <USB.h>
#include <I2S_Audio.h>
@ -62,6 +63,9 @@ void app_main(void)
KLOG_INFO(TAG, VERSION_AS_STR());
KLOG_INFO(TAG, "Initializing app...");
Initialize_System_Events();
init_complete_semaphore = xSemaphoreCreateBinary();
// Initialize NVS — it is used by both the BLE and WiFi drivers.
@ -71,7 +75,17 @@ void app_main(void)
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK(ret);
if (ret == ESP_OK)
{
xEventGroupSetBits(Get_System_Events(), SYS_NVS_READY);
KLOG_INFO(TAG, "NVS initialized.");
}
else
{
KLOG_ERROR(TAG, "Error initializing NVS: %s", esp_err_to_name(ret));
}
Initialize_SPIFFS(init_complete_semaphore);
if (xSemaphoreTake(init_complete_semaphore, pdMS_TO_TICKS(INITIALIZATION_TIMEOUT_IN_ms)) != pdTRUE)