random refactoring: hopefully not changing byte size of any variables but clarifying/fixing type between ticks, US and MS

This commit is contained in:
rusefi 2019-12-21 21:11:09 -05:00
parent 3ed388d1ad
commit cf0b13041f
21 changed files with 50 additions and 52 deletions

View File

@ -672,7 +672,7 @@ class LcdController : public PeriodicController<UTILITY_THREAD_STACK_SIZE> {
public: public:
LcdController() : PeriodicController("LCD") { } LcdController() : PeriodicController("LCD") { }
private: private:
void PeriodicTask(efitime_t nowNt) override { void PeriodicTask(efitick_t nowNt) override {
UNUSED(nowNt); UNUSED(nowNt);
setPeriod(NOT_TOO_OFTEN(10 /* ms */, engineConfiguration->lcdThreadPeriodMs)); setPeriod(NOT_TOO_OFTEN(10 /* ms */, engineConfiguration->lcdThreadPeriodMs));
if (engineConfiguration->useLcdScreen) { if (engineConfiguration->useLcdScreen) {

View File

@ -355,7 +355,7 @@ bool Engine::isInShutdownMode() const {
if (stopEngineRequestTimeNt == 0) // the shutdown procedure is not started if (stopEngineRequestTimeNt == 0) // the shutdown procedure is not started
return false; return false;
const efitime_t engineStopWaitTimeoutNt = 5LL * 1000000LL; const efitick_t engineStopWaitTimeoutNt = 5LL * 1000000LL;
// The engine is still spinning! Give it some time to stop (but wait no more than 5 secs) // The engine is still spinning! Give it some time to stop (but wait no more than 5 secs)
if (isSpinning && (getTimeNowNt() - stopEngineRequestTimeNt) < US2NT(engineStopWaitTimeoutNt)) if (isSpinning && (getTimeNowNt() - stopEngineRequestTimeNt) < US2NT(engineStopWaitTimeoutNt))
return true; return true;

View File

@ -141,16 +141,11 @@ public:
bool isCltBroken = false; bool isCltBroken = false;
bool slowCallBackWasInvoked = false; bool slowCallBackWasInvoked = false;
// floatms_t callToPitEndTime;
/** /**
* remote telemetry: if not zero, time to stop flashing 'CALL FROM PIT STOP' light * remote telemetry: if not zero, time to stop flashing 'CALL FROM PIT STOP' light
* todo: looks like there is a bug here? 64 bit storage an 32 bit time logic? anyway this feature is mostly a dream at this point
*/ */
efitime_t callFromPitStopEndTime = 0; efitimems64_t callFromPitStopEndTime = 0;
// timestamp of most recent time RPM hard limit was triggered
efitime_t rpmHardLimitTimestamp = 0;
/** /**
* This flag indicated a big enough problem that engine control would be * This flag indicated a big enough problem that engine control would be
@ -242,6 +237,7 @@ public:
* some areas * some areas
*/ */
bool isTestMode = false; bool isTestMode = false;
void resetEngineSnifferIfInTestMode(); void resetEngineSnifferIfInTestMode();
/** /**

View File

@ -30,7 +30,7 @@ typedef unsigned int time_t;
typedef time_t efitimesec_t; typedef time_t efitimesec_t;
/** /**
* integer time in milliseconds * integer time in milliseconds (1/1_000 of a second)
* 32 bit 4B / 1000 = 4M seconds = 1111.11 hours = 46 days. * 32 bit 4B / 1000 = 4M seconds = 1111.11 hours = 46 days.
* Please restart your ECU every 46 days? :) * Please restart your ECU every 46 days? :)
* See getTimeNowUs() * See getTimeNowUs()
@ -51,10 +51,16 @@ typedef int pid_dt;
typedef int64_t efitime_t; typedef int64_t efitime_t;
/** /**
* 64 bit time in microseconds, since boot * 64 bit time in microseconds (1/1_000_000 of a second), since boot
*/ */
typedef efitime_t efitimeus_t; typedef efitime_t efitimeus_t;
/**
* 64 bit time in milliseconds (1/1_000 of a second), since boot
*/
typedef efitime_t efitimems64_t;
/** /**
* platform-dependent tick since boot * platform-dependent tick since boot
* in case of stm32f4 that's a CPU tick * in case of stm32f4 that's a CPU tick

View File

@ -96,7 +96,7 @@ RpmCalculator::RpmCalculator() {
// which we cannot provide inside this parameter-less constructor. need a solution for this minor mess // which we cannot provide inside this parameter-less constructor. need a solution for this minor mess
// we need this initial to have not_running at first invocation // we need this initial to have not_running at first invocation
lastRpmEventTimeNt = (efitime_t) -10 * US2NT(US_PER_SECOND_LL); lastRpmEventTimeNt = (efitick_t) -10 * US2NT(US_PER_SECOND_LL);
} }
/** /**
@ -200,7 +200,7 @@ void RpmCalculator::setStopSpinning(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
setStopped(PASS_ENGINE_PARAMETER_SIGNATURE); setStopped(PASS_ENGINE_PARAMETER_SIGNATURE);
} }
void RpmCalculator::setSpinningUp(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) { void RpmCalculator::setSpinningUp(efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (!CONFIG(isFasterEngineSpinUpEnabled)) if (!CONFIG(isFasterEngineSpinUpEnabled))
return; return;
// Only a completely stopped and non-spinning engine can enter the spinning-up state. // Only a completely stopped and non-spinning engine can enter the spinning-up state.
@ -239,7 +239,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
bool hadRpmRecently = rpmState->checkIfSpinning(nowNt PASS_ENGINE_PARAMETER_SUFFIX); bool hadRpmRecently = rpmState->checkIfSpinning(nowNt PASS_ENGINE_PARAMETER_SUFFIX);
if (hadRpmRecently) { if (hadRpmRecently) {
efitime_t diffNt = nowNt - rpmState->lastRpmEventTimeNt; efitick_t diffNt = nowNt - rpmState->lastRpmEventTimeNt;
/** /**
* Four stroke cycle is two crankshaft revolutions * Four stroke cycle is two crankshaft revolutions
* *
@ -329,8 +329,8 @@ static void tdcMarkCallback(trigger_event_e ckpSignalType,
/** /**
* @return Current crankshaft angle, 0 to 720 for four-stroke * @return Current crankshaft angle, 0 to 720 for four-stroke
*/ */
float getCrankshaftAngleNt(efitime_t timeNt DECLARE_ENGINE_PARAMETER_SUFFIX) { float getCrankshaftAngleNt(efitick_t timeNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
efitime_t timeSinceZeroAngleNt = timeNt efitick_t timeSinceZeroAngleNt = timeNt
- engine->rpmCalculator.lastRpmEventTimeNt; - engine->rpmCalculator.lastRpmEventTimeNt;
/** /**

View File

@ -74,7 +74,7 @@ public:
/** /**
* Should be called on every trigger event when the engine is just starting to spin up. * Should be called on every trigger event when the engine is just starting to spin up.
*/ */
void setSpinningUp(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX); void setSpinningUp(efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX);
/** /**
* Called if the synchronization is lost due to a trigger timeout. * Called if the synchronization is lost due to a trigger timeout.
*/ */
@ -116,7 +116,7 @@ public:
* NaN while engine is not spinning * NaN while engine is not spinning
*/ */
volatile floatus_t oneDegreeUs = NAN; volatile floatus_t oneDegreeUs = NAN;
volatile efitime_t lastRpmEventTimeNt = 0; volatile efitick_t lastRpmEventTimeNt = 0;
private: private:
/** /**
* Should be called once we've realized engine is not spinning any more. * Should be called once we've realized engine is not spinning any more.
@ -156,7 +156,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index DECL
*/ */
void initRpmCalculator(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX); void initRpmCalculator(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
float getCrankshaftAngleNt(efitime_t timeNt DECLARE_ENGINE_PARAMETER_SUFFIX); float getCrankshaftAngleNt(efitick_t timeNt DECLARE_ENGINE_PARAMETER_SUFFIX);
#define getRevolutionCounter() ENGINE(rpmCalculator.getRevolutionCounterM()) #define getRevolutionCounter() ENGINE(rpmCalculator.getRevolutionCounterM())

View File

@ -84,7 +84,7 @@ class MILController : public PeriodicController<UTILITY_THREAD_STACK_SIZE> {
public: public:
MILController() : PeriodicController("MFIndicator") { } MILController() : PeriodicController("MFIndicator") { }
private: private:
void PeriodicTask(efitime_t nowNt) override { void PeriodicTask(efitick_t nowNt) override {
UNUSED(nowNt); UNUSED(nowNt);
if (nowNt - engine->triggerCentral.triggerState.mostRecentSyncTime < US2NT(MS2US(500))) { if (nowNt - engine->triggerCentral.triggerState.mostRecentSyncTime < US2NT(MS2US(500))) {

View File

@ -236,7 +236,7 @@ class BenchController : public PeriodicController<UTILITY_THREAD_STACK_SIZE> {
public: public:
BenchController() : PeriodicController("BenchThread") { } BenchController() : PeriodicController("BenchThread") { }
private: private:
void PeriodicTask(efitime_t nowNt) override { void PeriodicTask(efitick_t nowNt) override {
UNUSED(nowNt); UNUSED(nowNt);
setPeriod(50 /* ms */); setPeriod(50 /* ms */);

View File

@ -53,7 +53,7 @@ protected:
/** /**
* @brief Called periodically. Override this method to do work for your controller. * @brief Called periodically. Override this method to do work for your controller.
*/ */
virtual void PeriodicTask(efitime_t nowNt) = 0; virtual void PeriodicTask(efitick_t nowNt) = 0;
private: private:
void ThreadTask() override final void ThreadTask() override final
@ -63,7 +63,7 @@ private:
while(true) while(true)
{ {
systime_t before = chVTGetSystemTime(); systime_t before = chVTGetSystemTime();
efitime_t nowNt = getTimeNowNt(); efitick_t nowNt = getTimeNowNt();
{ {
ScopePerf perf(PE::PeriodicControllerPeriodicTask); ScopePerf perf(PE::PeriodicControllerPeriodicTask);

View File

@ -112,7 +112,7 @@ static efitimeus_t getNextSwitchTimeUs(PwmConfig *state) {
* Once 'iteration' gets relatively high, we might lose calculation precision here. * Once 'iteration' gets relatively high, we might lose calculation precision here.
* This is addressed by ITERATION_LIMIT * This is addressed by ITERATION_LIMIT
*/ */
efitime_t timeToSwitchNt = (efitime_t) ((iteration + switchTime) * periodNt); efitick_t timeToSwitchNt = (efitick_t) ((iteration + switchTime) * periodNt);
#if DEBUG_PWM #if DEBUG_PWM
scheduleMsg(&logger, "start=%d timeToSwitch=%d", state->safe.start, timeToSwitch); scheduleMsg(&logger, "start=%d timeToSwitch=%d", state->safe.start, timeToSwitch);

View File

@ -37,8 +37,6 @@ EXTERN_ENGINE;
extern schfunc_t globalTimerCallback; extern schfunc_t globalTimerCallback;
//static int timerIsLate = 0;
//static efitime_t callbackTime = 0;
/** /**
* these fields are global in order to facilitate debugging * these fields are global in order to facilitate debugging
*/ */

View File

@ -46,7 +46,7 @@ public:
efitick_t previousVvtCamTime = 0; efitick_t previousVvtCamTime = 0;
efitick_t previousVvtCamDuration = 0; efitick_t previousVvtCamDuration = 0;
volatile efitime_t previousShaftEventTimeNt; volatile efitick_t previousShaftEventTimeNt;
private: private:
IntListenerArray<15> triggerListeneres; IntListenerArray<15> triggerListeneres;
@ -57,7 +57,6 @@ private:
}; };
void triggerInfo(void); void triggerInfo(void);
efitime_t getCrankEventCounter(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void hwHandleShaftSignal(trigger_event_e signal); void hwHandleShaftSignal(trigger_event_e signal);
void hwHandleVvtCamSignal(trigger_value_e front DECLARE_ENGINE_PARAMETER_SUFFIX); void hwHandleVvtCamSignal(trigger_value_e front DECLARE_ENGINE_PARAMETER_SUFFIX);

View File

@ -172,7 +172,7 @@ void calculateTriggerSynchPoint(TriggerWaveform *shape, TriggerState *state DECL
} }
} }
efitime_t TriggerState::getTotalEventCounter() const { int64_t TriggerState::getTotalEventCounter() const {
return totalEventCountBase + currentCycle.current_index; return totalEventCountBase + currentCycle.current_index;
} }
@ -188,7 +188,7 @@ void TriggerStateWithRunningStatistics::movePreSynchTimestamps(DECLARE_ENGINE_PA
} }
} }
float TriggerStateWithRunningStatistics::calculateInstantRpm(int *prevIndexOut, efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) { float TriggerStateWithRunningStatistics::calculateInstantRpm(int *prevIndexOut, efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
int current_index = currentCycle.current_index; // local copy so that noone changes the value on us int current_index = currentCycle.current_index; // local copy so that noone changes the value on us
timeOfLastEvent[current_index] = nowNt; timeOfLastEvent[current_index] = nowNt;
/** /**
@ -236,7 +236,7 @@ float TriggerStateWithRunningStatistics::calculateInstantRpm(int *prevIndexOut,
return instantRpm; return instantRpm;
} }
void TriggerStateWithRunningStatistics::setLastEventTimeForInstantRpm(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) { void TriggerStateWithRunningStatistics::setLastEventTimeForInstantRpm(efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (shaft_is_synchronized) { if (shaft_is_synchronized) {
return; return;
} }
@ -250,7 +250,7 @@ void TriggerStateWithRunningStatistics::setLastEventTimeForInstantRpm(efitime_t
spinningEvents[spinningEventIndex++] = nowNt; spinningEvents[spinningEventIndex++] = nowNt;
} }
void TriggerStateWithRunningStatistics::runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) { void TriggerStateWithRunningStatistics::runtimeStatistics(efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (engineConfiguration->debugMode == DBG_INSTANT_RPM) { if (engineConfiguration->debugMode == DBG_INSTANT_RPM) {
instantRpm = calculateInstantRpm(NULL, nowNt PASS_ENGINE_PARAMETER_SUFFIX); instantRpm = calculateInstantRpm(NULL, nowNt PASS_ENGINE_PARAMETER_SUFFIX);
} }
@ -385,7 +385,7 @@ void TriggerState::handleTriggerError(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
} }
void TriggerState::onShaftSynchronization(const TriggerStateCallback triggerCycleCallback, void TriggerState::onShaftSynchronization(const TriggerStateCallback triggerCycleCallback,
efitime_t nowNt, trigger_wheel_e triggerWheel DECLARE_ENGINE_PARAMETER_SUFFIX) { efitick_t nowNt, trigger_wheel_e triggerWheel DECLARE_ENGINE_PARAMETER_SUFFIX) {
setShaftSynchronized(true); setShaftSynchronized(true);
// this call would update duty cycle values // this call would update duty cycle values
nextTriggerEvent() nextTriggerEvent()
@ -418,7 +418,7 @@ void TriggerState::onShaftSynchronization(const TriggerStateCallback triggerCycl
*/ */
void TriggerState::decodeTriggerEvent(const TriggerStateCallback triggerCycleCallback, void TriggerState::decodeTriggerEvent(const TriggerStateCallback triggerCycleCallback,
TriggerStateListener * triggerStateListener, TriggerStateListener * triggerStateListener,
trigger_event_e const signal, efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) { trigger_event_e const signal, efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
ScopePerf perf(PE::DecodeTriggerEvent, static_cast<uint8_t>(signal)); ScopePerf perf(PE::DecodeTriggerEvent, static_cast<uint8_t>(signal));
bool useOnlyRisingEdgeForTrigger = CONFIG(useOnlyRisingEdgeForTrigger); bool useOnlyRisingEdgeForTrigger = CONFIG(useOnlyRisingEdgeForTrigger);
@ -441,7 +441,7 @@ void TriggerState::decodeTriggerEvent(const TriggerStateCallback triggerCycleCal
efiAssertVoid(CUSTOM_OBD_93, toothed_previous_time <= nowNt, "toothed_previous_time after nowNt"); efiAssertVoid(CUSTOM_OBD_93, toothed_previous_time <= nowNt, "toothed_previous_time after nowNt");
efitime_t currentDurationLong = getCurrentGapDuration(nowNt); efitick_t currentDurationLong = getCurrentGapDuration(nowNt);
/** /**
* For performance reasons, we want to work with 32 bit values. If there has been more then * For performance reasons, we want to work with 32 bit values. If there has been more then
@ -760,7 +760,7 @@ void initTriggerDecoderLogger(Logging *sharedLogger) {
logger = sharedLogger; logger = sharedLogger;
} }
void TriggerState::runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) { void TriggerState::runtimeStatistics(efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
UNUSED(nowNt); UNUSED(nowNt);
// empty base implementation // empty base implementation
} }

View File

@ -72,7 +72,7 @@ public:
bool validateEventCounters(DECLARE_ENGINE_PARAMETER_SIGNATURE) const; bool validateEventCounters(DECLARE_ENGINE_PARAMETER_SIGNATURE) const;
void handleTriggerError(DECLARE_ENGINE_PARAMETER_SIGNATURE); void handleTriggerError(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void onShaftSynchronization(const TriggerStateCallback triggerCycleCallback, void onShaftSynchronization(const TriggerStateCallback triggerCycleCallback,
efitime_t nowNt, trigger_wheel_e triggerWheel DECLARE_ENGINE_PARAMETER_SUFFIX); efitick_t nowNt, trigger_wheel_e triggerWheel DECLARE_ENGINE_PARAMETER_SUFFIX);
/** /**
* Resets synchronization flag and alerts rpm_calculator to reset engine spinning flag. * Resets synchronization flag and alerts rpm_calculator to reset engine spinning flag.
*/ */
@ -85,7 +85,7 @@ public:
* TRUE if we know where we are * TRUE if we know where we are
*/ */
bool shaft_is_synchronized; bool shaft_is_synchronized;
efitime_t mostRecentSyncTime; efitick_t mostRecentSyncTime;
efitick_t lastDecodingErrorTime; efitick_t lastDecodingErrorTime;
// the boolean flag is a performance optimization so that complex comparison is avoided if no error // the boolean flag is a performance optimization so that complex comparison is avoided if no error
@ -96,7 +96,7 @@ public:
*/ */
uint32_t toothDurations[GAP_TRACKING_LENGTH + 1]; uint32_t toothDurations[GAP_TRACKING_LENGTH + 1];
efitime_t toothed_previous_time; efitick_t toothed_previous_time;
current_cycle_state_s currentCycle; current_cycle_state_s currentCycle;
@ -112,7 +112,7 @@ public:
void setShaftSynchronized(bool value); void setShaftSynchronized(bool value);
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT #if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
virtual void runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX); virtual void runtimeStatistics(efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX);
#endif #endif
/** /**
@ -125,7 +125,7 @@ private:
trigger_event_e curSignal; trigger_event_e curSignal;
trigger_event_e prevSignal; trigger_event_e prevSignal;
efitime_t totalEventCountBase; int64_t totalEventCountBase;
uint32_t totalRevolutionCounter; uint32_t totalRevolutionCounter;
bool isFirstEvent; bool isFirstEvent;
}; };
@ -158,15 +158,15 @@ public:
*/ */
float prevInstantRpmValue = 0; float prevInstantRpmValue = 0;
void movePreSynchTimestamps(DECLARE_ENGINE_PARAMETER_SIGNATURE); void movePreSynchTimestamps(DECLARE_ENGINE_PARAMETER_SIGNATURE);
float calculateInstantRpm(int *prevIndex, efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX); float calculateInstantRpm(int *prevIndex, efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX);
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT #if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
void runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) override; void runtimeStatistics(efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) override;
#endif #endif
/** /**
* Update timeOfLastEvent[] on every trigger event - even without synchronization * Update timeOfLastEvent[] on every trigger event - even without synchronization
* Needed for early spin-up RPM detection. * Needed for early spin-up RPM detection.
*/ */
void setLastEventTimeForInstantRpm(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX); void setLastEventTimeForInstantRpm(efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX);
}; };
angle_t getEngineCycle(operation_mode_e operationMode); angle_t getEngineCycle(operation_mode_e operationMode);

View File

@ -113,7 +113,7 @@ bool WaveChart::isStartedTooLongAgo() const {
* engineChartSize/20 is the longest meaningful chart. * engineChartSize/20 is the longest meaningful chart.
* *
*/ */
efitime_t chartDurationNt = getTimeNowNt() - startTimeNt; efitick_t chartDurationNt = getTimeNowNt() - startTimeNt;
return startTimeNt != 0 && NT2US(chartDurationNt) > engineConfiguration->engineChartSize * 1000000 / 20; return startTimeNt != 0 && NT2US(chartDurationNt) > engineConfiguration->engineChartSize * 1000000 / 20;
} }

View File

@ -37,7 +37,7 @@ private:
* https://github.com/rusefi/rusefi/issues/780 * https://github.com/rusefi/rusefi/issues/780
*/ */
bool collectingData = false; bool collectingData = false;
efitime_t startTimeNt = 0; efitick_t startTimeNt = 0;
volatile int isInitialized = false; volatile int isInitialized = false;
}; };

View File

@ -43,7 +43,7 @@ extern bool hasFirmwareErrorFlag;
* Difference between current 1st trigger event and previous 1st trigger event. * Difference between current 1st trigger event and previous 1st trigger event.
*/ */
static volatile uint32_t engineCycleDurationUs; static volatile uint32_t engineCycleDurationUs;
static volatile efitime_t previousEngineCycleTimeUs = 0; static volatile efitimeus_t previousEngineCycleTimeUs = 0;
static int waveReaderCount = 0; static int waveReaderCount = 0;
static WaveReader readers[MAX_ICU_COUNT]; static WaveReader readers[MAX_ICU_COUNT];
@ -133,7 +133,7 @@ static void waTriggerEventListener(trigger_event_e ckpSignalType, uint32_t index
if (index != 0) { if (index != 0) {
return; return;
} }
efitick_t nowUs = getTimeNowUs(); efitimeus_t nowUs = getTimeNowUs();
engineCycleDurationUs = nowUs - previousEngineCycleTimeUs; engineCycleDurationUs = nowUs - previousEngineCycleTimeUs;
previousEngineCycleTimeUs = nowUs; previousEngineCycleTimeUs = nowUs;
} }

View File

@ -421,7 +421,7 @@ public:
{ {
} }
void PeriodicTask(efitime_t nowNt) override { void PeriodicTask(efitick_t nowNt) override {
{ {
ScopePerf perf(PE::AdcConversionSlow); ScopePerf perf(PE::AdcConversionSlow);

View File

@ -130,7 +130,7 @@ static void hwTimerCallback(GPTDriver *gptp) {
class MicrosecondTimerWatchdogController : public PeriodicTimerController { class MicrosecondTimerWatchdogController : public PeriodicTimerController {
void PeriodicTask() override { void PeriodicTask() override {
efitime_t nowNt = getTimeNowNt(); efitick_t nowNt = getTimeNowNt();
if (nowNt >= lastSetTimerTimeNt + 2 * CORE_CLOCK) { if (nowNt >= lastSetTimerTimeNt + 2 * CORE_CLOCK) {
strcpy(buff, "no_event"); strcpy(buff, "no_event");
itoa10(&buff[8], lastSetTimerValue); itoa10(&buff[8], lastSetTimerValue);

View File

@ -61,7 +61,7 @@ class AccelController : public PeriodicController<UTILITY_THREAD_STACK_SIZE> {
public: public:
AccelController() : PeriodicController("Acc SPI") { } AccelController() : PeriodicController("Acc SPI") { }
private: private:
void PeriodicTask(efitime_t nowNt) override { void PeriodicTask(efitick_t nowNt) override {
// has to be a thread since we want to use blocking method - blocking method only available in threads, not in interrupt handler // has to be a thread since we want to use blocking method - blocking method only available in threads, not in interrupt handler
// todo: migrate to async SPI API? // todo: migrate to async SPI API?
engine->sensors.accelerometer.x = (int8_t)lis302dlReadRegister(driver, LIS302DL_OUTX); engine->sensors.accelerometer.x = (int8_t)lis302dlReadRegister(driver, LIS302DL_OUTX);

View File

@ -2,7 +2,6 @@ package com.rusefi.ui;
import com.rusefi.AverageAnglesUtil; import com.rusefi.AverageAnglesUtil;
import com.rusefi.FileLog; import com.rusefi.FileLog;
import com.rusefi.IoUtil;
import com.rusefi.config.generated.Fields; import com.rusefi.config.generated.Fields;
import com.rusefi.core.MessagesCentral; import com.rusefi.core.MessagesCentral;
import com.rusefi.io.CommandQueue; import com.rusefi.io.CommandQueue;