- Remove custom `ESP_TARGET` and use `ESP_PLATFORM` everywhere - Add `Loader` service functionality to `tt::app::` namespace - Make `Loader` `PubSub` usable by exposing the messages - Add board type to crash log - Don't show SD card in Files app when it's not mounted - Set default SPI frequency for SD cards - Move TT_VERSION to scope that works for sim too - Log Tactility version and board on boot - Rename "Yellow Board" to "CYD 2432S024C"
66 lines
1.6 KiB
C++
66 lines
1.6 KiB
C++
#include <Dispatcher.h>
|
|
#include "TactilityHeadless.h"
|
|
#include "hal/Configuration.h"
|
|
#include "hal/Hal_i.h"
|
|
#include "service/ServiceManifest.h"
|
|
#include "service/ServiceRegistry.h"
|
|
#include "kernel/SystemEvents.h"
|
|
#include "network/NtpPrivate.h"
|
|
#include "time/TimePrivate.h"
|
|
|
|
#ifdef ESP_PLATFORM
|
|
#include "EspInit.h"
|
|
#endif
|
|
|
|
namespace tt {
|
|
|
|
#define TAG "tactility"
|
|
|
|
namespace service::wifi { extern const ServiceManifest manifest; }
|
|
namespace service::sdcard { extern const ServiceManifest manifest; }
|
|
|
|
static Dispatcher mainDispatcher;
|
|
|
|
static const service::ServiceManifest* const system_services[] = {
|
|
&service::sdcard::manifest,
|
|
&service::wifi::manifest
|
|
};
|
|
|
|
static const hal::Configuration* hardwareConfig = nullptr;
|
|
|
|
static void register_and_start_system_services() {
|
|
TT_LOG_I(TAG, "Registering and starting system services");
|
|
int app_count = sizeof(system_services) / sizeof(service::ServiceManifest*);
|
|
for (int i = 0; i < app_count; ++i) {
|
|
addService(system_services[i]);
|
|
tt_check(service::startService(system_services[i]->id));
|
|
}
|
|
}
|
|
|
|
void initHeadless(const hal::Configuration& config) {
|
|
TT_LOG_I(TAG, "Tactility v%s on %s (%s)", TT_VERSION, CONFIG_TT_BOARD_NAME, CONFIG_TT_BOARD_ID);
|
|
#ifdef ESP_PLATFORM
|
|
initEsp();
|
|
#endif
|
|
hardwareConfig = &config;
|
|
time::init();
|
|
hal::init(config);
|
|
network::ntp::init();
|
|
register_and_start_system_services();
|
|
}
|
|
|
|
|
|
Dispatcher& getMainDispatcher() {
|
|
return mainDispatcher;
|
|
}
|
|
|
|
namespace hal {
|
|
|
|
const Configuration* getConfiguration() {
|
|
return hardwareConfig;
|
|
}
|
|
|
|
} // namespace hal
|
|
|
|
} // namespace tt
|