mirror of https://github.com/rusefi/rusefi.git
Fan not be able to be set because in use at VR PWM
#5565 showing both human and physical names into error message only:alphax-2chan
This commit is contained in:
parent
be68792d26
commit
1f4d9227bd
|
@ -58,9 +58,13 @@ bool brain_pin_markUsed(Gpio brainPin, const char *msg) {
|
|||
return true;
|
||||
|
||||
if (engine->pinRepository.getBrainUsedPin(index) != NULL) {
|
||||
/* TODO: get readable name of brainPin... */
|
||||
firmwareError(ObdCode::CUSTOM_ERR_PIN_ALREADY_USED_1, "Pin \"%s\" required by \"%s\" but is used by \"%s\"",
|
||||
// hwPortname and share a buffer behind the scenes, even while they probably never use it for different
|
||||
// values here let's have an explicit second buffer to make this more reliable
|
||||
char physicalPinName[32];
|
||||
strncpy(physicalPinName, hwPhysicalPinName(brainPin), sizeof(physicalPinName) - 1);
|
||||
firmwareError(ObdCode::CUSTOM_ERR_PIN_ALREADY_USED_1, "Pin \"%s\" (%s) required by \"%s\" but is used by \"%s\"",
|
||||
hwPortname(brainPin),
|
||||
physicalPinName,
|
||||
msg,
|
||||
getBrainUsedPin(index));
|
||||
return true;
|
||||
|
@ -194,17 +198,13 @@ __attribute__((weak)) const char * getBoardSpecificPinName(brain_pin_e /*brainPi
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const char *hwPortname(brain_pin_e brainPin) {
|
||||
const char *hwPhysicalPinName(Gpio brainPin) {
|
||||
if (brainPin == Gpio::Invalid) {
|
||||
return "INVALID";
|
||||
}
|
||||
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)) {
|
||||
|
@ -235,6 +235,14 @@ const char *hwPortname(brain_pin_e brainPin) {
|
|||
return portNameBuffer;
|
||||
}
|
||||
|
||||
const char *hwPortname(brain_pin_e brainPin) {
|
||||
const char * boardSpecificPinName = getBoardSpecificPinName(brainPin);
|
||||
if (boardSpecificPinName != nullptr) {
|
||||
return boardSpecificPinName;
|
||||
}
|
||||
return hwPhysicalPinName(brainPin);
|
||||
}
|
||||
|
||||
void initPinRepository(void) {
|
||||
/**
|
||||
* this method cannot use console because this method is invoked before console is initialized
|
||||
|
@ -306,7 +314,10 @@ const char *getPinFunction(brain_input_pin_e brainPin) {
|
|||
return getBrainUsedPin(index);
|
||||
}
|
||||
#else
|
||||
const char *hwPortname(brain_pin_e brainPin) {
|
||||
const char *hwPhysicalPinName(Gpio brainPin) {
|
||||
return "N/A";
|
||||
}
|
||||
const char *hwPortname(Gpio brainPin) {
|
||||
(void)brainPin;
|
||||
return "N/A";
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ ioportid_t getBrainPinPort(brain_pin_e brainPin);
|
|||
int getBrainPinIndex(Gpio brainPin);
|
||||
size_t getBrainPinOnchipNum();
|
||||
const char *hwPortname(Gpio brainPin);
|
||||
const char *hwPhysicalPinName(Gpio brainPin);
|
||||
// the main usage for human-readable board-specific pin reference is convenience of error messages in case of pin conflict.
|
||||
const char * getBoardSpecificPinName(Gpio brainPin);
|
||||
|
||||
|
|
Loading…
Reference in New Issue