auto-sync
This commit is contained in:
parent
662f02f28a
commit
37244f5e35
|
@ -57,15 +57,18 @@ static void testCallback(void *arg) {
|
||||||
*/
|
*/
|
||||||
float delayMs = 0.1;
|
float delayMs = 0.1;
|
||||||
float durationMs = 1.6;
|
float durationMs = 1.6;
|
||||||
scheduleOutput(&outSignals[0], delayMs, durationMs);
|
|
||||||
scheduleOutput(&outSignals[1], delayMs, durationMs);
|
|
||||||
scheduleOutput(&outSignals[2], delayMs, durationMs);
|
|
||||||
scheduleOutput(&outSignals[3], delayMs, durationMs);
|
|
||||||
|
|
||||||
scheduleOutput(&outSignals[4], delayMs, durationMs);
|
efitimeus_t nowUs = getTimeNowUs();
|
||||||
scheduleOutput(&outSignals[5], delayMs, durationMs);
|
|
||||||
scheduleOutput(&outSignals[6], delayMs, durationMs);
|
scheduleOutput(&outSignals[0], nowUs, delayMs, durationMs);
|
||||||
scheduleOutput(&outSignals[7], delayMs, durationMs);
|
scheduleOutput(&outSignals[1], nowUs, delayMs, durationMs);
|
||||||
|
scheduleOutput(&outSignals[2], nowUs, delayMs, durationMs);
|
||||||
|
scheduleOutput(&outSignals[3], nowUs, delayMs, durationMs);
|
||||||
|
|
||||||
|
scheduleOutput(&outSignals[4], nowUs, delayMs, durationMs);
|
||||||
|
scheduleOutput(&outSignals[5], nowUs, delayMs, durationMs);
|
||||||
|
scheduleOutput(&outSignals[6], nowUs, delayMs, durationMs);
|
||||||
|
scheduleOutput(&outSignals[7], nowUs, delayMs, durationMs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this would re-schedule another callback in 2ms from now
|
* this would re-schedule another callback in 2ms from now
|
||||||
|
|
|
@ -118,7 +118,7 @@ int getRevolutionCounter(void);
|
||||||
* @param dwell the number of ticks of output duration
|
* @param dwell the number of ticks of output duration
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void scheduleOutput(OutputSignal *signal, float delayMs, float durationMs) {
|
void scheduleOutput(OutputSignal *signal, efitimeus_t nowUs, float delayMs, float durationMs) {
|
||||||
#if EFI_GPIO
|
#if EFI_GPIO
|
||||||
if (durationMs < 0) {
|
if (durationMs < 0) {
|
||||||
firmwareError("duration cannot be negative: %d", durationMs);
|
firmwareError("duration cannot be negative: %d", durationMs);
|
||||||
|
@ -134,8 +134,6 @@ void scheduleOutput(OutputSignal *signal, float delayMs, float durationMs) {
|
||||||
scheduling_s * sUp = &signal->signalTimerUp[index];
|
scheduling_s * sUp = &signal->signalTimerUp[index];
|
||||||
scheduling_s * sDown = &signal->signalTimerDown[index];
|
scheduling_s * sDown = &signal->signalTimerDown[index];
|
||||||
|
|
||||||
efitimeus_t nowUs = getTimeNowUs();
|
|
||||||
|
|
||||||
scheduleByTime("out up", sUp, nowUs + (int) MS2US(delayMs), (schfunc_t) &turnPinHigh, signal->output);
|
scheduleByTime("out up", sUp, nowUs + (int) MS2US(delayMs), (schfunc_t) &turnPinHigh, signal->output);
|
||||||
scheduleByTime("out down", sDown, nowUs + (int) MS2US(delayMs + durationMs), (schfunc_t) &turnPinLow, signal->output);
|
scheduleByTime("out down", sDown, nowUs + (int) MS2US(delayMs + durationMs), (schfunc_t) &turnPinLow, signal->output);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -39,19 +39,10 @@ struct OutputSignal_struct {
|
||||||
scheduling_s signalTimerDown[2];
|
scheduling_s signalTimerDown[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
void scheduleOutput(OutputSignal *signal, efitimeus_t nowUs, float delayMs, float durationMs);
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
void scheduleOutput(OutputSignal *signal, float delayMs, float durationMs);
|
|
||||||
|
|
||||||
void initSignalExecutor(void);
|
void initSignalExecutor(void);
|
||||||
void scheduleByAngle(int rpm, scheduling_s *timer, angle_t angle, schfunc_t callback, void *param);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
void scheduleByAngle(int rpm, scheduling_s *timer, angle_t angle, schfunc_t callback, void *param);
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
void initSignalExecutorImpl(void);
|
void initSignalExecutorImpl(void);
|
||||||
|
|
||||||
|
|
|
@ -154,10 +154,12 @@ static void updateErrorCodes(void) {
|
||||||
|
|
||||||
Overflow64Counter halTime;
|
Overflow64Counter halTime;
|
||||||
|
|
||||||
|
//todo: macro to save method invocation
|
||||||
efitimeus_t getTimeNowUs(void) {
|
efitimeus_t getTimeNowUs(void) {
|
||||||
return getTimeNowNt() / (CORE_CLOCK / 1000000);
|
return getTimeNowNt() / (CORE_CLOCK / 1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//todo: macro to save method invocation
|
||||||
efitick_t getTimeNowNt(void) {
|
efitick_t getTimeNowNt(void) {
|
||||||
return halTime.get();
|
return halTime.get();
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,7 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(InjectionEvent *event, int rp
|
||||||
scheduleTask("out down", sDown, (int) MS2US(delayMs) + MS2US(fuelMs), (schfunc_t) &endSimultaniousInjection, engine);
|
scheduleTask("out down", sDown, (int) MS2US(delayMs) + MS2US(fuelMs), (schfunc_t) &endSimultaniousInjection, engine);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
scheduleOutput(event->actuator, delayMs, fuelMs);
|
scheduleOutput(event->actuator, getTimeNowUs(), delayMs, fuelMs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,15 +17,13 @@
|
||||||
EventQueue schedulingQueue;
|
EventQueue schedulingQueue;
|
||||||
|
|
||||||
void scheduleTask(const char *msg, scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) {
|
void scheduleTask(const char *msg, scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) {
|
||||||
schedulingQueue.insertTask(scheduling, getTimeNowUs() + delayUs, callback, param);
|
scheduleByTime(msg, scheduling, getTimeNowUs() + delayUs, callback, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
void scheduleTask2(const char *prefix, scheduling_s *scheduling, uint64_t time, schfunc_t callback, void *param) {
|
void scheduleByTime(const char *prefix, scheduling_s *scheduling, efitimeus_t time, schfunc_t callback, void *param) {
|
||||||
firmwareError("not implemented");
|
schedulingQueue.insertTask(scheduling, time, callback, param);
|
||||||
//schedulingQueue.insertTask(scheduling, getTimeNowUs() + delayUs, callback, param);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void initSignalExecutorImpl(void) {
|
void initSignalExecutorImpl(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,16 +9,6 @@
|
||||||
#define TEST_SIGNAL_EXECUTOR_H_
|
#define TEST_SIGNAL_EXECUTOR_H_
|
||||||
|
|
||||||
int getRevolutionCounter();
|
int getRevolutionCounter();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
void testSignalExecutor(void);
|
void testSignalExecutor(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#endif /* TEST_SIGNAL_EXECUTOR_H_ */
|
#endif /* TEST_SIGNAL_EXECUTOR_H_ */
|
||||||
|
|
Loading…
Reference in New Issue