simpler 'isSdCardEnabled' logic

only:uaefi
This commit is contained in:
rusefillc 2024-09-19 16:40:51 -04:00
parent 21d0340541
commit a5fc4550d3
2 changed files with 13 additions and 10 deletions

View File

@ -342,12 +342,6 @@ static BaseBlockDevice* initializeMmcBlockDevice() {
return nullptr;
}
if (!engineConfiguration->isSdCardEnabled ||
engineConfiguration->sdCardSpiDevice == SPI_NONE ||
!isBrainPinValid(engineConfiguration->sdCardCsPin)) {
return nullptr;
}
// Configures and activates the MMC peripheral.
mmcSpiDevice = engineConfiguration->sdCardSpiDevice;
@ -390,10 +384,6 @@ static const SDCConfig sdcConfig = {
};
static BaseBlockDevice* initializeMmcBlockDevice() {
if (!engineConfiguration->isSdCardEnabled) {
return nullptr;
}
sdcStart(&EFI_SDC_DEVICE, &sdcConfig);
sdStatus = SD_STATE_CONNECTING;
if (blkConnect(&EFI_SDC_DEVICE) != HAL_SUCCESS) {
@ -637,7 +627,17 @@ void initEarlyMmcCard() {
#endif // EFI_PROD_CODE
}
static bool isSdCardEnabled() {
return engineConfiguration->isSdCardEnabled &&
engineConfiguration->sdCardSpiDevice != SPI_NONE &&
isBrainPinValid(engineConfiguration->sdCardCsPin);
}
void initMmcCard() {
if (isSdCardEnabled()) {
// do not even bother starting the thread if SD card is not enabled & configured on start-up
return;
}
chThdCreateStatic(mmcThreadStack, sizeof(mmcThreadStack), PRIO_MMC, (tfunc_t)(void*) MMCmonThread, NULL);
}

View File

@ -295,6 +295,9 @@ enable2ndByteCanID = false
maintainConstantValue = throttlePedalWOTVoltage, { (calibrationMode == @@TsCalMode_PedalMax@@ ) ? calibrationValue : throttlePedalWOTVoltage }
maintainConstantValue = throttlePedalSecondaryWOTVoltage, { (calibrationMode == @@TsCalMode_PedalMax@@ ) ? calibrationValue2 : throttlePedalSecondaryWOTVoltage }
requiresPowerCycle = isSdCardEnabled
requiresPowerCycle = sdCardSpiDevice
requiresPowerCycle = sdCardCsPin
requiresPowerCycle = boardUseCanTerminator
requiresPowerCycle = injectorCompensationMode
requiresPowerCycle = lps25BaroSensorScl