From 95d7b7f4fc16a4453c02f2a6f9bb255024d1428b Mon Sep 17 00:00:00 2001 From: rusefi Date: Wed, 7 Aug 2024 23:07:06 -0400 Subject: [PATCH] only:alphax-4k-gdi_debug --- .../alphax-4K-GDI/meta-info-alphax-4k-gdi_debug.env | 2 +- firmware/hw_layer/hardware.cpp | 4 ++-- firmware/hw_layer/mc33816.cpp | 10 +++++++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/firmware/config/boards/hellen/alphax-4K-GDI/meta-info-alphax-4k-gdi_debug.env b/firmware/config/boards/hellen/alphax-4K-GDI/meta-info-alphax-4k-gdi_debug.env index b8d6dec887..0881e65405 100644 --- a/firmware/config/boards/hellen/alphax-4K-GDI/meta-info-alphax-4k-gdi_debug.env +++ b/firmware/config/boards/hellen/alphax-4K-GDI/meta-info-alphax-4k-gdi_debug.env @@ -1,6 +1,6 @@ SHORT_BOARD_NAME=alphax-4k-gdi PROJECT_CPU=ARCH_STM32F7 -SKIP_RATE=10 +SKIP_RATE=100 EXTRA_PARAMS=-DEFI_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_CHECKS=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE -DEFI_LUA=FALSE -DEFI_HPFP=FALSE -DEFI_ALTERNATOR_CONTROL=FALSE -DEFI_LOGIC_ANALYZER=FALSE -DEFI_TOOTH_LOGGER=FALSE -DRAMDISK_INVALID DEBUG_LEVEL_OPT=-O0 -ggdb -g INCLUDE_ELF=yes diff --git a/firmware/hw_layer/hardware.cpp b/firmware/hw_layer/hardware.cpp index 3db8a10c68..87017c01fe 100644 --- a/firmware/hw_layer/hardware.cpp +++ b/firmware/hw_layer/hardware.cpp @@ -142,7 +142,7 @@ brain_pin_e getSckPin(spi_device_e device) { */ SPIDriver * getSpiDevice(spi_device_e spiDevice) { if (spiDevice == SPI_NONE) { - return NULL; + return nullptr; } #if STM32_SPI_USE_SPI1 if (spiDevice == SPI_DEVICE_1) { @@ -175,7 +175,7 @@ SPIDriver * getSpiDevice(spi_device_e spiDevice) { } #endif firmwareError(ObdCode::CUSTOM_ERR_UNEXPECTED_SPI, "Unexpected SPI device: %d", spiDevice); - return NULL; + return nullptr; } /** diff --git a/firmware/hw_layer/mc33816.cpp b/firmware/hw_layer/mc33816.cpp index e77c756012..d0ae9f97d6 100644 --- a/firmware/hw_layer/mc33816.cpp +++ b/firmware/hw_layer/mc33816.cpp @@ -187,16 +187,24 @@ void Pt2001::init() { spiCfg.ssport = getHwPort("mc33816", engineConfiguration->mc33816_cs); spiCfg.sspad = getHwPin("mc33816", engineConfiguration->mc33816_cs); +#if HW_MICRO_RUSEFI // hard-coded for now, just resolve the conflict with SD card! engineConfiguration->mc33816spiDevice = SPI_DEVICE_3; +#endif + + if (engineConfiguration->mc33816spiDevice == SPI_NONE) { + criticalError("mc33816 needs SPI selection"); + } driver = getSpiDevice(engineConfiguration->mc33816spiDevice); - if (driver == NULL) { + if (driver == nullptr) { // error already reported return; } + efiPrintf("mc33 starting SPI"); spiStart(driver, &spiCfg); + efiPrintf("mc33 started SPI"); // addConsoleAction("mc33_stats", showStats); // addConsoleAction("mc33_restart", mcRestart);