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;
#endif
enginePins.mainRelay.setValue(mainRelayState);
enginePins.mainRelay.setValue("mr", mainRelayState);
}
bool MainRelayController::needsDelayedShutoff() {

View File

@ -58,8 +58,10 @@ bool isRunningBenchTest(void) {
static scheduling_s benchSchedStart;
static scheduling_s benchSchedEnd;
#define BENCH_MSG "bench"
static void benchOn(OutputPin* output) {
output->setValue(true);
output->setValue(BENCH_MSG, true);
}
static char pin_error[64];
@ -74,7 +76,7 @@ static void benchOff(OutputPin* output) {
efiPrintf("Diag says %s", pin_error);
}
#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,

View File

@ -182,8 +182,10 @@ void HpfpController::onFastCallback() {
}
}
#define HPFP_CONTROLLER "hpfp"
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
// 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) {
enginePins.hpfpValve.setLow();
enginePins.hpfpValve.setLow(HPFP_CONTROLLER);
self->scheduleNextCycle();
}

View File

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

View File

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