smart diag into bench test
This commit is contained in:
parent
226ab063f9
commit
d4bc7077b3
|
@ -37,6 +37,7 @@
|
||||||
#include "malfunction_central.h"
|
#include "malfunction_central.h"
|
||||||
#include "trigger_emulator_algo.h"
|
#include "trigger_emulator_algo.h"
|
||||||
#include "microsecond_timer.h"
|
#include "microsecond_timer.h"
|
||||||
|
#include "gpio_ext.h"
|
||||||
|
|
||||||
#if EFI_WIDEBAND_FIRMWARE_UPDATE
|
#if EFI_WIDEBAND_FIRMWARE_UPDATE
|
||||||
#include "rusefi_wideband.h"
|
#include "rusefi_wideband.h"
|
||||||
|
@ -67,7 +68,16 @@ void benchOn(OutputPin* output) {
|
||||||
output->setValue(true);
|
output->setValue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char pin_error[64];
|
||||||
|
|
||||||
void benchOff(OutputPin* output) {
|
void benchOff(OutputPin* output) {
|
||||||
|
brain_pin_diag_e diag = gpiochips_getDiag(output->brainPin);
|
||||||
|
if (diag == PIN_OK) {
|
||||||
|
efiPrintf("Diag says OK");
|
||||||
|
} else {
|
||||||
|
pinDiag2string(pin_error, sizeof(pin_error), diag);
|
||||||
|
efiPrintf("Diag says %s", pin_error);
|
||||||
|
}
|
||||||
output->setValue(false);
|
output->setValue(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,6 +113,7 @@ static void runBench(brain_pin_e brainPin, OutputPin *output, float delayMs, flo
|
||||||
chThdSleepMicroseconds(onTimeUs + offTimeUs);
|
chThdSleepMicroseconds(onTimeUs + offTimeUs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
efiPrintf("Done!");
|
efiPrintf("Done!");
|
||||||
isRunningBench = false;
|
isRunningBench = false;
|
||||||
}
|
}
|
||||||
|
@ -521,7 +532,7 @@ void onConfigurationChangeBenchTest() {
|
||||||
if (engineConfiguration->benchTestOffTime < 5)
|
if (engineConfiguration->benchTestOffTime < 5)
|
||||||
engineConfiguration->benchTestOffTime = 500; // default value if configuration was not specified
|
engineConfiguration->benchTestOffTime = 500; // default value if configuration was not specified
|
||||||
if (engineConfiguration->benchTestCount < 1)
|
if (engineConfiguration->benchTestCount < 1)
|
||||||
engineConfiguration->benchTestOffTime = 3; // default value if configuration was not specified
|
engineConfiguration->benchTestCount = 3; // default value if configuration was not specified
|
||||||
itoa10(offTimeBuffer, engineConfiguration->benchTestOffTime);
|
itoa10(offTimeBuffer, engineConfiguration->benchTestOffTime);
|
||||||
itoa10(counterBuffer, engineConfiguration->benchTestCount);
|
itoa10(counterBuffer, engineConfiguration->benchTestCount);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1166,6 +1166,10 @@ static void setValue(const char *paramStr, const char *valueStr) {
|
||||||
engineConfiguration->wwaeTau = valueF;
|
engineConfiguration->wwaeTau = valueF;
|
||||||
} else if (strEqualCaseInsensitive(paramStr, "wwaeBeta")) {
|
} else if (strEqualCaseInsensitive(paramStr, "wwaeBeta")) {
|
||||||
engineConfiguration->wwaeBeta = valueF;
|
engineConfiguration->wwaeBeta = valueF;
|
||||||
|
} else if (strEqualCaseInsensitive(paramStr, "benchTestOffTime")) {
|
||||||
|
engineConfiguration->benchTestOffTime = valueI;
|
||||||
|
} else if (strEqualCaseInsensitive(paramStr, "benchTestCount")) {
|
||||||
|
engineConfiguration->benchTestCount = valueI;
|
||||||
} else if (strEqualCaseInsensitive(paramStr, "cranking_dwell")) {
|
} else if (strEqualCaseInsensitive(paramStr, "cranking_dwell")) {
|
||||||
engineConfiguration->ignitionDwellForCrankingMs = valueF;
|
engineConfiguration->ignitionDwellForCrankingMs = valueF;
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
|
|
|
@ -112,6 +112,22 @@ PinRepository::PinRepository() {
|
||||||
#include "smart_gpio.h"
|
#include "smart_gpio.h"
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
|
|
||||||
|
void pinDiag2string(char *buffer, size_t size, brain_pin_diag_e pin_diag) {
|
||||||
|
/* use autogeneraged helpers here? */
|
||||||
|
if (pin_diag == PIN_OK) {
|
||||||
|
chsnprintf(buffer, size, "Ok");
|
||||||
|
} else if (pin_diag != PIN_INVALID) {
|
||||||
|
chsnprintf(buffer, size, "%s%s%s%s%s",
|
||||||
|
pin_diag & PIN_OPEN ? "open_load " : "",
|
||||||
|
pin_diag & PIN_SHORT_TO_GND ? "short_to_gnd " : "",
|
||||||
|
pin_diag & PIN_SHORT_TO_BAT ? "short_to_bat " : "",
|
||||||
|
pin_diag & PIN_OVERLOAD ? "overload " : "",
|
||||||
|
pin_diag & PIN_DRIVER_OVERTEMP ? "overtemp": "");
|
||||||
|
} else {
|
||||||
|
chsnprintf(buffer, size, "INVALID");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static brain_pin_e index_to_brainPin(unsigned int i)
|
static brain_pin_e index_to_brainPin(unsigned int i)
|
||||||
{
|
{
|
||||||
if (i < getBrainPinTotalNum())
|
if (i < getBrainPinTotalNum())
|
||||||
|
@ -137,28 +153,13 @@ static void reportPins() {
|
||||||
#if (BOARD_EXT_GPIOCHIPS > 0)
|
#if (BOARD_EXT_GPIOCHIPS > 0)
|
||||||
for (unsigned int i = getBrainPinOnchipNum() ; i < getBrainPinTotalNum(); i++) {
|
for (unsigned int i = getBrainPinOnchipNum() ; i < getBrainPinTotalNum(); i++) {
|
||||||
static char pin_error[64];
|
static char pin_error[64];
|
||||||
const char *pin_name;
|
|
||||||
const char *pin_user;
|
|
||||||
brain_pin_diag_e pin_diag;
|
|
||||||
brain_pin_e brainPin = index_to_brainPin(i);
|
brain_pin_e brainPin = index_to_brainPin(i);
|
||||||
|
|
||||||
pin_name = gpiochips_getPinName(brainPin);
|
const char *pin_name = gpiochips_getPinName(brainPin);
|
||||||
pin_user = getBrainUsedPin(i);
|
const char *pin_user = getBrainUsedPin(i);
|
||||||
pin_diag = gpiochips_getDiag(brainPin);
|
brain_pin_diag_e pin_diag = gpiochips_getDiag(brainPin);
|
||||||
|
|
||||||
/* use autogeneraged helpers here? */
|
pinDiag2string(pin_error, sizeof(pin_error), pin_diag);
|
||||||
if (pin_diag == PIN_OK) {
|
|
||||||
chsnprintf(pin_error, sizeof(pin_error), "Ok");
|
|
||||||
} else if (pin_diag != PIN_INVALID) {
|
|
||||||
chsnprintf(pin_error, sizeof(pin_error), "%s%s%s%s%s",
|
|
||||||
pin_diag & PIN_OPEN ? "open_load " : "",
|
|
||||||
pin_diag & PIN_SHORT_TO_GND ? "short_to_gnd " : "",
|
|
||||||
pin_diag & PIN_SHORT_TO_BAT ? "short_to_bat " : "",
|
|
||||||
pin_diag & PIN_OVERLOAD ? "overload " : "",
|
|
||||||
pin_diag & PIN_DRIVER_OVERTEMP ? "overtemp": "");
|
|
||||||
} else {
|
|
||||||
chsnprintf(pin_error, sizeof(pin_error), "INVALID");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* here show all pins, unused too */
|
/* here show all pins, unused too */
|
||||||
if (pin_name != NULL) {
|
if (pin_name != NULL) {
|
||||||
|
|
|
@ -33,6 +33,7 @@ bool isBrainPinValid(brain_pin_e brainPin);
|
||||||
void initPinRepository(void);
|
void initPinRepository(void);
|
||||||
EXTERNC bool brain_pin_is_onchip(brain_pin_e brainPin);
|
EXTERNC bool brain_pin_is_onchip(brain_pin_e brainPin);
|
||||||
EXTERNC bool brain_pin_is_ext(brain_pin_e brainPin);
|
EXTERNC bool brain_pin_is_ext(brain_pin_e brainPin);
|
||||||
|
void pinDiag2string(char *buffer, size_t size, brain_pin_diag_e pin_diag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Usually high-level code would invoke efiSetPadMode, not this method directly
|
* Usually high-level code would invoke efiSetPadMode, not this method directly
|
||||||
|
|
Loading…
Reference in New Issue