From 984b874d7e53980f96fb1581f32d771f78cb91ab Mon Sep 17 00:00:00 2001 From: jacqueline Date: Fri, 28 Jun 2024 15:34:11 +1000 Subject: Fix some issues with the splash screen - fix a use-after-free involving the alerts container that was happening when showing the first screen - fix some issues where the splash screen wouldn't come up as early as it needs to when another bootup task was making heavy use of the spi bus --- src/drivers/display.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/drivers') diff --git a/src/drivers/display.cpp b/src/drivers/display.cpp index 2ae70d61..efc9df93 100644 --- a/src/drivers/display.cpp +++ b/src/drivers/display.cpp @@ -213,6 +213,12 @@ auto Display::SetDutyCycle(uint_fast8_t new_duty, bool fade) -> void { } void Display::SendInitialisationSequence(const uint8_t* data) { + // Hold the SPI bus for the entire init sequence, as otherwise SD init may + // grab it and delay showing the boot splash. The total time until boot is + // finished may be increased by doing this, but a short boot with no feedback + // feels worse than a longer boot that doesn't tell you anything. + spi_device_acquire_bus(handle_, portMAX_DELAY); + // First byte of the data is the number of commands. for (int i = *(data++); i > 0; i--) { uint8_t command = *(data++); @@ -232,6 +238,8 @@ void Display::SendInitialisationSequence(const uint8_t* data) { vTaskDelay(pdMS_TO_TICKS(sleep_duration_ms)); } } + + spi_device_release_bus(handle_); } void Display::SendCommandWithData(uint8_t command, -- cgit v1.2.3