nicer pin names for messages while same short names for engine sniffer

This commit is contained in:
rusefi 2019-05-15 04:26:41 -04:00
parent 67a08fd91f
commit 1c36b89141
5 changed files with 32 additions and 15 deletions

View File

@ -810,6 +810,6 @@ int getRusEfiVersion(void) {
if (initBootloader() != 0)
return 123;
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
return 20190510;
return 20190515;
}
#endif /* EFI_UNIT_TEST */

View File

@ -33,13 +33,20 @@ extern LoggingWithStorage sharedLogger;
pin_output_mode_e DEFAULT_OUTPUT = OM_DEFAULT;
static const char *sparkNames[IGNITION_PIN_COUNT] = { "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8",
static const char *sparkNames[IGNITION_PIN_COUNT] = { "coil1", "coil2", "coil3", "coil4", "coil5", "coil6", "coil7", "coil8",
"coil9", "coil10", "coil11", "coil12"};
// these short names are part of engine sniffer protocol
static const char *sparkShortNames[IGNITION_PIN_COUNT] = { "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8",
"c9", "cA", "cB", "cD"};
static const char *injectorNames[INJECTION_PIN_COUNT] = { "i1", "i2", "i3", "i4", "i5", "i6", "i7", "i8",
static const char *injectorNames[INJECTION_PIN_COUNT] = { "injector1", "injector2", "injector3", "injector4", "injector5", "injector6",
"injector7", "injector8", "jnjector9", "injector10", "injector11", "injector12"};
static const char *injectorShortNames[INJECTION_PIN_COUNT] = { "i1", "i2", "i3", "i4", "i5", "i6", "i7", "i8",
"j9", "iA", "iB", "iC"};
static const char *auxValveNames[INJECTION_PIN_COUNT] = { "a1", "a2"};
static const char *auxValveShortNames[INJECTION_PIN_COUNT] = { "a1", "a2"};
EnginePins::EnginePins() {
dizzyOutput.name = DIZZY_NAME;
@ -47,13 +54,15 @@ EnginePins::EnginePins() {
for (int i = 0; i < IGNITION_PIN_COUNT;i++) {
enginePins.coils[i].name = sparkNames[i];
enginePins.coils[i].shortName = sparkShortNames[i];
}
for (int i = 0; i < INJECTION_PIN_COUNT;i++) {
enginePins.injectors[i].injectorIndex = i;
enginePins.injectors[i].name = injectorNames[i];
enginePins.injectors[i].shortName = injectorShortNames[i];
}
for (int i = 0; i < AUX_DIGITAL_VALVE_COUNT;i++) {
enginePins.auxValve[i].name = auxValveNames[i];
enginePins.auxValve[i].name = auxValveShortNames[i];
}
}
@ -209,6 +218,14 @@ NamedOutputPin::NamedOutputPin() : OutputPin() {
name = NULL;
}
const char *NamedOutputPin::getName() {
return name;
}
const char *NamedOutputPin::getShortName() {
return shortName == NULL ? name : shortName;
}
NamedOutputPin::NamedOutputPin(const char *name) : OutputPin() {
this->name = name;
}
@ -223,7 +240,7 @@ void NamedOutputPin::setHigh() {
#if EFI_ENGINE_SNIFFER
addEngineSnifferEvent(name, WC_UP);
addEngineSnifferEvent(getShortName(), WC_UP);
#endif /* EFI_ENGINE_SNIFFER */
}
@ -238,7 +255,7 @@ void NamedOutputPin::setLow() {
#endif /* EFI_DEFAILED_LOGGING */
#if EFI_ENGINE_SNIFFER
addEngineSnifferEvent(name, WC_DOWN);
addEngineSnifferEvent(getShortName(), WC_DOWN);
#endif /* EFI_ENGINE_SNIFFER */
}

View File

@ -77,12 +77,15 @@ public:
NamedOutputPin(const char *name);
void setHigh();
void setLow();
const char *getName();
const char *getShortName();
/**
* @return true if pin was stopped
*/
bool stop();
// todo: char pointer is a bit of a memory waste here, we can reduce RAM usage by software-based getName() method
const char *name;
const char *shortName = NULL;
};
class InjectorOutputPin : public NamedOutputPin {

View File

@ -51,7 +51,7 @@ static void fireSparkBySettingPinLow(IgnitionEvent *event, IgnitionOutputPin *ou
output->signalFallSparkId = event->sparkId;
if (!output->currentLogicValue) {
warning(CUSTOM_OUT_OF_ORDER_COIL, "out-of-order coil off %s", output->name);
warning(CUSTOM_OUT_OF_ORDER_COIL, "out-of-order coil off %s", output->getName());
output->outOfOrder = true;
}
@ -66,7 +66,7 @@ static void fireSparkBySettingPinLow(IgnitionEvent *event, IgnitionOutputPin *ou
// todo: make this a class method?
#define assertPinAssigned(output) { \
if (!output->isInitialized()) { \
warning(CUSTOM_OBD_COIL_PIN_NOT_ASSIGNED, "no_pin_cl #%s", (output)->name); \
warning(CUSTOM_OBD_COIL_PIN_NOT_ASSIGNED, "no_pin_cl #%s", (output)->getName()); \
} \
}
@ -165,7 +165,7 @@ static void startDwellByTurningSparkPinHigh(IgnitionEvent *event, IgnitionOutput
#if ! EFI_UNIT_TEST
if (GET_RPM_VALUE > 2 * engineConfiguration->cranking.rpm) {
const char *outputName = output->name;
const char *outputName = output->getName();
if (prevSparkName == outputName && getCurrentIgnitionMode(PASS_ENGINE_PARAMETER_SIGNATURE) != IM_ONE_COIL) {
warning(CUSTOM_OBD_SKIPPED_SPARK, "looks like skipped spark event %d %s", getRevolutionCounter(), outputName);
}

View File

@ -251,10 +251,7 @@ bool brain_pin_is_ext(brain_pin_e brainPin)
* @return true if this pin was already used, false otherwise
*/
bool brain_pin_markUsed(brain_pin_e brainPin, const char *msg)
{
int index;
bool brain_pin_markUsed(brain_pin_e brainPin, const char *msg) {
if (!initialized) {
firmwareError(CUSTOM_ERR_PIN_REPO, "repository not initialized");
return false;
@ -264,7 +261,7 @@ bool brain_pin_markUsed(brain_pin_e brainPin, const char *msg)
scheduleMsg(&logger, "%s on %s", msg, hwPortname(brainPin));
#endif
index = brainPin_to_index(brainPin);
int index = brainPin_to_index(brainPin);
if (index < 0)
return true;