Tactility/TactilityHeadless/Source/TactilityHeadlessEsp.cpp
Ken Van Hoeylandt ff4287e2ce
Filesystem improvements and more (#148)
- Rename `assets` and `config` partitions to `system` and `data`
- Change partition type from `spiffs` to `fat`, so we can have sub-directories
- Fix crash when doing WiFi scan: Increased system event task size to 3kB. 
- Free up IRAM on ESP32 (it was required for the Core2, but I also freed up the same amount for Yellow Board)
- Introduced `Paths` objects that can be retrieved by `AppContext` and `ServiceContext`. Apps and services now have their own relative paths. Assets were re-arranged into the correct paths.
- Rename simulator window title to "Tactility"
- Refactored statusbar widget so it persists icon paths properly (it kept a const char* reference, but didn't copy it, so it crashed when the related std::string was destroyed)
- Created `Partitions.h` to expose some useful variables
- Moved USB config in various `sdkconfig`  (it was part of the "default" section, but it shouldn't be)
- Updated domain name
2025-01-05 20:44:33 +01:00

39 lines
763 B
C++

#ifdef ESP_TARGET
#include "TactilityCore.h"
#include "EspPartitions_i.h"
#include "esp_event.h"
#include "esp_netif.h"
#include "nvs_flash.h"
namespace tt {
#define TAG "tactility"
// Initialize NVS
static void initNvs() {
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
TT_LOG_I(TAG, "nvs erasing");
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK(ret);
TT_LOG_I(TAG, "nvs initialized");
}
static void initNetwork() {
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
}
void initEsp() {
initNvs();
initPartitionsEsp();
initNetwork();
}
} // namespace
#endif