From 014b8293a50351aea96077d5fcefc09644ab47d7 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Thu, 3 Feb 2022 12:45:26 -0500 Subject: [PATCH] User board-specific terms in error messages #3886 progress --- firmware/controllers/system/efi_gpio.h | 1 - firmware/hw_layer/pin_repository.cpp | 9 +++++++++ firmware/hw_layer/pin_repository.h | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/firmware/controllers/system/efi_gpio.h b/firmware/controllers/system/efi_gpio.h index e5f448befb..5d4feaf238 100644 --- a/firmware/controllers/system/efi_gpio.h +++ b/firmware/controllers/system/efi_gpio.h @@ -252,6 +252,5 @@ const char *portname(ioportid_t GPIOx); void printSpiConfig(const char *msg, spi_device_e device); brain_pin_e parseBrainPin(const char *str); -const char *hwPortname(brain_pin_e brainPin); extern EnginePins enginePins; diff --git a/firmware/hw_layer/pin_repository.cpp b/firmware/hw_layer/pin_repository.cpp index f44d4c3c07..6ff2170d87 100644 --- a/firmware/hw_layer/pin_repository.cpp +++ b/firmware/hw_layer/pin_repository.cpp @@ -189,6 +189,10 @@ void printSpiConfig(const char *msg, spi_device_e device) { #endif // HAL_USE_SPI } +__attribute__((weak)) const char * getBoardSpecificPinName(brain_pin_e brainPin) { + return nullptr; +} + const char *hwPortname(brain_pin_e brainPin) { if (brainPin == GPIO_INVALID) { return "INVALID"; @@ -196,6 +200,11 @@ const char *hwPortname(brain_pin_e brainPin) { if (brainPin == GPIO_UNASSIGNED) { return "NONE"; } + const char * boardSpecificPinName = getBoardSpecificPinName(brainPin); + if (boardSpecificPinName != nullptr) { + return boardSpecificPinName; + } + portNameStream.eos = 0; // reset if (brain_pin_is_onchip(brainPin)) { diff --git a/firmware/hw_layer/pin_repository.h b/firmware/hw_layer/pin_repository.h index e01abdb598..141ba16f43 100644 --- a/firmware/hw_layer/pin_repository.h +++ b/firmware/hw_layer/pin_repository.h @@ -58,6 +58,8 @@ int getBrainPinIndex(brain_pin_e brainPin); int brainPin_to_index(brain_pin_e brainPin); unsigned int getBrainPinOnchipNum(void); unsigned int getBrainPinTotalNum(void); +const char *hwPortname(brain_pin_e brainPin); +const char * getBoardSpecificPinName(brain_pin_e brainPin); #ifdef __cplusplus const char* & getBrainUsedPin(unsigned int idx);