only:unused-variable is a nice error message to have #5683

This commit is contained in:
Andrey 2023-11-02 15:27:56 -04:00
parent 114ae8e0bf
commit 3af8d69ad9
1 changed files with 6 additions and 5 deletions

View File

@ -560,6 +560,7 @@ void OutputPin::resetToggleStats() {
extern bool qcDirectPinControlMode;
void OutputPin::setValue(const char *msg, int logicValue, bool isForce) {
UNUSED(msg);
if ((qcDirectPinControlMode || getOutputOnTheBenchTest() == this) && !isForce) {
return;
}
@ -730,17 +731,17 @@ void OutputPin::initPin(const char *msg, brain_pin_e p_brainPin, pin_output_mode
#if EFI_GPIO_HARDWARE && EFI_PROD_CODE
efiSetPadMode(msg, brainPin, l_mode);
if (brain_pin_is_onchip(brainPin)) {
// todo: handle OM_OPENDRAIN and OM_OPENDRAIN_INVERTED as well
if (outputMode == OM_DEFAULT || outputMode == OM_INVERTED) {
#ifndef DISABLE_PIN_STATE_VALIDATION
int actualValue = palReadPad(port, pin);
// we had enough drama with pin configuration in board.h and else that we shall self-check
// todo: handle OM_OPENDRAIN and OM_OPENDRAIN_INVERTED as well
if (outputMode == OM_DEFAULT || outputMode == OM_INVERTED) {
const int logicalValue =
(outputMode == OM_INVERTED)
? !actualValue
: actualValue;
#ifndef DISABLE_PIN_STATE_VALIDATION
// if the pin was set to logical 1, then set an error and disable the pin so that things don't catch fire
if (logicalValue) {
criticalError("HARDWARE VALIDATION FAILED %s: unexpected startup pin state %s actual value=%d logical value=%d mode=%s", msg, hwPortname(brainPin), actualValue, logicalValue, getPin_output_mode_e(outputMode));