auto-sync

This commit is contained in:
rusEfi 2016-10-31 21:02:36 -04:00
parent da1f4a4695
commit 08650ccdbc
6 changed files with 36 additions and 31 deletions

View File

@ -105,6 +105,12 @@ static void addIgnitionEvent(angle_t localAdvance, angle_t dwellAngle, IgnitionE
event->advance = localAdvance;
findTriggerPosition(&event->dwellPosition, localAdvance - dwellAngle PASS_ENGINE_PARAMETER);
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
printf("addIgnitionEvent %s ind=%d\n", output->name, event->dwellPosition.eventIndex);
// scheduleMsg(logger, "addIgnitionEvent %s ind=%d", output->name, event->dwellPosition->eventIndex);
#endif /* FUEL_MATH_EXTREME_LOGGING */
}
void initializeIgnitionActions(angle_t advance, angle_t dwellAngle,

View File

@ -173,7 +173,7 @@ int EventQueue::executeAll(efitime_t now) {
int howFarOff = now - current->momentX;
maxHowFarOff = maxI(maxHowFarOff, howFarOff);
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
printf("execute %d %d\r\n", (long)current, (long)current->param);
printf("execute current=%d param=%d\r\n", (long)current, (long)current->param);
#endif
current->callback(current->param);
// even with overflow it's safe to subtract here

View File

@ -79,12 +79,8 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
* The start of charge is always within the current trigger event range, so just plain time-based scheduling
*/
if (!limitedSpark) {
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
printf("spark charge delay=%f\r\n", chargeDelayUs);
#endif
#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__)
scheduleMsg(logger, "scheduling sparkUp ind=%d %d %s %d %d later", trgEventIndex, getRevolutionCounter(), iEvent->output->name, (int)getTimeNowUs(), (int)chargeDelayUs);
scheduleMsg(logger, "scheduling sparkUp ind=%d %d %s now=%d %d later", trgEventIndex, getRevolutionCounter(), iEvent->output->name, (int)getTimeNowUs(), (int)chargeDelayUs);
#endif /* FUEL_MATH_EXTREME_LOGGING */
/**
@ -111,7 +107,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
#endif
#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__)
scheduleMsg(logger, "scheduling sparkDown ind=%d %d %s %d %d later", trgEventIndex, getRevolutionCounter(), iEvent->output->name, (int)getTimeNowUs(), (int)timeTillIgnitionUs);
scheduleMsg(logger, "scheduling sparkDown ind=%d %d %s now=%d %d later", trgEventIndex, getRevolutionCounter(), iEvent->output->name, (int)getTimeNowUs(), (int)timeTillIgnitionUs);
#endif /* FUEL_MATH_EXTREME_LOGGING */
scheduleTask(true, "spark1 down", sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, iEvent->output);

View File

@ -20,32 +20,32 @@ void initializeRoverK(TriggerShape *s) {
float base = 0;
for (int i = 0; i < 2; i++) {
s->addEvent(base + tooth / 2, T_PRIMARY, TV_RISE);
s->addEvent(base + tooth, T_PRIMARY, TV_FALL);
s->addEvent2(base + tooth / 2, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER);
s->addEvent2(base + tooth, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER);
base += tooth;
}
base += tooth;
for (int i = 0; i < 2; i++) {
s->addEvent(base + tooth / 2, T_PRIMARY, TV_RISE);
s->addEvent(base + tooth, T_PRIMARY, TV_FALL);
s->addEvent2(base + tooth / 2, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER);
s->addEvent2(base + tooth, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER);
base += tooth;
}
base += tooth;
for (int i = 0; i < 14; i++) {
s->addEvent(base + tooth / 2, T_PRIMARY, TV_RISE);
s->addEvent(base + tooth, T_PRIMARY, TV_FALL);
s->addEvent2(base + tooth / 2, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER);
s->addEvent2(base + tooth, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER);
base += tooth;
}
base += tooth;
for (int i = 0; i < 3; i++) {
s->addEvent(base + tooth / 2, T_PRIMARY, TV_RISE);
s->addEvent(base + tooth, T_PRIMARY, TV_FALL);
s->addEvent2(base + tooth / 2, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER);
s->addEvent2(base + tooth, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER);
base += tooth;
}
base += tooth;
for (int i = 0; i < 11; i++) {
s->addEvent(base + tooth / 2, T_PRIMARY, TV_RISE);
s->addEvent(base + tooth, T_PRIMARY, TV_FALL);
s->addEvent2(base + tooth / 2, T_PRIMARY, TV_RISE PASS_ENGINE_PARAMETER);
s->addEvent2(base + tooth, T_PRIMARY, TV_FALL PASS_ENGINE_PARAMETER);
base += tooth;
}

View File

@ -10,6 +10,8 @@
#define EFI_ENABLE_ASSERTS TRUE
#define SPARK_EXTREME_LOGGING TRUE
#define EFI_GPIO TRUE
#define EFI_UNIT_TEST TRUE

View File

@ -124,6 +124,7 @@ int getRevolutionCounter(void) {
}
int main(void) {
testSparkReverseOrderBug319();
testFuelSchedulerBug299smallAndLarge();
testFuelSchedulerBug299smallAndMedium();
testLogicExpressions();
@ -172,13 +173,18 @@ int main(void) {
testTriggerDecoder();
// resizeMap();
printf("Success 20150407\r\n");
printf("Success 20161031\r\n");
printAllTriggers();
return EXIT_SUCCESS;
}
bool warning(obd_code_e code, const char *fmt, ...) {
printf("Warning: %s\r\n", fmt);
bool warning(obd_code_e code, const char *format, ...) {
printf("Warning: ");
va_list ap;
va_start(ap, format);
vprintf(format, ap);
va_end(ap);
printf("\r\n");
}
bool hasFirmwareErrorFlag = false;
@ -195,16 +201,6 @@ void print(const char *format, ...) {
va_end(ap);
}
//void fatal3(char *msg, char *file, int line) {
// printf(msg);
// exit(-1);
//}
int warning(const char *fmt, ...) {
printf(fmt);
exit(-1);
}
bool isCranking(void) {
return 0;
}
@ -212,5 +208,10 @@ bool isCranking(void) {
void initLogging(LoggingWithStorage *logging, const char *name) {
}
void scheduleMsg(Logging *logging, const char *fmt, ...) {
void scheduleMsg(Logging *logging, const char *format, ...) {
va_list ap;
va_start(ap, format);
vprintf(format, ap);
va_end(ap);
printf("\r\n");
}