Too many bench test buttons are broken #5327

This commit is contained in:
rusefillc 2023-06-15 11:46:28 -04:00
parent 4f9284dada
commit 65dcdb86ec
5 changed files with 24 additions and 5 deletions

View File

@ -22,7 +22,7 @@ void MainRelayController::onSlowCallback() {
mainRelayState = !isBenchTest; mainRelayState = !isBenchTest;
#endif #endif
enginePins.mainRelay.setValue(mainRelayState); enginePins.mainRelay.setValue("mr", mainRelayState);
} }
bool MainRelayController::needsDelayedShutoff() { bool MainRelayController::needsDelayedShutoff() {

View File

@ -58,8 +58,10 @@ bool isRunningBenchTest(void) {
static scheduling_s benchSchedStart; static scheduling_s benchSchedStart;
static scheduling_s benchSchedEnd; static scheduling_s benchSchedEnd;
#define BENCH_MSG "bench"
static void benchOn(OutputPin* output) { static void benchOn(OutputPin* output) {
output->setValue(true); output->setValue(BENCH_MSG, true);
} }
static char pin_error[64]; static char pin_error[64];
@ -74,7 +76,7 @@ static void benchOff(OutputPin* output) {
efiPrintf("Diag says %s", pin_error); efiPrintf("Diag says %s", pin_error);
} }
#endif // EFI_PROD_CODE #endif // EFI_PROD_CODE
output->setValue(false); output->setValue(BENCH_MSG, false);
} }
static void runBench(brain_pin_e brainPin, OutputPin *output, float startDelayMs, float onTimeMs, float offTimeMs, static void runBench(brain_pin_e brainPin, OutputPin *output, float startDelayMs, float onTimeMs, float offTimeMs,

View File

@ -182,8 +182,10 @@ void HpfpController::onFastCallback() {
} }
} }
#define HPFP_CONTROLLER "hpfp"
void HpfpController::pinTurnOn(HpfpController *self) { void HpfpController::pinTurnOn(HpfpController *self) {
enginePins.hpfpValve.setHigh(); enginePins.hpfpValve.setHigh(HPFP_CONTROLLER);
// By scheduling the close after we already open, we don't have to worry if the engine // By scheduling the close after we already open, we don't have to worry if the engine
// stops, the valve will be turned off in a certain amount of time regardless. // stops, the valve will be turned off in a certain amount of time regardless.
@ -194,7 +196,7 @@ void HpfpController::pinTurnOn(HpfpController *self) {
} }
void HpfpController::pinTurnOff(HpfpController *self) { void HpfpController::pinTurnOff(HpfpController *self) {
enginePins.hpfpValve.setLow(); enginePins.hpfpValve.setLow(HPFP_CONTROLLER);
self->scheduleNextCycle(); self->scheduleNextCycle();
} }

View File

@ -337,6 +337,10 @@ extern bool verboseMode;
#endif // EFI_UNIT_TEST #endif // EFI_UNIT_TEST
void NamedOutputPin::setHigh() { void NamedOutputPin::setHigh() {
setHigh(nullptr);
}
void NamedOutputPin::setHigh(const char *msg) {
#if EFI_UNIT_TEST #if EFI_UNIT_TEST
if (verboseMode) { if (verboseMode) {
efiPrintf("pin %s goes high", name); efiPrintf("pin %s goes high", name);
@ -355,6 +359,10 @@ void NamedOutputPin::setHigh() {
} }
void NamedOutputPin::setLow() { void NamedOutputPin::setLow() {
setLow(nullptr);
}
void NamedOutputPin::setLow(const char *msg) {
#if EFI_UNIT_TEST #if EFI_UNIT_TEST
if (verboseMode) { if (verboseMode) {
efiPrintf("pin %s goes low", name); efiPrintf("pin %s goes low", name);
@ -484,6 +492,10 @@ void OutputPin::setOnchipValue(int electricalValue) {
} }
#endif // EFI_PROD_CODE #endif // EFI_PROD_CODE
void OutputPin::setValue(const char *msg, int logicValue) {
setValue(logicValue);
}
void OutputPin::setValue(int logicValue) { void OutputPin::setValue(int logicValue) {
#if ENABLE_PERF_TRACE #if ENABLE_PERF_TRACE
// todo: https://github.com/rusefi/rusefi/issues/1638 // todo: https://github.com/rusefi/rusefi/issues/1638

View File

@ -32,6 +32,7 @@ public:
bool isInitialized(); bool isInitialized();
bool getAndSet(int logicValue); bool getAndSet(int logicValue);
void setValue(const char *msg, int logicValue);
TEST_VIRTUAL void setValue(int logicValue); TEST_VIRTUAL void setValue(int logicValue);
void toggle(); void toggle();
bool getLogicValue() const; bool getLogicValue() const;
@ -75,6 +76,8 @@ class NamedOutputPin : public virtual OutputPin {
public: public:
NamedOutputPin(); NamedOutputPin();
explicit NamedOutputPin(const char *name); explicit NamedOutputPin(const char *name);
virtual void setHigh(const char *msg);
virtual void setLow(const char *msg);
virtual void setHigh(); virtual void setHigh();
virtual void setLow(); virtual void setLow();
const char *getName() const; const char *getName() const;