fix hanging

This commit is contained in:
2025-10-12 20:37:30 +02:00
parent 088c6e47bd
commit 7474f65aaa
8 changed files with 28 additions and 0 deletions

View File

@@ -61,6 +61,7 @@ private:
class HighResClockService;
class PowerService;
class FilesystemService;
class LoopHooksService;
std::unique_ptr<BuzzerService> buzzerService;
std::unique_ptr<BatteryService> batteryService;
@@ -70,6 +71,7 @@ private:
std::unique_ptr<PowerService> powerService;
std::unique_ptr<FilesystemService> filesystemService;
std::unique_ptr<EventBus> eventBus;
std::unique_ptr<LoopHooksService> loopHooksService;
cardboy::sdk::Services services{};
};

View File

@@ -128,6 +128,11 @@ public:
}
};
class EspRuntime::LoopHooksService final : public cardboy::sdk::ILoopHooks {
public:
void onLoopIteration() override { vTaskDelay(1); }
};
EspRuntime::EspRuntime() : framebuffer(), input(), clock() {
initializeHardware();
@@ -139,6 +144,7 @@ EspRuntime::EspRuntime() : framebuffer(), input(), clock() {
powerService = std::make_unique<PowerService>();
filesystemService = std::make_unique<FilesystemService>();
eventBus = std::make_unique<EventBus>();
loopHooksService = std::make_unique<LoopHooksService>();
services.buzzer = buzzerService.get();
services.battery = batteryService.get();
@@ -148,6 +154,7 @@ EspRuntime::EspRuntime() : framebuffer(), input(), clock() {
services.powerManager = powerService.get();
services.filesystem = filesystemService.get();
services.eventBus = eventBus.get();
services.loopHooks = loopHooksService.get();
Buttons::get().setEventBus(eventBus.get());
}