m_hasSynchronizedSymmetrical handling improvements #4099

API progress
This commit is contained in:
rusefillc 2022-05-09 04:04:38 -04:00
parent 2e89cca180
commit d5e131b1d0
3 changed files with 13 additions and 1 deletions

View File

@ -82,6 +82,7 @@ void TriggerState::resetTriggerState() {
isFirstEvent = true; isFirstEvent = true;
m_hasSynchronizedPhase = false; m_hasSynchronizedPhase = false;
synchronizedPhase.init();
} }
void TriggerState::setTriggerErrorState() { void TriggerState::setTriggerErrorState() {

View File

@ -2,10 +2,18 @@
#include "timer.h" #include "timer.h"
Timer::Timer() {
init();
}
void Timer::reset() { void Timer::reset() {
m_lastReset = getTimeNowNt(); m_lastReset = getTimeNowNt();
} }
void Timer::init() {
m_lastReset = INT64_MIN / 8;
}
void Timer::reset(efitick_t nowNt) { void Timer::reset(efitick_t nowNt) {
m_lastReset = nowNt; m_lastReset = nowNt;
} }

View File

@ -8,10 +8,13 @@
*/ */
class Timer { class Timer {
public: public:
Timer();
void reset(); void reset();
// Reset the timer to a known timestamp (don't take a timestamp internally) // Reset the timer to a known timestamp (don't take a timestamp internally)
void reset(efitick_t nowNt); void reset(efitick_t nowNt);
// returns timer to the most original-as-constructed state
void init();
bool hasElapsedSec(float seconds) const; bool hasElapsedSec(float seconds) const;
bool hasElapsedMs(float ms) const; bool hasElapsedMs(float ms) const;
@ -32,5 +35,5 @@ public:
private: private:
// Use not-quite-minimum value to avoid overflow // Use not-quite-minimum value to avoid overflow
efitick_t m_lastReset = INT64_MIN / 8; efitick_t m_lastReset;
}; };