mirror of https://github.com/FOME-Tech/fome-fw.git
bench test cancellation #219
This commit is contained in:
parent
d57e839729
commit
2f7f4d88a0
|
@ -558,4 +558,5 @@ typedef enum {
|
|||
BENCH_GPPWM3_VALVE,
|
||||
BENCH_GPPWM4_VALVE,
|
||||
BENCH_SECOND_IDLE_VALVE,
|
||||
BENCH_CANCEL,
|
||||
} bench_mode_e;
|
||||
|
|
|
@ -20,17 +20,14 @@
|
|||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// todo: rename this file
|
||||
#include "pch.h"
|
||||
|
||||
#if EFI_ENGINE_CONTROL
|
||||
#if !EFI_UNIT_TEST
|
||||
|
||||
|
||||
#include "flash_main.h"
|
||||
#include "bench_test.h"
|
||||
#include "main_trigger_callback.h"
|
||||
#include "idle_thread.h"
|
||||
#include "periodic_thread_controller.h"
|
||||
#include "electronic_throttle.h"
|
||||
#include "malfunction_central.h"
|
||||
|
@ -52,7 +49,7 @@
|
|||
|
||||
static bool isRunningBench = false;
|
||||
|
||||
bool isRunningBenchTest(void) {
|
||||
bool isRunningBenchTest() {
|
||||
return isRunningBench;
|
||||
}
|
||||
|
||||
|
@ -93,7 +90,7 @@ static void runBench(brain_pin_e brainPin, OutputPin *output, float startDelayMs
|
|||
|
||||
isRunningBench = true;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
for (int i = 0; isRunningBench && i < count; i++) {
|
||||
engine->outputChannels.testBenchIter = i;
|
||||
efitick_t nowNt = getTimeNowNt();
|
||||
// start in a short time so the scheduler can precisely schedule the start event
|
||||
|
@ -139,6 +136,10 @@ static void pinbench(float startdelay, float ontime, float offtime, int iteratio
|
|||
benchSemaphore.signal();
|
||||
}
|
||||
|
||||
static void cancelBenchTest() {
|
||||
isRunningBench = false;
|
||||
}
|
||||
|
||||
/*==========================================================================*/
|
||||
|
||||
static void doRunFuelInjBench(size_t humanIndex, float delay, float onTime, float offTime, int count) {
|
||||
|
@ -333,6 +334,9 @@ static void handleBenchCategory(uint16_t index) {
|
|||
case BENCH_FAN_RELAY_2:
|
||||
fan2Bench();
|
||||
return;
|
||||
case BENCH_CANCEL:
|
||||
cancelBenchTest();
|
||||
return;
|
||||
default:
|
||||
firmwareError(ObdCode::OBD_PCM_Processor_Fault, "Unexpected bench function %d", index);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
void initBenchTest();
|
||||
void onConfigurationChangeBenchTest();
|
||||
|
||||
bool isRunningBenchTest(void);
|
||||
bool isRunningBenchTest();
|
||||
|
||||
void fanBench(void);
|
||||
void fan2Bench(void);
|
||||
|
|
Loading…
Reference in New Issue