distinguish between "timestamp" and "duration"
This commit is contained in:
parent
9932330bca
commit
005d2eb21a
|
@ -70,7 +70,7 @@ public:
|
|||
|
||||
struct multispark_state
|
||||
{
|
||||
efitick_t delay = 0;
|
||||
efitick_t dwell = 0;
|
||||
efidur_t delay = 0;
|
||||
efidur_t dwell = 0;
|
||||
uint8_t count = 0;
|
||||
};
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
*/
|
||||
using efitimems_t = uint32_t;
|
||||
|
||||
using efidur_t = efitick_t;
|
||||
|
||||
// date-time struct a la ctime struct tm
|
||||
typedef struct {
|
||||
uint32_t year = 0;
|
||||
|
|
|
@ -32,7 +32,7 @@ void postMapState(TunerStudioOutputChannels *tsOutputChannels);
|
|||
|
||||
class MapAverager : public StoredValueSensor {
|
||||
public:
|
||||
MapAverager(SensorType type, efitick_t timeout)
|
||||
MapAverager(SensorType type, efidur_t timeout)
|
||||
: StoredValueSensor(type, timeout)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*/
|
||||
class CanSensorBase : public StoredValueSensor, public CanListener {
|
||||
public:
|
||||
CanSensorBase(uint32_t eid, SensorType type, efitick_t timeout)
|
||||
CanSensorBase(uint32_t eid, SensorType type, efidur_t timeout)
|
||||
: StoredValueSensor(type, timeout)
|
||||
, CanListener(eid)
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ public:
|
|||
template <typename TStorage, int TScale>
|
||||
class CanSensor : public CanSensorBase {
|
||||
public:
|
||||
CanSensor(uint32_t eid, uint8_t offset, SensorType type, efitick_t timeout)
|
||||
CanSensor(uint32_t eid, uint8_t offset, SensorType type, efidur_t timeout)
|
||||
: CanSensorBase(eid, type, timeout)
|
||||
, m_offset(offset)
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
*/
|
||||
class FunctionalSensor : public StoredValueSensor {
|
||||
public:
|
||||
FunctionalSensor(SensorType type, efitick_t timeoutPeriod)
|
||||
FunctionalSensor(SensorType type, efidur_t timeoutPeriod)
|
||||
: StoredValueSensor(type, timeoutPeriod) { }
|
||||
|
||||
void postRawValue(float inputValue, efitick_t timestamp);
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
StoredValueSensor(SensorType type, efitick_t timeoutNt)
|
||||
StoredValueSensor(SensorType type, efidur_t timeoutNt)
|
||||
: Sensor(type)
|
||||
, m_result(unexpected)
|
||||
, m_timeoutPeriod(timeoutNt)
|
||||
|
@ -84,6 +84,6 @@ public:
|
|||
private:
|
||||
SensorResult m_result;
|
||||
|
||||
efitick_t m_timeoutPeriod;
|
||||
efidur_t m_timeoutPeriod;
|
||||
efitick_t m_lastUpdate = 0;
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
class FrequencySensor : public FunctionalSensor {
|
||||
public:
|
||||
FrequencySensor(SensorType type, efitick_t timeoutPeriod)
|
||||
FrequencySensor(SensorType type, efidur_t timeoutPeriod)
|
||||
: FunctionalSensor(type, timeoutPeriod)
|
||||
{ }
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ extern int timeNowUs;
|
|||
extern bool verboseMode;
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
|
||||
EventQueue::EventQueue(efitick_t lateDelay)
|
||||
EventQueue::EventQueue(efidur_t lateDelay)
|
||||
: m_lateDelay(lateDelay)
|
||||
{
|
||||
for (size_t i = 0; i < efi::size(m_pool); i++) {
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
// See comment in EventQueue::executeAll for info about lateDelay - it sets the
|
||||
// time gap between events for which we will wait instead of rescheduling the next
|
||||
// event in a group of events near one another.
|
||||
explicit EventQueue(efitick_t lateDelay = 0);
|
||||
explicit EventQueue(efidur_t lateDelay = 0);
|
||||
|
||||
/**
|
||||
* O(size) - linear search in sorted linked list
|
||||
|
@ -69,7 +69,7 @@ private:
|
|||
* this list is sorted
|
||||
*/
|
||||
scheduling_s *m_head = nullptr;
|
||||
const efitick_t m_lateDelay;
|
||||
const efidur_t m_lateDelay;
|
||||
|
||||
scheduling_s* m_freelist = nullptr;
|
||||
scheduling_s m_pool[64];
|
||||
|
|
|
@ -67,7 +67,7 @@ void SingleTimerExecutor::scheduleByTimestampNt(const char *msg, scheduling_s* s
|
|||
ScopePerf perf(PE::SingleTimerExecutorScheduleByTimestamp);
|
||||
|
||||
#if EFI_ENABLE_ASSERTS
|
||||
efitick_t deltaTimeNt = nt - getTimeNowNt();
|
||||
efidur_t deltaTimeNt = nt - getTimeNowNt();
|
||||
|
||||
if (deltaTimeNt >= TOO_FAR_INTO_FUTURE_NT) {
|
||||
// we are trying to set callback for too far into the future. This does not look right at all
|
||||
|
|
|
@ -71,7 +71,7 @@ void TriggerDecoderBase::resetState() {
|
|||
m_timeSinceDecodeError.init();
|
||||
|
||||
prevSignal = SHAFT_PRIMARY_FALLING;
|
||||
startOfCycleNt = 0;
|
||||
startOfCycleNt = {};
|
||||
|
||||
resetCurrentCycleState();
|
||||
|
||||
|
@ -406,7 +406,7 @@ expected<TriggerDecodeResult> TriggerDecoderBase::decodeTriggerEvent(
|
|||
firmwareError(ObdCode::CUSTOM_OBD_93, "[%s] toothed_previous_time after nowNt prev=%d now=%d", msg, toothed_previous_time, nowNt);
|
||||
}
|
||||
|
||||
efitick_t currentDurationLong = isFirstEvent ? 0 : nowNt - toothed_previous_time;
|
||||
efidur_t currentDurationLong = isFirstEvent ? 0 : (nowNt - toothed_previous_time);
|
||||
|
||||
/**
|
||||
* For performance reasons, we want to work with 32 bit values. If there has been more then
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
bool getPhysicalState();
|
||||
private:
|
||||
const char* const m_name;
|
||||
efitick_t m_threshold;
|
||||
efidur_t m_threshold;
|
||||
Timer timeLast;
|
||||
brain_pin_e *m_pin;
|
||||
brain_pin_e active_pin = Gpio::Unassigned;
|
||||
|
|
|
@ -43,8 +43,8 @@ public:
|
|||
|
||||
// these thresholds allow to switch from ADC mode (low-rpm) to EXTI mode (fast-rpm), indicating the clamping of the signal
|
||||
triggerAdcSample_t switchingThresholdLow = 0, switchingThresholdHigh = 0;
|
||||
efitick_t minDeltaTimeForStableAdcDetectionNt = 0;
|
||||
efitick_t stampCorrectionForAdc = 0;
|
||||
efidur_t minDeltaTimeForStableAdcDetectionNt = 0;
|
||||
efidur_t stampCorrectionForAdc = 0;
|
||||
int switchingCnt = 0, switchingTeethCnt = 0;
|
||||
int prevValue = 0; // not set
|
||||
efitick_t prevStamp = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/**
|
||||
* Stores the recent peak value, preventing loss of intermittent peaks in a signal.
|
||||
*/
|
||||
template <typename TValue, efitick_t TTimeoutPeriod>
|
||||
template <typename TValue, efidur_t TTimeoutPeriod>
|
||||
class PeakDetect {
|
||||
public:
|
||||
TValue detect(TValue currentValue, efitick_t nowNt) {
|
||||
|
|
Loading…
Reference in New Issue