fix lock in setupSDCard()

This commit is contained in:
Manuel 2024-12-21 12:19:08 +01:00 committed by GitHub
parent 058980178c
commit da13c5e36e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -363,7 +363,7 @@ void fsInit()
void setupSDCard()
{
#ifdef HAS_SDCARD
spiLock->lock();
concurrency::LockGuard g(spiLock);
SDHandler.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
if (!SD.begin(SDCARD_CS, SDHandler)) {
@ -390,6 +390,5 @@ void setupSDCard()
LOG_DEBUG("SD Card Size: %lu MB", (uint32_t)cardSize);
LOG_DEBUG("Total space: %lu MB", (uint32_t)(SD.totalBytes() / (1024 * 1024)));
LOG_DEBUG("Used space: %lu MB", (uint32_t)(SD.usedBytes() / (1024 * 1024)));
spiLock->unlock();
#endif
}
}