auto-sync

This commit is contained in:
rusEfi 2015-03-03 07:04:31 -06:00
parent 8c7be03981
commit 29d1c29f7d
2 changed files with 7 additions and 2 deletions

View File

@ -27,6 +27,8 @@ void setMazda626EngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
boardConfiguration->analogChartMode = AC_TRIGGER; boardConfiguration->analogChartMode = AC_TRIGGER;
engineConfiguration->analogChartFrequency = 2; engineConfiguration->analogChartFrequency = 2;
engineConfiguration->injector.flow = 330;
// set_global_trigger_offset_angle -42 // set_global_trigger_offset_angle -42
engineConfiguration->globalTriggerAngleOffset = -42; engineConfiguration->globalTriggerAngleOffset = -42;

View File

@ -46,16 +46,19 @@ uint64_t Overflow64Counter::get() {
* *
* http://stackoverflow.com/questions/5162673/how-to-read-two-32bit-counters-as-a-64bit-integer-without-race-condition * http://stackoverflow.com/questions/5162673/how-to-read-two-32bit-counters-as-a-64bit-integer-without-race-condition
*/ */
// these are local copies for thread-safery
// todo: this is still not atomic, so technically not thread safe.
uint64_t localH; uint64_t localH;
uint32_t localLow; uint32_t localLow;
int counter = 0;
while (true) { while (true) {
localH = state.highBits; localH = state.highBits;
localLow = state.lowBits; localLow = state.lowBits;
uint64_t localH2 = state.highBits; uint64_t localH2 = state.highBits;
if (localH == localH2) if (localH == localH2)
break; break;
#if EFI_PROD_CODE || defined(__DOXYGEN__)
if (counter++ == 10000)
chDbgPanic("lock-free frozen");
#endif /* EFI_PROD_CODE */
} }
/** /**
* We need to take current counter after making a local 64 bit snapshot * We need to take current counter after making a local 64 bit snapshot