mirror of https://github.com/rusefi/rusefi-1.git
auto-sync
This commit is contained in:
parent
dfd3d77708
commit
d67a6ad989
|
@ -62,6 +62,8 @@ void setCustomEngineConfiguration(engine_configuration_s *engineConfiguration) {
|
|||
* We want to initialize all outputs for test
|
||||
*/
|
||||
engineConfiguration->cylindersCount = 10;
|
||||
|
||||
engineConfiguration->displayMode = DM_NONE;
|
||||
#else
|
||||
boardConfiguration->injectionPins[4] = GPIO_UNASSIGNED;
|
||||
boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#define EFI_FSIO TRUE
|
||||
|
||||
#define EFI_PWM_TESTER FALSE
|
||||
|
||||
#define EFI_USE_CCM TRUE
|
||||
|
||||
#ifndef EFI_ENABLE_ASSERTS
|
||||
|
|
|
@ -13,37 +13,76 @@
|
|||
#include "PwmTester.h"
|
||||
#include "EfiWave.h"
|
||||
#include "pwm_generator_logic.h"
|
||||
#include "engine_configuration.h"
|
||||
#include "engine.h"
|
||||
#include "pwm_generator.h"
|
||||
|
||||
static Logging logger;
|
||||
static LoggingWithStorage logger;
|
||||
|
||||
static SimplePwm pwmTest[5];
|
||||
|
||||
extern board_configuration_s *boardConfiguration;
|
||||
|
||||
extern OutputPin warningPin;
|
||||
extern OutputPin outputs[IO_PIN_COUNT];
|
||||
extern engine_pins_s enginePins;
|
||||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
static void startPwmTest(int freq) {
|
||||
scheduleMsg(&logger, "running pwm test @%d", freq);
|
||||
|
||||
// PD13, GPIO_UNASSIGNED because pin is initialized elsewhere already
|
||||
engine->isRunningPwmTest = true;
|
||||
|
||||
// PD13 pin is initialized elsewhere already
|
||||
startSimplePwm(&pwmTest[0], "tester", &warningPin, 10, 0.5f, applyPinState);
|
||||
/**
|
||||
* See custom_engine.cpp for pinout
|
||||
*/
|
||||
// currently this is PB9 by default - see boardConfiguration->injectionPins
|
||||
startSimplePwm(&pwmTest[1], "tester", &outputs[(int)INJECTOR_1_OUTPUT], freq / 1.3333333333, 0.5f, applyPinState);
|
||||
startSimplePwm(&pwmTest[1], "tester", &enginePins.injectors[0], freq / 1.3333333333, 0.5f, applyPinState);
|
||||
// currently this is PE2 by default
|
||||
startSimplePwm(&pwmTest[2], "tester", &enginePins.injectors[1], freq / 1000, 0.5f, applyPinState);
|
||||
// currently this is PB8 by default
|
||||
startSimplePwm(&pwmTest[2], "tester", &outputs[(int)INJECTOR_2_OUTPUT], freq / 1000, 0.5f, applyPinState);
|
||||
// currently this is PE3 by default
|
||||
startSimplePwm(&pwmTest[3], "tester", &outputs[(int)INJECTOR_3_OUTPUT], freq, 0.5, applyPinState);
|
||||
// currently this is PE5 by default
|
||||
startSimplePwm(&pwmTest[4], "tester", &outputs[(int)INJECTOR_4_OUTPUT], freq / 33.33333333333, 0.5, applyPinState);
|
||||
startSimplePwm(&pwmTest[3], "tester", &enginePins.injectors[2], freq, 0.5, applyPinState);
|
||||
// currently this is PB7 by default
|
||||
startSimplePwm(&pwmTest[4], "tester", &enginePins.injectors[3], freq / 33.33333333333, 0.5, applyPinState);
|
||||
|
||||
}
|
||||
|
||||
static scheduling_s ioTest;
|
||||
|
||||
static OutputSignal outSignals[4];
|
||||
|
||||
static void testCallback(void *arg) {
|
||||
|
||||
/**
|
||||
* 0.1ms from now please squirt for 1.6ms
|
||||
*/
|
||||
scheduleOutput(&outSignals[0], 0.1, 1.6);
|
||||
scheduleOutput(&outSignals[1], 0.1, 1.6);
|
||||
scheduleOutput(&outSignals[2], 0.1, 1.6);
|
||||
scheduleOutput(&outSignals[3], 0.1, 1.6);
|
||||
|
||||
/**
|
||||
* this would re-schedule another callback in 2ms from now
|
||||
*/
|
||||
scheduleTask("test", &ioTest, MS2US(2), testCallback, NULL);
|
||||
}
|
||||
|
||||
void initPwmTester(void) {
|
||||
initLogging(&logger, "pwm test");
|
||||
addConsoleActionI("pwmtest", startPwmTest);
|
||||
// un-comment this to start pwm test on start up startPwmTest(1000);
|
||||
startPwmTest(1000);
|
||||
|
||||
/**
|
||||
* injector channels #4-#8 are used for individual squirt test
|
||||
*/
|
||||
outSignals[0].output = &enginePins.injectors[4];
|
||||
outSignals[1].output = &enginePins.injectors[5];
|
||||
outSignals[2].output = &enginePins.injectors[6];
|
||||
outSignals[3].output = &enginePins.injectors[7];
|
||||
|
||||
/**
|
||||
* this would schedule a callback in 2ms from now
|
||||
*/
|
||||
scheduleTask("test", &ioTest, MS2US(2), testCallback, NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -46,6 +46,7 @@ Engine::Engine() {
|
|||
isCylinderCleanupMode = false;
|
||||
engineCycleEventCount = 0;
|
||||
stopEngineRequestTimeNt = 0;
|
||||
isRunningPwmTest = false;
|
||||
}
|
||||
|
||||
void Engine::precalc(engine_configuration_s *engineConfiguration) {
|
||||
|
@ -76,6 +77,8 @@ bool Engine::stopPins() {
|
|||
}
|
||||
|
||||
void Engine::watchdog() {
|
||||
if (isRunningPwmTest)
|
||||
return;
|
||||
if (!isSpinning) {
|
||||
if (!isRunningBenchTest() && stopPins()) {
|
||||
firmwareError("Some pins were turned off by 2nd pass watchdog");
|
||||
|
|
|
@ -103,6 +103,8 @@ public:
|
|||
bool_t clutchUpState;
|
||||
bool_t clutchDownState;
|
||||
|
||||
bool_t isRunningPwmTest;
|
||||
|
||||
TriggerShape triggerShape;
|
||||
|
||||
float angleExtra[IGNITION_PIN_COUNT];
|
||||
|
|
|
@ -24,16 +24,7 @@ struct scheduling_struct {
|
|||
const char *name;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void scheduleTask(const char *prefix, scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param);
|
||||
void scheduleTask2(const char *prefix, scheduling_s *scheduling, uint64_t time, schfunc_t callback, void *param);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* SCHEDULER_H_ */
|
||||
|
|
Loading…
Reference in New Issue