Fix HAL init when touch isn't configured (#325)

This commit is contained in:
Ken Van Hoeylandt 2025-09-07 12:47:58 +02:00 committed by GitHub
parent f26266ba76
commit fe7fdd8583
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -59,23 +59,28 @@ void registerDevices(const Configuration& configuration) {
} }
static void startDisplays() { static void startDisplays() {
TT_LOG_I(TAG, "Start displays"); TT_LOG_I(TAG, "Starting displays & touch");
auto displays = hal::findDevices<display::DisplayDevice>(Device::Type::Display); auto displays = hal::findDevices<display::DisplayDevice>(Device::Type::Display);
for (auto& display : displays) { for (auto& display : displays) {
TT_LOG_I(TAG, "%s starting", display->getName().c_str());
if (!display->start()) { if (!display->start()) {
TT_LOG_E(TAG, "Display start failed"); TT_LOG_E(TAG, "%s start failed", display->getName().c_str());
} else { } else {
TT_LOG_I(TAG, "Started %s", display->getName().c_str()); TT_LOG_I(TAG, "%s started", display->getName().c_str());
if (display->supportsBacklightDuty()) { if (display->supportsBacklightDuty()) {
TT_LOG_I(TAG, "Setting backlight");
display->setBacklightDuty(0); display->setBacklightDuty(0);
} }
auto touch = display->getTouchDevice(); auto touch = display->getTouchDevice();
if (touch != nullptr && !touch->start()) { if (touch != nullptr) {
TT_LOG_E(TAG, "Touch start failed"); TT_LOG_I(TAG, "%s starting", touch->getName().c_str());
if (!touch->start()) {
TT_LOG_E(TAG, "%s start failed", touch->getName().c_str());
} else { } else {
TT_LOG_I(TAG, "Started %s", touch->getName().c_str()); TT_LOG_I(TAG, "%s started", touch->getName().c_str());
}
} }
} }
} }