auto-sync

This commit is contained in:
rusEfi 2015-03-04 08:04:34 -06:00
parent d4c38b3fbc
commit cd5af013ca
4 changed files with 32 additions and 2 deletions

View File

@ -224,6 +224,7 @@ static void showLine(lcd_line_e line) {
case LL_VBATT: case LL_VBATT:
lcdPrintf("Battery %fv", getVBatt(engineConfiguration)); lcdPrintf("Battery %fv", getVBatt(engineConfiguration));
return; return;
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
case LL_BARO: case LL_BARO:
if (engineConfiguration->hasBaroSensor) { if (engineConfiguration->hasBaroSensor) {
lcdPrintf("Baro: %f", getBaroPressure()); lcdPrintf("Baro: %f", getBaroPressure());
@ -231,6 +232,7 @@ static void showLine(lcd_line_e line) {
lcdPrintf("Baro: none"); lcdPrintf("Baro: none");
} }
return; return;
#endif
case LL_AFR: case LL_AFR:
if (engineConfiguration->hasAfrSensor) { if (engineConfiguration->hasAfrSensor) {
lcdPrintf("AFR: %f", getAfr()); lcdPrintf("AFR: %f", getAfr());
@ -265,6 +267,8 @@ static void showLine(lcd_line_e line) {
case LL_TRIGGER_DUTY: case LL_TRIGGER_DUTY:
lcdPrintf("Duty"); lcdPrintf("Duty");
return; return;
default:
lcdPrintf("()");
} }
} }

View File

@ -113,7 +113,7 @@ void mapAveragingCallback(adcsample_t adcValue) {
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#9a"); efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#9a");
#if EFI_ANALOG_CHART #if (EFI_ANALOG_CHART && EFI_ANALOG_SENSORS) || defined(__DOXYGEN__)
if (boardConfiguration->analogChartMode == AC_MAP) if (boardConfiguration->analogChartMode == AC_MAP)
if (perRevolutionCounter % FAST_MAP_CHART_SKIP_FACTOR == 0) { if (perRevolutionCounter % FAST_MAP_CHART_SKIP_FACTOR == 0) {
float voltage = adcToVoltsDivided(adcValue); float voltage = adcToVoltsDivided(adcValue);
@ -199,9 +199,13 @@ float getMapVoltage(void) {
* @return Manifold Absolute Pressure, in kPa * @return Manifold Absolute Pressure, in kPa
*/ */
float getMap(void) { float getMap(void) {
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
if (!isValidRpm(engine->rpmCalculator.rpmValue)) if (!isValidRpm(engine->rpmCalculator.rpmValue))
return getRawMap(); // maybe return NaN in case of stopped engine? return getRawMap(); // maybe return NaN in case of stopped engine?
return getMapByVoltage(v_averagedMapValue); return getMapByVoltage(v_averagedMapValue);
#else
return 100;
#endif
} }
void initMapAveraging(Logging *sharedLogger, Engine *engine) { void initMapAveraging(Logging *sharedLogger, Engine *engine) {

View File

@ -276,5 +276,5 @@ int getRusEfiVersion(void) {
return 1; // this is here to make the compiler happy about the unused array return 1; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE[0] == 0) if (UNUSED_CCM_SIZE[0] == 0)
return 1; // this is here to make the compiler happy about the unused array return 1; // this is here to make the compiler happy about the unused array
return 20150303; return 20150304;
} }

View File

@ -42,6 +42,27 @@ uint64_t Overflow64Counter::update(uint32_t value) {
// todo: make this a macro? always inline? // todo: make this a macro? always inline?
uint64_t Overflow64Counter::get() { uint64_t Overflow64Counter::get() {
#if EFI_PROD_CODE
bool alreadyLocked = lockAnyContext();
uint64_t localH = state.highBits;
uint32_t localLow = state.lowBits;
uint32_t value = GET_TIMESTAMP();
if (value < localLow) {
// new value less than previous value means there was an overflow in that 32 bit counter
localH += 0x100000000LL;
}
uint64_t result = localH + value;
if (!alreadyLocked) {
unlockAnyContext();
}
return result;
#else
/** /**
* this method is lock-free and thread-safe, that's because the 'update' method * this method is lock-free and thread-safe, that's because the 'update' method
* is atomic with a critical zone requirement. * is atomic with a critical zone requirement.
@ -73,4 +94,5 @@ uint64_t Overflow64Counter::get() {
} }
return localH + value; return localH + value;
#endif
} }